author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 28 Feb 2016 14:53:56 +0000 | |
changeset 51 | 5293f2b851ab |
parent 47 | 061f23d91383 |
child 57 | 2c9a342e1f2a |
permissions | -rw-r--r-- |
1 | 1 |
"{ Package: 'stx:goodies/libcairo' }" |
2 |
||
3 |
"{ NameSpace: Cairo }" |
|
4 |
||
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
5 |
CObject subclass:#Surface |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
6 |
instanceVariableNames:'view drawable' |
1 | 7 |
classVariableNames:'' |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
8 |
poolDictionaries:'Cairo::SurfaceType Cairo::Format' |
12 | 9 |
category:'Cairo-Objects' |
1 | 10 |
! |
11 |
||
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
12 |
|
1 | 13 |
!Surface class methodsFor:'instance creation'! |
14 |
||
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
15 |
forView: aView |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
16 |
^ self onView: aView |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
17 |
|
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
18 |
"Created: / 10-07-2008 / 10:15:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
19 |
"Modified: / 14-02-2016 / 00:01:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
20 |
! |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
21 |
|
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
22 |
newImageWithFormat:format width:width height:height |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
23 |
^ CPrimitives |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
24 |
cairo_image_surface_create:format |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
25 |
_:width |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
26 |
_:height |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
27 |
|
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
28 |
"Created: / 24-12-2014 / 23:43:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
29 |
"Modified: / 28-12-2014 / 22:03:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
30 |
! |
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
31 |
|
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
32 |
newImageWithFormat:format width:width height:height similarTo: surface |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
33 |
^ CPrimitives |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
34 |
cairo_surface_create_similar_image: surface |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
35 |
_:format |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
36 |
_:width |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
37 |
_:height |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
38 |
|
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
39 |
"Created: / 27-02-2016 / 16:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
40 |
! |
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
41 |
|
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
42 |
newPDFWithFile:aStringOrFilename width:w height:h |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
43 |
^ CPrimitives |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
44 |
cairo_pdf_surface_create:aStringOrFilename asFilename asString |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
45 |
_:w asDouble |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
46 |
_:h asDouble |
1 | 47 |
|
48 |
"Created: / 10-07-2008 / 09:35:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
49 |
"Modified: / 28-12-2014 / 22:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 50 |
! |
51 |
||
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
52 |
newPNGWithFile:aStringOrFilename |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
53 |
aStringOrFilename asFilename exists ifFalse:[ |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
54 |
self error: 'No such file'. |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
55 |
]. |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
56 |
^ CPrimitives cairo_image_surface_create_from_png:aStringOrFilename asFilename asString |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
57 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
58 |
"Created: / 28-02-2016 / 07:52:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
59 |
! |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
47
diff
changeset
|
60 |
|
45
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
61 |
newWin32WithHDC: hdc |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
62 |
^ CPrimitives cairo_win32_surface_create:hdc |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
63 |
|
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
64 |
"Created: / 19-02-2016 / 12:07:29 / jv" |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
65 |
! |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
66 |
|
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
67 |
newXlibWithDisplay:dpy drawable:drawable visual:visual width:width height:height |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
68 |
^ CPrimitives |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
69 |
cairo_xlib_surface_create:dpy |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
70 |
_:drawable |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
71 |
_:visual |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
72 |
_:width |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
73 |
_:height |
1 | 74 |
|
75 |
"Created: / 10-07-2008 / 11:06:22 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
76 |
"Modified: / 28-12-2014 / 22:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
77 |
! |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
78 |
|
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
79 |
onView: aView |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
80 |
aView device platformName == #X11 ifTrue:[ |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
81 |
| surface | |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
82 |
surface := self newXlibWithDisplay:aView device displayId |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
83 |
drawable:aView drawableId address |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
84 |
visual:aView device queryDefaultVisual |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
85 |
width:aView width |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
86 |
height:aView height. |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
87 |
surface setView: aView. |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
88 |
^ surface. |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
89 |
]. |
45
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
90 |
(aView device platformName = 'WIN32') ifTrue:[ |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
91 |
aView gcId isNil ifTrue:[ |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
92 |
aView initGC |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
93 |
]. |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
94 |
^ self newWin32WithHDC: (aView device hdcForGC: aView gcId) |
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
95 |
]. |
38
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
96 |
self error: 'Unsupported plarform' |
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
97 |
|
9c94e463018a
Split classes for individual surfaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
98 |
"Created: / 13-02-2016 / 23:47:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
45
8ee53c41a084
Win32: Initial support for Cairo under Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
99 |
"Modified: / 19-02-2016 / 12:11:20 / jv" |
1 | 100 |
! ! |
101 |
||
102 |
!Surface class methodsFor:'accessing'! |
|
103 |
||
12 | 104 |
dllPath |
105 |
||
106 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
107 |
^ #( 'C:\Windows' 'C:\Windows\System32' "Wild guess, should not harm" ) |
|
108 |
]. |
|
109 |
||
110 |
OperatingSystem isUNIXlike ifTrue:[ |
|
111 |
OperatingSystem getSystemType == #linux ifTrue:[ |
|
112 |
| path | |
|
113 |
||
114 |
path := #( '/lib' '/usr/lib' '/usr/local/lib' ). |
|
115 |
(OperatingSystem getSystemInfo at:#machine) = 'x86_64' ifTrue:[ |
|
116 |
"If the machine is 64bit, prepend standard path for 32bit libs. |
|
117 |
Leave standard paths at the end, as the system might be completely |
|
118 |
32bit but running on 64bit-capable CPU. |
|
119 |
||
120 |
CAVEAT: This is bit dangerous, as on 64bit OS, if ia32 libs are |
|
121 |
not installed byt 64bit sqlite libs are, then 64bit libs are found |
|
122 |
and when a function is called, segfault will occur!! |
|
123 |
||
124 |
Q: Is there a way how to figure out if the OS itself is 32bit, |
|
125 |
regardles on CPU?" |
|
126 |
path := #( '/lib32' '/usr/lib32' '/usr/local/lib32' ) , path. |
|
127 |
]. |
|
128 |
^path |
|
129 |
||
130 |
]. |
|
131 |
]. |
|
132 |
||
133 |
self error:'Unsupported operating system' |
|
134 |
||
135 |
" |
|
136 |
SqliteLibrary dllPath |
|
137 |
" |
|
138 |
||
139 |
"Created: / 31-08-2011 / 18:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
140 |
! |
|
141 |
||
1 | 142 |
libraryName |
143 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
144 |
OperatingSystem isUNIXlike ifTrue:[^'libcairo.so.2']. |
1 | 145 |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
146 |
OperatingSystem isMSWINDOWSlike ifTrue:[^'cairo.dll']. |
12 | 147 |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
148 |
self error:'Library name for host OS is not known' |
6
c1f387b40e3a
regenerated using newer version of CFace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5
diff
changeset
|
149 |
! |
c1f387b40e3a
regenerated using newer version of CFace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5
diff
changeset
|
150 |
|
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
151 |
sizeof |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
152 |
"Returns size of undelaying structure in bytes" |
1 | 153 |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
154 |
^0 |
1 | 155 |
! ! |
156 |
||
157 |
!Surface methodsFor:'accessing'! |
|
158 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
159 |
referenceCount |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
160 |
"Return value or reference counter" |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
161 |
|
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
162 |
^ CPrimitives cairo_surface_get_reference_count: self |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
163 |
|
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
164 |
"Created: / 28-12-2014 / 22:09:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16 | 165 |
! |
166 |
||
43 | 167 |
status |
168 |
"Checks whether an error has previously occurred for this object. |
|
169 |
See Cairo::Status pool for possible values." |
|
170 |
||
171 |
^ CPrimitives cairo_surface_status: self |
|
172 |
||
173 |
"Modified: / 23-02-2016 / 11:28:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
174 |
! |
|
175 |
||
1 | 176 |
type |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
177 |
^CPrimitives cairo_surface_get_type: self |
1 | 178 |
|
179 |
"Created: / 10-07-2008 / 10:34:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
180 |
"Modified: / 28-12-2014 / 21:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 181 |
! ! |
182 |
||
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
183 |
!Surface methodsFor:'cairo api'! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
184 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
185 |
finish |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
186 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
187 |
^CPrimitives cairo_surface_finish: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
188 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
189 |
"Created: / 17-06-2012 / 08:49:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
190 |
"Modified: / 28-12-2014 / 21:48:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
191 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
192 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
193 |
flush |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
194 |
"Do any pending drawing for the surface and also restore any temporary |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
195 |
modifications cairo has made to the surface's state. This function must |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
196 |
be called before switching from drawing on the surface with cairo to |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
197 |
drawing on it directly with native APIs, or accessing its memory outside |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
198 |
of Cairo. If the surface doesn't support direct access, then this function |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
199 |
does nothing." |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
200 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
201 |
CPrimitives cairo_surface_flush: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
202 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
203 |
"Created: / 10-07-2008 / 10:32:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
204 |
"Modified: / 18-02-2016 / 20:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
47
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
205 |
! |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
206 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
207 |
markDirty |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
208 |
"Tells cairo that drawing has been done to surface using means other than cairo, |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
209 |
and that cairo should reread any cached areas. Note that you must call |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
210 |
Cairo::Surface>>#flush before doing such drawing." |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
211 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
212 |
CPrimitives cairo_surface_mark_dirty: self. |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
213 |
self statusCheck. |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
214 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
215 |
"Created: / 24-02-2016 / 17:12:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
216 |
! |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
217 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
218 |
markDirtyX: x y: y width: w height: h |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
219 |
"Like $markDirty, but drawing has been done only to the specified rectangle, |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
220 |
so that cairo can retain cached contents for other parts of the surface. |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
221 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
222 |
Any cached clip set on the surface will be reset by this function, to |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
223 |
make sure that future cairo calls have the clip set that they expect." |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
224 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
225 |
CPrimitives cairo_surface_mark_dirty_rectangle: self _: x _:y _:w _:h. |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
226 |
self statusCheck. |
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
227 |
|
061f23d91383
CairoScaledFont: fixed drawing of CairoScaledFont on plain old DeviceGraphicsContext.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
228 |
"Created: / 24-02-2016 / 17:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
229 |
! ! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
230 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
38
diff
changeset
|
231 |
!Surface methodsFor:'private'! |
1 | 232 |
|
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
233 |
destroy |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
234 |
"Tell Cairo library to destroy the corresponding C object. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
235 |
Remember that object is physically destroyed only if internal |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
236 |
refcounter goes to zero. However, after calling destroy, |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
237 |
this instance should be treated as invalid." |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
238 |
|
36
9b680e54aa94
Take a step back: separate Cairo's GraphicsContext (cairo_t) and Smalltalk/X's graphics context
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
239 |
CPrimitives cairo_surface_destroy: self. |
9b680e54aa94
Take a step back: separate Cairo's GraphicsContext (cairo_t) and Smalltalk/X's graphics context
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
240 |
self setAddress: nil. |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
241 |
|
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
242 |
"Created: / 28-12-2014 / 22:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
36
9b680e54aa94
Take a step back: separate Cairo's GraphicsContext (cairo_t) and Smalltalk/X's graphics context
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
243 |
"Modified: / 13-02-2016 / 16:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16 | 244 |
! ! |
245 |
||
246 |
!Surface methodsFor:'queries'! |
|
247 |
||
248 |
isViewSurface |
|
249 |
"Return true, if this sufrace if for a kind of a View" |
|
250 |
||
251 |
^self isXLibSurface or:[ self isWin32Surface ] |
|
252 |
||
253 |
"Created: / 17-06-2012 / 15:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
254 |
! |
|
255 |
||
256 |
isWin32Surface |
|
257 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
258 |
^self type == CAIRO_SURFACE_TYPE_WIN32 |
16 | 259 |
|
260 |
"Created: / 17-06-2012 / 15:01:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
261 |
"Modified: / 28-12-2014 / 21:46:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16 | 262 |
! |
263 |
||
264 |
isXLibSurface |
|
265 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
266 |
^self type == CAIRO_SURFACE_TYPE_XLIB |
16 | 267 |
|
268 |
"Created: / 17-06-2012 / 14:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
269 |
"Modified: / 28-12-2014 / 21:46:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 270 |
! ! |
271 |
||
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
272 |
!Surface class methodsFor:'documentation'! |
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
273 |
|
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
274 |
version |
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
275 |
^'$Id$' |
11 | 276 |
! |
277 |
||
23
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20
diff
changeset
|
278 |
version_HG |
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20
diff
changeset
|
279 |
^ '$Changeset: <not expanded> $' |
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
280 |
! ! |
26
7f07a8c31e6d
Fixed flickring of Cairo::ClockView by rendering into an off-screen image.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
281 |