author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 05 Apr 2016 10:00:57 +0100 | |
changeset 77 | cdf856e78998 |
parent 70 | 4f58f5ed77b3 |
child 88 | 9d51db2ba641 |
permissions | -rw-r--r-- |
1 | 1 |
"{ Package: 'stx:goodies/libcairo' }" |
2 |
||
3 |
"{ NameSpace: Cairo }" |
|
4 |
||
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:
35
diff
changeset
|
5 |
CObject subclass:#GraphicsContext |
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:
35
diff
changeset
|
6 |
instanceVariableNames:'surface' |
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:
35
diff
changeset
|
7 |
classVariableNames:'' |
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:
35
diff
changeset
|
8 |
poolDictionaries:'' |
12 | 9 |
category:'Cairo-Objects' |
1 | 10 |
! |
11 |
||
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
12 |
|
1 | 13 |
!GraphicsContext class methodsFor:'instance creation'! |
14 |
||
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
15 |
onSurface: surface |
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:
35
diff
changeset
|
16 |
| instance | |
6
c1f387b40e3a
regenerated using newer version of CFace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5
diff
changeset
|
17 |
|
20
18a3e6b5f310
Added const modifier to FFI specs (required by recent STX)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
18 |
self |
13 | 19 |
assert: (surface isKindOf: Cairo::Surface) |
1 | 20 |
message: 'surface is not valid Cairo surface'. |
21 |
||
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:
35
diff
changeset
|
22 |
instance := CPrimitives cairo_create: surface. |
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:
35
diff
changeset
|
23 |
^ instance initializeWithSurface: surface |
1 | 24 |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
25 |
"Created: / 28-12-2014 / 23:45:36 / 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:
35
diff
changeset
|
26 |
"Modified: / 13-02-2016 / 16:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
27 |
! ! |
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
28 |
|
1 | 29 |
!GraphicsContext methodsFor:'accessing'! |
30 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
31 |
referenceCount |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
32 |
"Return value or reference counter" |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
33 |
|
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:
35
diff
changeset
|
34 |
^ CPrimitives cairo_get_reference_count: self. |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
35 |
|
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:
35
diff
changeset
|
36 |
"Modified: / 13-02-2016 / 16:13:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
37 |
! |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
38 |
|
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
39 |
status |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
40 |
^ CPrimitives cairo_status: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
41 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
42 |
"Created: / 18-02-2016 / 20:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
43 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
44 |
|
1 | 45 |
surface |
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:
35
diff
changeset
|
46 |
^ surface |
10
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
47 |
! ! |
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
48 |
|
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
49 |
!GraphicsContext methodsFor:'cairo api - drawing'! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
50 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
51 |
fill |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
52 |
CPrimitives cairo_fill:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
53 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
54 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
55 |
"Created: / 10-07-2008 / 09:42:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
56 |
"Modified: / 28-12-2014 / 22:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
57 |
"Modified: / 21-02-2016 / 15:15:26 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
58 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
59 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
60 |
fillAndPreserve |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
61 |
CPrimitives cairo_fill_preserve:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
62 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
63 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
64 |
"Created: / 17-06-2012 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
65 |
"Modified: / 28-12-2014 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
66 |
"Modified: / 21-02-2016 / 15:15:30 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
67 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
68 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
69 |
mask: pattern |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
70 |
"A drawing operator that paints the current source using the alpha channel of `pattern` as a mask. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
71 |
(Opaque areas of pattern are painted with the source, transparent areas are not painted.)" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
72 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
73 |
CPrimitives cairo_mask:self _: pattern. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
74 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
75 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
76 |
"Created: / 07-03-2016 / 22:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
77 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
78 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
79 |
maskSurface: surf x: x y: y |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
80 |
"A drawing operator that paints the current source using the alpha channel of `surface` as a mask. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
81 |
(Opaque areas of surface are painted with the source, transparent areas are not painted.)" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
82 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
83 |
CPrimitives cairo_mask_surface:self _: surf _: x asFloat _: y asFloat. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
84 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
85 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
86 |
"Created: / 07-03-2016 / 22:17:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
87 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
88 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
89 |
paint |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
90 |
"A drawing operator that paints the current source everywhere within |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
91 |
the current clip region." |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
92 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
93 |
CPrimitives cairo_paint:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
94 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
95 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
96 |
"Created: / 13-02-2016 / 16:59:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
97 |
"Modified: / 21-02-2016 / 15:15:34 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
98 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
99 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
100 |
showPage |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
101 |
"Makes sense only for PDF surfaces" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
102 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
103 |
CPrimitives cairo_show_page:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
104 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
105 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
106 |
"Created: / 17-06-2012 / 08:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
107 |
"Modified: / 28-12-2014 / 22:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
108 |
"Modified: / 21-02-2016 / 15:15:39 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
109 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
110 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
111 |
stroke |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
112 |
CPrimitives cairo_stroke:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
113 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
114 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
115 |
"Created: / 10-07-2008 / 09:42:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
116 |
"Modified: / 28-12-2014 / 22:02:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
117 |
"Modified: / 21-02-2016 / 15:15:44 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
118 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
119 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
120 |
strokeAndPreserve |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
121 |
CPrimitives cairo_stroke_preserve:self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
122 |
self statusCheck. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
123 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
124 |
"Created: / 17-06-2012 / 21:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
125 |
"Modified: / 28-12-2014 / 22:15:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
126 |
"Modified: / 21-02-2016 / 15:15:48 / jv" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
127 |
! ! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
128 |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
129 |
!GraphicsContext methodsFor:'cairo api - paths'! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
130 |
|
46
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
131 |
antialias |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
132 |
"Gets the current shape antialiasing mode, as set Cairo::GraphicsContext>#antialias" |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
133 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
134 |
^ CPrimitives cairo_get_antialias: self |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
135 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
136 |
"Created: / 24-02-2016 / 00:03:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
137 |
! |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
138 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
139 |
antialias: antialias |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
140 |
"Set the antialiasing mode of the rasterizer used for drawing shapes. This |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
141 |
value is a hint, and a particular backend may or may not support a particular |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
142 |
value. At the current time, no backend supports CAIRO_ANTIALIAS_SUBPIXEL when |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
143 |
drawing shapes. |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
144 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
145 |
Note that this option does not affect text rendering, instead |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
146 |
see Cairo::FontOptions>>#antialias." |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
147 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
148 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
149 |
CPrimitives cairo_set_antialias: self _:antialias. |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
150 |
self statusCheck. |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
151 |
|
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
152 |
"Created: / 24-02-2016 / 00:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
153 |
! |
e624554ca9a3
CairoGraphicsContext: fixed drawing/filling of lines and rectangles to match DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
43
diff
changeset
|
154 |
|
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:
35
diff
changeset
|
155 |
arcNegativeX:x y:y radius:r from:startAngle to:stopAngle |
43 | 156 |
CPrimitives |
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:
35
diff
changeset
|
157 |
cairo_arc_negative: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:
35
diff
changeset
|
158 |
_:x asDouble |
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:
35
diff
changeset
|
159 |
_:y asDouble |
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:
35
diff
changeset
|
160 |
_:r asDouble |
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:
35
diff
changeset
|
161 |
_:startAngle asDouble |
43 | 162 |
_:stopAngle asDouble. |
163 |
self statusCheck. |
|
32
fb983be8d2c0
To fold - support for display/fillArc...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
164 |
|
fb983be8d2c0
To fold - support for display/fillArc...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
165 |
"Created: / 07-01-2015 / 02:35:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 166 |
"Modified: / 21-02-2016 / 15:17:14 / jv" |
32
fb983be8d2c0
To fold - support for display/fillArc...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
167 |
! |
fb983be8d2c0
To fold - support for display/fillArc...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
31
diff
changeset
|
168 |
|
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:
35
diff
changeset
|
169 |
arcX:x y:y radius:r from:startAngle to:stopAngle |
43 | 170 |
CPrimitives |
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:
35
diff
changeset
|
171 |
cairo_arc: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:
35
diff
changeset
|
172 |
_:x asDouble |
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:
35
diff
changeset
|
173 |
_:y asDouble |
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:
35
diff
changeset
|
174 |
_:r asDouble |
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:
35
diff
changeset
|
175 |
_:startAngle asDouble |
43 | 176 |
_:stopAngle asDouble. |
177 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
178 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
179 |
"Created: / 17-06-2012 / 21:50:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
180 |
"Modified: / 28-12-2014 / 22:00:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 181 |
"Modified: / 21-02-2016 / 15:17:24 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
182 |
! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
183 |
|
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
184 |
closePath |
43 | 185 |
CPrimitives cairo_close_path:self. |
186 |
self statusCheck. |
|
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
187 |
|
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
188 |
"Created: / 01-01-2015 / 22:42:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 189 |
"Modified: / 21-02-2016 / 15:17:34 / jv" |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
190 |
! |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
191 |
|
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:
35
diff
changeset
|
192 |
lineCap: lc |
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:
35
diff
changeset
|
193 |
|
43 | 194 |
CPrimitives cairo_set_line_cap: self _: lc. |
195 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
196 |
|
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:
35
diff
changeset
|
197 |
"Created: / 17-06-2012 / 22:09:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
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:
35
diff
changeset
|
198 |
"Modified: / 13-02-2016 / 16:42:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 199 |
"Modified: / 21-02-2016 / 15:17:42 / jv" |
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:
35
diff
changeset
|
200 |
! |
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:
35
diff
changeset
|
201 |
|
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:
35
diff
changeset
|
202 |
lineToX:x y:y |
43 | 203 |
CPrimitives |
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:
35
diff
changeset
|
204 |
cairo_line_to: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:
35
diff
changeset
|
205 |
_:x asDouble |
43 | 206 |
_:y asDouble. |
207 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
208 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
209 |
"Created: / 17-06-2012 / 22:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
210 |
"Modified: / 28-12-2014 / 22:00:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 211 |
"Modified: / 21-02-2016 / 15:17:53 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
212 |
! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
213 |
|
54
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
214 |
lineWidth |
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
215 |
^ CPrimitives cairo_get_line_width: self |
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
216 |
|
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
217 |
"Created: / 28-02-2016 / 16:50:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
218 |
! |
209a2b0b721a
CairoGraphicsContext: adjustments to displayRectangle / fillRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
51
diff
changeset
|
219 |
|
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:
35
diff
changeset
|
220 |
lineWidth: aNumber |
43 | 221 |
CPrimitives cairo_set_line_width: self _:aNumber asFloat. |
222 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
223 |
|
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:
35
diff
changeset
|
224 |
"Created: / 13-02-2016 / 16:45:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 225 |
"Modified: / 21-02-2016 / 15:18:04 / jv" |
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:
35
diff
changeset
|
226 |
! |
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:
35
diff
changeset
|
227 |
|
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:
35
diff
changeset
|
228 |
moveToX:x y:y |
43 | 229 |
CPrimitives |
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:
35
diff
changeset
|
230 |
cairo_move_to: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:
35
diff
changeset
|
231 |
_:x asDouble |
43 | 232 |
_:y asDouble. |
233 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
234 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
235 |
"Created: / 23-04-2009 / 17:21:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
236 |
"Modified: / 28-12-2014 / 22:00:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 237 |
"Modified: / 21-02-2016 / 15:18:12 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
238 |
! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
239 |
|
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:
35
diff
changeset
|
240 |
rectangleX:x y:y width:w height:h |
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:
35
diff
changeset
|
241 |
| rx ry rw rh | |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
242 |
|
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
243 |
rx := x. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
244 |
ry := y. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
245 |
rw := w. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
246 |
rh := h. |
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:
35
diff
changeset
|
247 |
rw < 0 ifTrue:[ |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
248 |
rx := rx + rw. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
249 |
rw := rw abs. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
250 |
]. |
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:
35
diff
changeset
|
251 |
rh < 0 ifTrue:[ |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
252 |
ry := ry + rh. |
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
253 |
rh := rh abs. |
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:
35
diff
changeset
|
254 |
]. |
43 | 255 |
CPrimitives |
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:
35
diff
changeset
|
256 |
cairo_rectangle: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:
35
diff
changeset
|
257 |
_:rx asDouble |
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:
35
diff
changeset
|
258 |
_:ry asDouble |
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:
35
diff
changeset
|
259 |
_:rw asDouble |
43 | 260 |
_:rh asDouble. |
261 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
262 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
263 |
"Created: / 10-07-2008 / 09:41:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
264 |
"Modified: / 02-01-2015 / 01:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 265 |
"Modified: / 21-02-2016 / 15:18:25 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
266 |
! ! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
267 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
268 |
!GraphicsContext methodsFor:'cairo api - save & restore'! |
17 | 269 |
|
270 |
restore |
|
43 | 271 |
CPrimitives cairo_restore:self. |
272 |
self statusCheck. |
|
17 | 273 |
|
274 |
"Created: / 17-06-2012 / 21:51:38 / 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:
35
diff
changeset
|
275 |
"Modified: / 13-02-2016 / 16:14:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 276 |
"Modified: / 21-02-2016 / 15:16:13 / jv" |
10
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
277 |
! |
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
278 |
|
17 | 279 |
save |
43 | 280 |
CPrimitives cairo_save:self. |
281 |
self statusCheck. |
|
10
dd5fece7c8d2
Few hacks before presentation at Smalltalk Jihlava 2009
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
8
diff
changeset
|
282 |
|
17 | 283 |
"Created: / 17-06-2012 / 21:51:29 / 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:
35
diff
changeset
|
284 |
"Modified: / 13-02-2016 / 16:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 285 |
"Modified: / 21-02-2016 / 15:16:19 / jv" |
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:
35
diff
changeset
|
286 |
! ! |
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:
35
diff
changeset
|
287 |
|
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:
35
diff
changeset
|
288 |
!GraphicsContext methodsFor:'cairo api - source'! |
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:
35
diff
changeset
|
289 |
|
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
290 |
source |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
291 |
"Gets the current source pattern for the receiver." |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
292 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
293 |
"/ JV: Should it return Color (TranslucentColor) if the source |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
294 |
"/ is solid pattern to match with source: which allows a color |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
295 |
"/ to be passed? |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
296 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
297 |
| p | |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
298 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
299 |
p := CPrimitives cairo_get_source: self. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
300 |
p unregisterForFinalization. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
301 |
p := p reference. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
302 |
^ p |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
303 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
304 |
"Created: / 05-03-2016 / 10:04:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
305 |
"Modified: / 05-03-2016 / 16:22:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
306 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
307 |
|
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:
35
diff
changeset
|
308 |
source: aCairoPatternOrColor |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
309 |
"Sets the source pattern (Cairo::Patterm) within receiver to source. This |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
310 |
pattern will then be used for any subsequent drawing operation until a |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
311 |
new source pattern is set. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
312 |
As a courtesy to a Smalltalk programmer, one may pass also a color |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
313 |
(Color or TranslucentColor) which saves one's work by not having to creare |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
314 |
a Pattern first. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
315 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
316 |
Note: The pattern's transformation matrix will be locked to the user space |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
317 |
in effect at the time of Cairo::GraphicsContext>>source:. This means that |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
318 |
further modifications of the current transformation matrix will not affect |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
319 |
the source pattern. See Cairo::Pattern>>matrix:. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
320 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
321 |
The default source pattern is a solid pattern that is opaque black, (that |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
322 |
is, it is equivalent to |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
323 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
324 |
cr sourceR: 0 G: 0 B: 0. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
325 |
" |
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:
35
diff
changeset
|
326 |
aCairoPatternOrColor isColor ifTrue:[ |
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:
35
diff
changeset
|
327 |
self sourceR: (aCairoPatternOrColor red / 100) |
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:
35
diff
changeset
|
328 |
G: (aCairoPatternOrColor green / 100) |
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:
35
diff
changeset
|
329 |
B: (aCairoPatternOrColor blue / 100) |
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:
35
diff
changeset
|
330 |
A: aCairoPatternOrColor alpha. |
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:
35
diff
changeset
|
331 |
^ 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:
35
diff
changeset
|
332 |
]. |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
333 |
CPrimitives cairo_set_source: self _: aCairoPatternOrColor. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
334 |
self statusCheck |
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:
35
diff
changeset
|
335 |
|
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:
35
diff
changeset
|
336 |
"Created: / 13-02-2016 / 16:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
337 |
"Modified: / 05-03-2016 / 08:41:48 / 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:
35
diff
changeset
|
338 |
! |
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:
35
diff
changeset
|
339 |
|
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:
35
diff
changeset
|
340 |
sourceR:r G:g B:b |
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:
35
diff
changeset
|
341 |
CPrimitives cairo_set_source_rgb: 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:
35
diff
changeset
|
342 |
_: r asDouble |
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:
35
diff
changeset
|
343 |
_: g asDouble |
43 | 344 |
_: b asDouble. |
345 |
self statusCheck. |
|
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:
35
diff
changeset
|
346 |
|
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:
35
diff
changeset
|
347 |
"Created: / 13-02-2016 / 16:55:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 348 |
"Modified: / 21-02-2016 / 15:16:01 / jv" |
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:
35
diff
changeset
|
349 |
! |
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:
35
diff
changeset
|
350 |
|
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:
35
diff
changeset
|
351 |
sourceR:r G:g B:b A:a |
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:
35
diff
changeset
|
352 |
CPrimitives cairo_set_source_rgba: 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:
35
diff
changeset
|
353 |
_: r asDouble |
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:
35
diff
changeset
|
354 |
_: g asDouble |
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:
35
diff
changeset
|
355 |
_: b asDouble |
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:
35
diff
changeset
|
356 |
_: a asDouble. |
43 | 357 |
self statusCheck. |
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:
35
diff
changeset
|
358 |
|
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:
35
diff
changeset
|
359 |
"Created: / 13-02-2016 / 16:54:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 360 |
"Modified: / 21-02-2016 / 15:16:05 / jv" |
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
361 |
! |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
362 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
363 |
sourceSurface: source x: x y: y |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
364 |
"This is a convenience method for creating a pattern from surface |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
365 |
and setting it as the source in receiver with Cairo::GraphicsContext>>#source:. |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
366 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
367 |
The x and y parameters give the user-space coordinate at which the surface |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
368 |
origin should appear. (The surface origin is its upper-left corner before |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
369 |
any transformation has been applied.) The x and y parameters are negated and |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
370 |
then set as translation values in the pattern matrix. |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
371 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
372 |
Other than the initial translation pattern matrix, as described above, all other |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
373 |
pattern attributes, (such as its extend mode), are set to the default values as |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
374 |
in Cairo::Pattern>>surface:. The resulting pattern can be queried with |
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
375 |
cairo_get_source() so that these attributes can be modified if desired, (eg. to |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
376 |
create a repeating pattern with Cairo::Pattern>>extend)." |
51
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
377 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
378 |
CPrimitives cairo_set_source_surface: self _: source _: x asFloat _: y asFloat. |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
379 |
self statusCheck |
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
380 |
|
5293f2b851ab
CairGraphicsContext: added support for displaying images with alpha channel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
46
diff
changeset
|
381 |
"Created: / 27-02-2016 / 17:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
382 |
"Modified: / 07-03-2016 / 22:23:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17 | 383 |
! ! |
384 |
||
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
385 |
!GraphicsContext methodsFor:'cairo api - text'! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
386 |
|
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
387 |
font |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
388 |
^ CPrimitives cairo_get_scaled_font: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
389 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
390 |
"Created: / 17-02-2016 / 21:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
391 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
392 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
393 |
font: scaledFont |
43 | 394 |
CPrimitives cairo_set_scaled_font: self _: scaledFont. |
395 |
self statusCheck. |
|
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
396 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
397 |
"Created: / 17-02-2016 / 21:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 398 |
"Modified: / 21-02-2016 / 15:08:25 / jv" |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
399 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
400 |
|
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:
35
diff
changeset
|
401 |
font:family slant:slant weight:weight |
43 | 402 |
CPrimitives cairo_select_font_face:self _:family asString _:slant asInteger _:weight asInteger. |
403 |
self statusCheck. |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
404 |
|
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
405 |
"Created: / 29-12-2014 / 01:08:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 406 |
"Modified: / 21-02-2016 / 15:13:15 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
407 |
! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
408 |
|
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
409 |
fontMatrix |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
410 |
| matrix | |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
411 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
412 |
matrix := Matrix new. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
413 |
CPrimitives cairo_get_font_matrix: self _: matrix. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
414 |
^ matrix |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
415 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
416 |
"Created: / 18-02-2016 / 10:09:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
417 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
418 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
419 |
fontMatrix: matrix |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
420 |
"Sets the current font matrix to matrix . The font matrix gives a transformation from |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
421 |
the design space of the font (in this space, the em-square is 1 unit by 1 unit) |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
422 |
to user space. Normally, a simple scale is used (see #fontSize:), but a more complex |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
423 |
font matrix can be used to shear the font or stretch it unequally along the two axes" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
424 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
425 |
CPrimitives cairo_set_font_matrix: self _: matrix. |
43 | 426 |
self statusCheck. |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
427 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
428 |
"Created: / 18-02-2016 / 10:11:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 429 |
"Modified: / 21-02-2016 / 15:14:09 / jv" |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
430 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
431 |
|
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:
35
diff
changeset
|
432 |
fontSize:sz |
43 | 433 |
CPrimitives cairo_set_font_size:self _:sz asFloat. |
434 |
self statusCheck |
|
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
435 |
|
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
436 |
"Created: / 23-04-2009 / 17:24:33 / Jan Vrany <vranyj1@fel.cvut.cz>" |
31
26070c1e480e
GraphicsContext refactoring (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
437 |
"Modified: / 02-01-2015 / 01:39:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 438 |
"Modified: / 21-02-2016 / 15:13:30 / jv" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
439 |
! |
17 | 440 |
|
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:
35
diff
changeset
|
441 |
showText:aString |
43 | 442 |
CPrimitives cairo_show_text:self _:aString utf8Encoded. |
443 |
self statusCheck. |
|
17 | 444 |
|
445 |
"Created: / 23-04-2009 / 17:25:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
446 |
"Modified: / 28-12-2014 / 22:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 447 |
"Modified: / 21-02-2016 / 15:13:46 / jv" |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
448 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
449 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
450 |
textExtents:aString |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
451 |
| extents | |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
452 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
453 |
extents := TextExtents new. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
454 |
CPrimitives cairo_text_extents:self _:aString utf8Encoded _: extents. |
43 | 455 |
self statusCheck. |
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
456 |
^ extents. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
457 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
458 |
"Created: / 18-02-2016 / 08:55:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 459 |
"Modified: / 21-02-2016 / 15:13:58 / jv" |
67
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
460 |
! |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
461 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
462 |
textToPath: aString |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
463 |
" |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
464 |
Adds closed paths for text to the current path. The generated path if |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
465 |
filled, achieves an effect similar to that of #showText:. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
466 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
467 |
Text conversion and positioning is done similar to #showText:. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
468 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
469 |
Like #showText:, after this call the current point is moved to |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
470 |
the origin of where the next glyph would be placed in this |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
471 |
same progression. That is, the current point will be at the |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
472 |
origin of the final glyph offset by its advance values. This |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
473 |
allows for chaining multiple calls to to #textToPath: without |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
474 |
having to set current point in between. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
475 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
476 |
Note: The #textToPath:: function call is part of what the cairo |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
477 |
designers call the 'toy' text API. It is convenient for short demos |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
478 |
and simple programs, but it is not expected to be adequate for |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
479 |
serious text-using applications. See #glyphPath: for the 'real' |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
480 |
text path API in cairo. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
481 |
" |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
482 |
^ CPrimitives cairo_text_path: self _: aString utf8Encoded |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
483 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
484 |
"Created: / 22-03-2016 / 16:58:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 485 |
! ! |
486 |
||
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
487 |
!GraphicsContext methodsFor:'cairo api - transformations & clipping'! |
17 | 488 |
|
489 |
clip |
|
43 | 490 |
CPrimitives cairo_clip:self. |
491 |
self statusCheck. |
|
17 | 492 |
|
493 |
"Created: / 17-06-2012 / 21:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
494 |
"Modified: / 28-12-2014 / 22:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 495 |
"Modified: / 21-02-2016 / 15:15:18 / jv" |
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:
35
diff
changeset
|
496 |
! |
17 | 497 |
|
70
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
498 |
clipBounds |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
499 |
" |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
500 |
Computes a bounding box in user coordinates covering the area inside the current clip. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
501 |
" |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
502 |
| x1 y1 x2 y2 bounds | |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
503 |
x1 := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
504 |
y1 := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
505 |
x2 := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
506 |
y2 := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
507 |
[ |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
508 |
CPrimitives cairo_clip_extents:self _: x1 _: y1 _: x2 _: y2. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
509 |
bounds := (x1 doubleAt: 1) @ (y1 doubleAt:1) corner:(x2 doubleAt: 1) @ (y2 doubleAt:1) |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
510 |
] ensure:[ |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
511 |
x1 free. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
512 |
y1 free. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
513 |
x2 free. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
514 |
y2 free. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
515 |
]. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
516 |
^ bounds |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
517 |
|
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
518 |
"Created: / 24-03-2016 / 19:39:53 / jv" |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
519 |
! |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
520 |
|
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
521 |
clipReset |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
522 |
" |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
523 |
Reset the current clip region to its original, unrestricted state. That is, |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
524 |
set the clip region to an infinitely large shape containing the target surface. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
525 |
Equivalently, if infinity is too hard to grasp, one can imagine the clip region being |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
526 |
reset to the exact bounds of the target surface. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
527 |
|
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
528 |
Note that code meant to be reusable should not call cairo_reset_clip() as it |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
529 |
will cause results unexpected by higher-level code which calls cairo_clip(). Consider |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
530 |
using cairo_save() and cairo_restore() around cairo_clip() as a more robust means of |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
531 |
temporarily restricting the clip region." |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
532 |
CPrimitives cairo_reset_clip: self. |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
533 |
|
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
534 |
"Created: / 24-03-2016 / 19:42:44 / jv" |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
535 |
! |
4f58f5ed77b3
Added support for clipping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
536 |
|
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
537 |
matrix |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
538 |
"Return the context's current transformation matrix (CTM)" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
539 |
| matrix | |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
540 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
541 |
matrix := Matrix new. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
542 |
CPrimitives cairo_get_matrix: self _: matrix. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
543 |
^ matrix |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
544 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
545 |
"Created: / 04-03-2016 / 17:10:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
546 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
547 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
548 |
matrix: matrix |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
549 |
"Modifies the current transformation matrix (CTM) by setting it equal to `matrix`" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
550 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
551 |
CPrimitives cairo_set_matrix: self _: matrix. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
552 |
self statusCheck |
1 | 553 |
|
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:
35
diff
changeset
|
554 |
"Created: / 13-02-2016 / 19:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
555 |
"Modified: / 05-03-2016 / 08:37:10 / 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:
35
diff
changeset
|
556 |
! |
17 | 557 |
|
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:
35
diff
changeset
|
558 |
matrixReset |
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:
35
diff
changeset
|
559 |
"Resets the current transformation matrix (CTM) by setting it equal to the |
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:
35
diff
changeset
|
560 |
identity matrix. That is, the user-space and device-space axes will be |
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:
35
diff
changeset
|
561 |
aligned and one user-space unit will transform to one device-space unit." |
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:
35
diff
changeset
|
562 |
CPrimitives cairo_identity_matrix: self. |
43 | 563 |
self statusCheck. |
1 | 564 |
|
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:
35
diff
changeset
|
565 |
"Created: / 13-02-2016 / 19:54:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 566 |
"Modified: / 21-02-2016 / 15:15:09 / jv" |
33
8a2e438b4363
To fold - better display/fill RoundedRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
567 |
! |
8a2e438b4363
To fold - better display/fill RoundedRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
568 |
|
67
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
569 |
rotate: aNumber |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
570 |
"Modifies the current transformation matrix (CTM) by rotating the |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
571 |
user-space axes by angle radians. The rotation of the axes takes |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
572 |
places after any existing transformation of user space. The |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
573 |
rotation direction for positive angles is from the positive X |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
574 |
axis toward the positive Y axis." |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
575 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
576 |
CPrimitives cairo_rotate: self _: aNumber asFloat. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
577 |
self statusCheck. |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
578 |
|
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
579 |
"Created: / 22-03-2016 / 17:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
580 |
! |
b8bfa65ab23b
Examples: Added example showing rotated text with outline and fill.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
63
diff
changeset
|
581 |
|
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:
35
diff
changeset
|
582 |
scale: aNumberOrPoint |
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:
35
diff
changeset
|
583 |
| sx sy | |
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:
35
diff
changeset
|
584 |
aNumberOrPoint isPoint ifTrue:[ |
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:
35
diff
changeset
|
585 |
sx := aNumberOrPoint x asFloat. |
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:
35
diff
changeset
|
586 |
sy := aNumberOrPoint y asFloat. |
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:
35
diff
changeset
|
587 |
] ifFalse:[ |
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:
35
diff
changeset
|
588 |
sx := sy := aNumberOrPoint asFloat. |
33
8a2e438b4363
To fold - better display/fill RoundedRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
589 |
]. |
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:
35
diff
changeset
|
590 |
CPrimitives cairo_scale: self _: sx _: sy. |
43 | 591 |
self statusCheck. |
33
8a2e438b4363
To fold - better display/fill RoundedRectangle...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
592 |
|
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:
35
diff
changeset
|
593 |
"Created: / 13-02-2016 / 16:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 594 |
"Modified: / 21-02-2016 / 15:15:05 / jv" |
35
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
595 |
! |
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
596 |
|
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:
35
diff
changeset
|
597 |
translate: aNumberOrPoint |
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:
35
diff
changeset
|
598 |
| tx ty | |
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:
35
diff
changeset
|
599 |
aNumberOrPoint isPoint ifTrue:[ |
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:
35
diff
changeset
|
600 |
tx := aNumberOrPoint x asFloat. |
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:
35
diff
changeset
|
601 |
ty := aNumberOrPoint y asFloat. |
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:
35
diff
changeset
|
602 |
] ifFalse:[ |
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:
35
diff
changeset
|
603 |
tx := ty := aNumberOrPoint asFloat. |
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:
35
diff
changeset
|
604 |
]. |
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:
35
diff
changeset
|
605 |
CPrimitives cairo_translate: self _: tx _: ty. |
43 | 606 |
self statusCheck. |
34
97705b5a9411
Use Cairo's toy text API for text rendering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
607 |
|
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:
35
diff
changeset
|
608 |
"Created: / 13-02-2016 / 16:40:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 609 |
"Modified: / 21-02-2016 / 15:15:00 / jv" |
34
97705b5a9411
Use Cairo's toy text API for text rendering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
610 |
! ! |
97705b5a9411
Use Cairo's toy text API for text rendering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
611 |
|
35
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
612 |
!GraphicsContext methodsFor:'initialization & release'! |
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
613 |
|
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:
35
diff
changeset
|
614 |
initializeWithSurface: aSurface |
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:
35
diff
changeset
|
615 |
surface := aSurface. |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
616 |
|
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:
35
diff
changeset
|
617 |
"Created: / 13-02-2016 / 16:08:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43 | 618 |
"Modified: / 21-02-2016 / 15:30:05 / jv" |
619 |
"Modified: / 23-02-2016 / 10:54:30 / 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:
35
diff
changeset
|
620 |
! ! |
35
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
621 |
|
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:
35
diff
changeset
|
622 |
!GraphicsContext methodsFor:'private'! |
35
395689a88b32
Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
34
diff
changeset
|
623 |
|
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:
35
diff
changeset
|
624 |
destroy |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
625 |
"Tell Cairo library to destroy the corresponding C object. |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
626 |
Remember that object is physically destroyed only if internal |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
627 |
refcounter goes to zero. However, after calling destroy, |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
628 |
this instance should be treated as invalid." |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
629 |
|
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:
35
diff
changeset
|
630 |
surface := nil. |
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:
35
diff
changeset
|
631 |
CPrimitives cairo_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:
35
diff
changeset
|
632 |
self setAddress: nil. |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
633 |
|
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:
35
diff
changeset
|
634 |
"Modified: / 13-02-2016 / 16:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
635 |
! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
636 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
637 |
reference |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
638 |
"Increases the reference count on the receiver by one. This prevents the |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
639 |
receiver from being destroyed until a matching call to #destroy is made. |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
640 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
641 |
This method must be called whenever Cairo documentation says so, |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
642 |
check comment on return value for methods returning a Cairo object" |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
643 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
644 |
CPrimitives cairo_reference: self |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
645 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
646 |
"Modified: / 05-03-2016 / 10:32:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
647 |
! ! |
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
648 |
|
63
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
649 |
!GraphicsContext class methodsFor:'documentation'! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
650 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
651 |
version_HG |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
652 |
|
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
653 |
^ '$Changeset: <not expanded> $' |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
654 |
! ! |
054f0513ea65
Initial support for Cairo::Pattern
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
54
diff
changeset
|
655 |