Initial support for Cairo::Pattern
except a mesh pattern.
--- a/Cairo__CObject.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__CObject.st Mon Mar 21 22:28:05 2016 +0000
@@ -110,6 +110,18 @@
"Created: / 28-12-2014 / 21:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ ^ self subclassResponsibility
+
+ "Created: / 05-03-2016 / 10:31:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
statusCheck
<resource: #skipInDebuggersWalkBack>
--- a/Cairo__CPrimitives.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__CPrimitives.st Mon Mar 21 22:28:05 2016 +0000
@@ -746,8 +746,10 @@
cairo_matrix_init_translate: matrix _: tx _: ty
- <cdecl: void "cairo_matrix_init_translate" ( Cairo::Matrix double double ) >
+ <cdecl: void "cairo_matrix_init_translate" ( pointer double double ) >
self primitiveFailed
+
+ "Modified (format): / 08-03-2016 / 21:38:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
cairo_matrix_invert: matrix
@@ -1058,8 +1060,10 @@
cairo_pattern_set_matrix: pattern _: matrix
- <cdecl: void "cairo_pattern_set_matrix" ( Cairo::Pattern Cairo::Matrix ) >
+ <cdecl: void "cairo_pattern_set_matrix" ( Cairo::Pattern pointer ) >
self primitiveFailed
+
+ "Modified (format): / 08-03-2016 / 21:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
cairo_pattern_set_user_data: pattern _: key _: user_data _: destroy
--- a/Cairo__Examples1.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Examples1.st Mon Mar 21 22:28:05 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Examples'
!
+
!Examples1 methodsFor:'examples'!
example01: cr <example: '01 - arc'>
@@ -125,6 +126,65 @@
cr fill.
"Created: / 29-02-2016 / 18:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example25: cr <example: '25 - Linear Gradient 1'>
+"
+This shows a linear gradient
+"
+| gradient |
+
+gradient := Cairo::Pattern linearFromX: 32 y: 32 toX: (32*6) y: (32*6).
+gradient addColor: (Color redByte:191 greenByte: 217 blueByte: 224)
+ stopAt: 0.0.
+gradient addColor: (Color redByte:2 greenByte: 96 blueByte: 122)
+ stopAt: 1.0.
+cr source: (Color redByte:2 greenByte: 96 blueByte: 122).
+cr lineWidth: 3.
+cr rectangleX: 16 y: 16 width: (32*7) height: (32*7).
+cr strokeAndPreserve.
+cr source: gradient.
+cr fill.
+
+ "Created: / 21-03-2016 / 22:27:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example26: cr <example: '26 - Linear Gradient 2'>
+"
+Color stops in gradient patterns may have alpha as well!!
+This shows a linear gradient with first stop being %80
+teansparent.
+"
+| black white gradient |
+
+"Display s checker board"
+black := Color black.
+white := Color white.
+cr lineWidth:0.
+1 to: 8 do:[:x |
+ 1 to: 8 do:[:y |
+ cr source: ((x + y) even ifTrue:[ black ] ifFalse:[ white ]).
+ cr rectangleX: ((x - 1) * 32) + 1
+ y: ((y - 1) * 32) + 1
+ width: 32
+ height: 32.
+ cr fill.
+ ]
+].
+
+gradient := Cairo::Pattern linearFromX: 16 y: 32 * 4 toX: (32*8) - 16 y: 32*4.
+gradient addColor: ((Color redByte:191 greenByte: 217 blueByte: 224) alpha: 0.80)
+ stopAt: 0.0.
+gradient addColor: ((Color redByte:2 greenByte: 96 blueByte: 122) alpha: 1.0)
+ stopAt: 1.0.
+cr source: (Color redByte:2 greenByte: 96 blueByte: 122).
+cr lineWidth: 3.
+cr rectangleX: 16 y: 16 width: (32*7) height: (32*7).
+cr strokeAndPreserve.
+cr source: gradient.
+cr fill.
+
+ "Created: / 21-03-2016 / 22:25:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Examples1 methodsFor:'private'!
@@ -177,3 +237,10 @@
"Modified: / 02-03-2016 / 22:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!Examples1 class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Cairo__Examples2.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Examples2.st Mon Mar 21 22:28:05 2016 +0000
@@ -182,6 +182,46 @@
"Created: / 29-02-2016 / 18:38:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 29-02-2016 / 20:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example07: gc <example: '07 - Mask - 1bit'>
+"
+Shows displaying lines and rectangles with
+mask.
+"
+| mask |
+
+mask := Image width:2 height:2 fromArray:#[2r10000000
+ 2r01000000].
+gc paint: Color red.
+gc mask: mask asImage.
+gc lineWidth: 1.
+gc displayLineFromX: 10 y: 10 toX: 90 y: 10.
+gc displayLineFromX: 10 y: 10 toX: 10 y: 90.
+
+mask := Image width:16 height:16 fromArray:#[2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111
+ 2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r11110000 2r11110000
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111
+ 2r00001111 2r00001111].
+gc paint: Color blue.
+gc maskOrigin: 4@4.
+gc mask: mask asImage.
+gc fillRectangleX: 30 y: 30 width: 40 height: 40.
+
+ "Created: / 07-03-2016 / 21:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-03-2016 / 21:42:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Examples2 methodsFor:'private'!
--- a/Cairo__Extend.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Extend.st Mon Mar 21 22:28:05 2016 +0000
@@ -10,6 +10,49 @@
category:'Cairo-Constants'
!
+!Extend class methodsFor:'documentation'!
+
+documentation
+"
+ Cairo::Extend is used to describe how pattern color/alpha will be determined for
+ areas 'outside' the pattern's natural area, (for example, outside the surface bounds
+ or outside the gradient geometry).
+
+ Mesh patterns are not affected by the extend mode.
+
+ The default extend mode is CAIRO_EXTEND_NONE for surface patterns and CAIRO_EXTEND_PAD
+ for gradient patterns.
+
+ New entries may be added in future versions.
+
+ Members
+
+ CAIRO_EXTEND_NONE pixels outside of the source pattern
+ are fully transparent (Since 1.0)
+
+ CAIRO_EXTEND_REPEAT the pattern is tiled by repeating
+ (Since 1.0)
+
+ CAIRO_EXTEND_REFLECT the pattern is tiled by reflecting at the
+ edges (Since 1.0; but only implemented for
+ surface patterns since 1.6)
+
+ CAIRO_EXTEND_PAD pixels outside of the pattern copy the closest
+ pixel from the source (Since 1.2; but only
+ implemented for surface patterns since 1.6)
+
+ [author:]
+ Jan Vrany <jan.vrany@fit.cvut.cz>
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
!Extend class methodsFor:'initialization'!
initialize
--- a/Cairo__Filter.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Filter.st Mon Mar 21 22:28:05 2016 +0000
@@ -10,6 +10,47 @@
category:'Cairo-Constants'
!
+!Filter class methodsFor:'documentation'!
+
+documentation
+"
+ Cairo::Filter is used to indicate what filtering should be
+ applied when reading pixel values from patterns.
+ See Cairo::Pattern>>filter: for indicating the desired
+ filter to be used with a particular pattern.
+
+ Members
+
+ CAIRO_FILTER_FAST A high-performance filter, with quality
+ similar to CAIRO_FILTER_NEAREST (Since 1.0)
+
+ CAIRO_FILTER_GOOD A reasonable-performance filter, with quality
+ similar to CAIRO_FILTER_BILINEAR (Since 1.0)
+
+ CAIRO_FILTER_BEST The highest-quality available, performance may not
+ be suitable for interactive use. (Since 1.0)
+
+ CAIRO_FILTER_NEAREST Nearest-neighbor filtering (Since 1.0)
+
+ CAIRO_FILTER_BILINEAR Linear interpolation in two dimensions
+ (Since 1.0)
+
+ CAIRO_FILTER_GAUSSIAN This filter value is currently unimplemented, and
+ should not be used in current code. (Since 1.0)
+
+ Since 1.0
+
+ [author:]
+ Jan Vrany <jan.vrany@fit.cvut.cz>
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
!Filter class methodsFor:'initialization'!
--- a/Cairo__FontFace.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__FontFace.st Mon Mar 21 22:28:05 2016 +0000
@@ -134,6 +134,18 @@
^ CPrimitives cairo_font_face_destroy: self
"Modified: / 17-02-2016 / 19:54:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_font_face_reference: self.
+
+ "Modified: / 05-03-2016 / 10:32:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!FontFace class methodsFor:'documentation'!
--- a/Cairo__FontOptions.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__FontOptions.st Mon Mar 21 22:28:05 2016 +0000
@@ -233,6 +233,18 @@
CPrimitives cairo_font_options_destroy: self.
"Modified: / 17-02-2016 / 20:29:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ "/ Nothing, FontOptions are not refcounted
+
+ "Modified: / 05-03-2016 / 10:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!FontOptions class methodsFor:'documentation'!
--- a/Cairo__GraphicsContext.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__GraphicsContext.st Mon Mar 21 22:28:05 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Objects'
!
+
!GraphicsContext class methodsFor:'instance creation'!
onSurface: surface
@@ -45,6 +46,86 @@
^ surface
! !
+!GraphicsContext methodsFor:'cairo api - drawing'!
+
+fill
+ CPrimitives cairo_fill:self.
+ self statusCheck.
+
+ "Created: / 10-07-2008 / 09:42:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 28-12-2014 / 22:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:26 / jv"
+!
+
+fillAndPreserve
+ CPrimitives cairo_fill_preserve:self.
+ self statusCheck.
+
+ "Created: / 17-06-2012 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-12-2014 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:30 / jv"
+!
+
+mask: pattern
+ "A drawing operator that paints the current source using the alpha channel of `pattern` as a mask.
+ (Opaque areas of pattern are painted with the source, transparent areas are not painted.)"
+
+ CPrimitives cairo_mask:self _: pattern.
+ self statusCheck.
+
+ "Created: / 07-03-2016 / 22:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+maskSurface: surf x: x y: y
+ "A drawing operator that paints the current source using the alpha channel of `surface` as a mask.
+ (Opaque areas of surface are painted with the source, transparent areas are not painted.)"
+
+ CPrimitives cairo_mask_surface:self _: surf _: x asFloat _: y asFloat.
+ self statusCheck.
+
+ "Created: / 07-03-2016 / 22:17:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+paint
+ "A drawing operator that paints the current source everywhere within
+ the current clip region."
+
+ CPrimitives cairo_paint:self.
+ self statusCheck.
+
+ "Created: / 13-02-2016 / 16:59:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:34 / jv"
+!
+
+showPage
+ "Makes sense only for PDF surfaces"
+
+ CPrimitives cairo_show_page:self.
+ self statusCheck.
+
+ "Created: / 17-06-2012 / 08:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-12-2014 / 22:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:39 / jv"
+!
+
+stroke
+ CPrimitives cairo_stroke:self.
+ self statusCheck.
+
+ "Created: / 10-07-2008 / 09:42:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 28-12-2014 / 22:02:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:44 / jv"
+!
+
+strokeAndPreserve
+ CPrimitives cairo_stroke_preserve:self.
+ self statusCheck.
+
+ "Created: / 17-06-2012 / 21:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-12-2014 / 22:15:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2016 / 15:15:48 / jv"
+! !
+
!GraphicsContext methodsFor:'cairo api - paths'!
antialias
@@ -206,7 +287,42 @@
!GraphicsContext methodsFor:'cairo api - source'!
+source
+ "Gets the current source pattern for the receiver."
+
+ "/ JV: Should it return Color (TranslucentColor) if the source
+ "/ is solid pattern to match with source: which allows a color
+ "/ to be passed?
+
+ | p |
+
+ p := CPrimitives cairo_get_source: self.
+ p unregisterForFinalization.
+ p := p reference.
+ ^ p
+
+ "Created: / 05-03-2016 / 10:04:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 16:22:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
source: aCairoPatternOrColor
+ "Sets the source pattern (Cairo::Patterm) within receiver to source. This
+ pattern will then be used for any subsequent drawing operation until a
+ new source pattern is set.
+ As a courtesy to a Smalltalk programmer, one may pass also a color
+ (Color or TranslucentColor) which saves one's work by not having to creare
+ a Pattern first.
+
+ Note: The pattern's transformation matrix will be locked to the user space
+ in effect at the time of Cairo::GraphicsContext>>source:. This means that
+ further modifications of the current transformation matrix will not affect
+ the source pattern. See Cairo::Pattern>>matrix:.
+
+ The default source pattern is a solid pattern that is opaque black, (that
+ is, it is equivalent to
+
+ cr sourceR: 0 G: 0 B: 0.
+ "
aCairoPatternOrColor isColor ifTrue:[
self sourceR: (aCairoPatternOrColor red / 100)
G: (aCairoPatternOrColor green / 100)
@@ -214,9 +330,11 @@
A: aCairoPatternOrColor alpha.
^ self.
].
- self notYetImplemented
+ CPrimitives cairo_set_source: self _: aCairoPatternOrColor.
+ self statusCheck
"Created: / 13-02-2016 / 16:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 08:41:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
sourceR:r G:g B:b
@@ -253,76 +371,15 @@
Other than the initial translation pattern matrix, as described above, all other
pattern attributes, (such as its extend mode), are set to the default values as
- in cairo_pattern_create_for_surface(). The resulting pattern can be queried with
+ in Cairo::Pattern>>surface:. The resulting pattern can be queried with
cairo_get_source() so that these attributes can be modified if desired, (eg. to
- create a repeating pattern with cairo_pattern_set_extend())."
-
- #todo. "/ fix documentation ro refer to Smalltalk methids"
+ create a repeating pattern with Cairo::Pattern>>extend)."
CPrimitives cairo_set_source_surface: self _: source _: x asFloat _: y asFloat.
self statusCheck
"Created: / 27-02-2016 / 17:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!GraphicsContext methodsFor:'cairo api - stroke & fill'!
-
-fill
- CPrimitives cairo_fill:self.
- self statusCheck.
-
- "Created: / 10-07-2008 / 09:42:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
- "Modified: / 28-12-2014 / 22:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:26 / jv"
-!
-
-fillAndPreserve
- CPrimitives cairo_fill_preserve:self.
- self statusCheck.
-
- "Created: / 17-06-2012 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-12-2014 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:30 / jv"
-!
-
-paint
- "A drawing operator that paints the current source everywhere within
- the current clip region."
-
- CPrimitives cairo_paint:self.
- self statusCheck.
-
- "Created: / 13-02-2016 / 16:59:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:34 / jv"
-!
-
-showPage
- "Makes sense only for PDF surfaces"
-
- CPrimitives cairo_show_page:self.
- self statusCheck.
-
- "Created: / 17-06-2012 / 08:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-12-2014 / 22:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:39 / jv"
-!
-
-stroke
- CPrimitives cairo_stroke:self.
- self statusCheck.
-
- "Created: / 10-07-2008 / 09:42:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
- "Modified: / 28-12-2014 / 22:02:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:44 / jv"
-!
-
-strokeAndPreserve
- CPrimitives cairo_stroke_preserve:self.
- self statusCheck.
-
- "Created: / 17-06-2012 / 21:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-12-2014 / 22:15:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-02-2016 / 15:15:48 / jv"
+ "Modified: / 07-03-2016 / 22:23:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GraphicsContext methodsFor:'cairo api - text'!
@@ -413,10 +470,25 @@
"Modified: / 21-02-2016 / 15:15:18 / jv"
!
-matrix: aCairoMatrix
- self notYetImplemented
+matrix
+ "Return the context's current transformation matrix (CTM)"
+ | matrix |
+
+ matrix := Matrix new.
+ CPrimitives cairo_get_matrix: self _: matrix.
+ ^ matrix
+
+ "Created: / 04-03-2016 / 17:10:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matrix: matrix
+ "Modifies the current transformation matrix (CTM) by setting it equal to `matrix`"
+
+ CPrimitives cairo_set_matrix: self _: matrix.
+ self statusCheck
"Created: / 13-02-2016 / 19:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 08:37:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
matrixReset
@@ -483,5 +555,24 @@
self setAddress: nil.
"Modified: / 13-02-2016 / 16:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_reference: self
+
+ "Modified: / 05-03-2016 / 10:32:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!GraphicsContext class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Cairo__Matrix.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Matrix.st Mon Mar 21 22:28:05 2016 +0000
@@ -54,6 +54,21 @@
^ m.
"Created: / 18-02-2016 / 00:17:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+translate: aNumberOrPoint
+ | tx ty m |
+ aNumberOrPoint isPoint ifTrue:[
+ tx := aNumberOrPoint x asFloat.
+ ty := aNumberOrPoint y asFloat.
+ ] ifFalse:[
+ tx := ty := aNumberOrPoint asFloat.
+ ].
+ m := self new.
+ CPrimitives cairo_matrix_init_translate: m _: tx _: ty.
+ ^ m.
+
+ "Created: / 08-03-2016 / 21:36:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Matrix class methodsFor:'accessing'!
--- a/Cairo__Pattern.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Pattern.st Mon Mar 21 22:28:05 2016 +0000
@@ -5,68 +5,171 @@
CObject subclass:#Pattern
instanceVariableNames:''
classVariableNames:''
- poolDictionaries:''
+ poolDictionaries:'Cairo::PatternType'
category:'Cairo-Objects'
!
-!Pattern class methodsFor:'accessing'!
-
-dllPath
-
- OperatingSystem isMSWINDOWSlike ifTrue:[
- ^ #( 'C:\Windows' 'C:\Windows\System32' "Wild guess, should not harm" )
- ].
+!Pattern class methodsFor:'instance creation'!
- OperatingSystem isUNIXlike ifTrue:[
- OperatingSystem getSystemType == #linux ifTrue:[
- | path |
+R: r G: g B: b
+ "Creates a new pattern (as PatternSolid) corresponding to an opaque color. The color components are
+ floating point numbers in the range 0 to 1. If the values passed in are outside that range,
+ they will be clamped."
+ ^ CPrimitives cairo_pattern_create_rgb: r asFloat _: g asFloat _: b asFloat
- path := #( '/lib' '/usr/lib' '/usr/local/lib' ).
- (OperatingSystem getSystemInfo at:#machine) = 'x86_64' ifTrue:[
- "If the machine is 64bit, prepend standard path for 32bit libs.
- Leave standard paths at the end, as the system might be completely
- 32bit but running on 64bit-capable CPU.
+ "Created: / 04-03-2016 / 09:45:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- CAVEAT: This is bit dangerous, as on 64bit OS, if ia32 libs are
- not installed byt 64bit sqlite libs are, then 64bit libs are found
- and when a function is called, segfault will occur!!
+R: r G: g B: b A: a
+ "Creates a new pattern (as PatternSolid) corresponding to a translucent color. The color components
+ are floating point numbers in the range 0 to 1. If the values passed in are outside that range,
+ they will be clamped."
+ ^ CPrimitives cairo_pattern_create_rgba: r asFloat _: g asFloat _: b asFloat _: a asFloat.
- Q: Is there a way how to figure out if the OS itself is 32bit,
- regardles on CPU?"
- path := #( '/lib32' '/usr/lib32' '/usr/local/lib32' ) , path.
- ].
- ^path
+ "Created: / 04-03-2016 / 09:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- ].
- ].
-
- self error:'Unsupported operating system'
+color: aColor
+ "Creates a new pattern (as PatternSolid) corresponding to given color"
- "
- SqliteLibrary dllPath
- "
+ ^ self R: (aColor red / 100)
+ G: (aColor green / 100)
+ B: (aColor blue / 100)
+ A: aColor alpha.
- "Created: / 31-08-2011 / 18:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 05-03-2016 / 22:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-libraryName
-
- OperatingSystem isUNIXlike ifTrue:[^'libcairo.so.2'].
+linearFromX:x0 y: y0 toX: x1 y: y1
+ "Create a new linear gradient pattern along the line defined by (x0, y0) and
+ (x1, y1). Before using the gradient pattern, a number of color stops
+ should be defined using addColor:stopAt:.
- OperatingSystem isMSWINDOWSlike ifTrue:[^'cairo.dll'].
+ Note: The coordinates here are in pattern space. For a new pattern,
+ pattern space is identical to user space, but the relationship
+ between the spaces can be changed with CairoPattern>>#matrix:."
- self error:'Library name for host OS is not known'
+ ^ CPrimitives cairo_pattern_create_linear: x0 asFloat _: y0 asFloat _: x1 asFloat _: y1 asFloat
+
+ "Created: / 15-03-2016 / 20:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-sizeof
- "Returns size of undelaying structure in bytes"
+radialFromX:cx0 y: cy0 radius: radius0 toX: cx1 y: cy1 radius: radius1
+ "Creates a new radial gradient pattern between the two circles defined by
+ (cx0, cy0, radius0) and (cx1, cy1, radius1). Before using the gradient
+ pattern, a number of color stops should be defined using addColor:stopAt:.
+
+ Note: The coordinates here are in pattern space. For a new pattern,
+ pattern space is identical to user space, but the relationship
+ between the spaces can be changed with CairoPattern>>#matrix:."
+
+ ^ CPrimitives cairo_pattern_create_radial: cx0 asFloat _: cy0 asFloat _: radius0 asFloat _: cx1 asFloat _: cy1 asFloat _: radius1 asFloat
- ^0
+ "Created: / 15-03-2016 / 20:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-03-2016 / 22:24:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+surface: surface
+ "Creates a new pattern (as PatternSurface) for given surface."
+
+ ^ CPrimitives cairo_pattern_create_for_surface: surface
+
+ "Created: / 05-03-2016 / 22:23:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Pattern methodsFor:'accessing'!
+extend
+ "Gets the current extend mode for a pattern. See Cairo::Extend_t for details
+ on the semantics of each extend strategy."
+
+ ^ CPrimitives cairo_pattern_get_extend: self
+
+ "Created: / 04-03-2016 / 16:56:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+extend: extend
+ "Sets the mode to be used for drawing outside the area of a pattern.
+ See Cairo::Extend for details on the semantics of each extend strategy.
+
+ The default extend mode is CAIRO_EXTEND_NONE for surface patterns and
+ CAIRO_EXTEND_PAD for gradient patterns."
+
+ CPrimitives cairo_pattern_set_extend: self _: extend.
+
+ "Created: / 04-03-2016 / 16:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+filter
+ "Gets the current filter for a pattern. See Cairo::Filter for details on each filter."
+
+ ^ CPrimitives cairo_pattern_get_filter: self
+
+ "Created: / 04-03-2016 / 17:07:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+filter: filter
+ "Sets the filter to be used for resizing when using this pattern. See
+ Cairo::Filter for details on each filter.
+
+ Note that you might want to control filtering even when you do
+ not have an explicit Cairo::Pattern object, (for example when using
+ Cairo::GraphicsContext>>sourceSurface:). In these cases, it is convenient
+ to use Cairo::GraphicsContext>>source to get access to the pattern that
+ cairo creates implicitly. For example:
+
+ cr sourceSurface: image x: x y: y.
+ cr source filter: CAIRO_FILTER_NEAREST.
+ "
+ CPrimitives cairo_pattern_set_filter: self _: filter
+
+ "Created: / 04-03-2016 / 17:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matrix
+ "Return the pattern's transformation matrix"
+ | matrix |
+
+ matrix := Matrix new.
+ CPrimitives cairo_pattern_get_matrix: self _: matrix.
+ ^ matrix
+
+ "Created: / 04-03-2016 / 17:10:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matrix: matrix
+ "Sets the pattern's transformation matrix to matrix . This matrix
+ is a transformation from user space to pattern space.
+
+ When a pattern is first created it always has the identity matrix
+ for its transformation matrix, which means that pattern space is
+ initially identical to user space.
+
+ Important: Please note that the direction of this transformation
+ matrix is from user space to pattern space. This means that if you
+ imagine the flow from a pattern to user space (and on to device space),
+ then coordinates in that flow will be transformed by the inverse of
+ the pattern matrix.
+
+ For example, if you want to make a pattern appear twice as large as it
+ does by default the correct code to use is:
+
+ matrix := Cairo::Matrix scale: 0.5 @ 0.5
+ pattern matrix: matrix.
+
+ Meanwhile, using values of 2.0 rather than 0.5 in the code above would
+ cause the pattern to appear at half of its default size.
+
+ Also, please note the discussion of the user-space locking semantics
+ of Cairo::GraphicsContext>>source:
+ "
+ CPrimitives cairo_pattern_set_matrix: self _: matrix.
+ self statusCheck
+
+ "Created: / 05-03-2016 / 08:32:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
referenceCount
"Return value of reference counter"
@@ -82,6 +185,42 @@
^ CPrimitives cairo_pattern_status: self
"Modified: / 23-02-2016 / 10:48:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+type
+ ^ CPrimitives cairo_pattern_get_type: self.
+
+ "Created: / 04-03-2016 / 00:45:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Pattern methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ self class == Cairo::Pattern ifTrue:[
+ | type |
+
+ type := self type.
+ type == CAIRO_PATTERN_TYPE_SOLID ifTrue:[
+ self changeClassTo: PatternSolid.
+ ^ self.
+ ].
+ type == CAIRO_PATTERN_TYPE_SURFACE ifTrue:[
+ self changeClassTo: PatternSurface.
+ ^ self.
+ ].
+ type == CAIRO_PATTERN_TYPE_LINEAR ifTrue:[
+ self changeClassTo: PatternGradientLinear.
+ ^ self.
+ ].
+ type == CAIRO_PATTERN_TYPE_RADIAL ifTrue:[
+ self changeClassTo: PatternGradientRadial.
+ ^ self.
+ ].
+ ].
+
+ "Created: / 04-03-2016 / 00:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-03-2016 / 08:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Pattern methodsFor:'private'!
@@ -92,7 +231,29 @@
refcounter goes to zero. However, after calling destroy,
this instance should be treated as invalid."
- ^ self shouldImplement
+ CPrimitives cairo_pattern_destroy: self
+
+ "Modified: / 04-03-2016 / 00:44:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_pattern_reference: self
+
+ "Modified: / 05-03-2016 / 10:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Pattern methodsFor:'testing'!
+
+isSolid
+ "return false here; to be redefined in subclass(es)"
+
+ ^ false
! !
!Pattern class methodsFor:'documentation'!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__PatternGradient.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,134 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Pattern subclass:#PatternGradient
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:'Cairo::Status'
+ category:'Cairo-Objects'
+!
+
+!PatternGradient methodsFor:'accessing'!
+
+colorStopAtIndex: index
+ "Gets the color and offset information at the given index for a gradient pattern. Values
+ of index range from 1 to n where n is the number returned by #colorStopCount."
+
+ | offsetCellPtr rCellPtr gCellPtr bCellPtr aCellPtr status offset r g b a color |
+
+ offsetCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ rCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ gCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ bCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ aCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ [
+ status := CPrimitives cairo_pattern_get_color_stop_rgba: self _: index - 1 _: offsetCellPtr _: rCellPtr _: gCellPtr _: bCellPtr _: aCellPtr.
+ offset := offsetCellPtr doubleAt: 1.
+ r := rCellPtr doubleAt: 1.
+ g := gCellPtr doubleAt: 1.
+ b := bCellPtr doubleAt: 1.
+ a := aCellPtr doubleAt: 1.
+ ] ensure:[
+ offsetCellPtr free.
+ ].
+ status == CAIRO_STATUS_INVALID_INDEX ifTrue:[
+ self indexNotIntegerOrOutOfBounds: index
+ ] ifFalse:[
+ self statusCheck.
+ ].
+ a = 1.0 ifTrue:[
+ color := Color scaledRed: (r * 16rFFFF) rounded scaledGreen: (g * 16rFFFF) rounded scaledBlue: (b * 16rFFFF) rounded
+ ] ifFalse:[
+ color := TranslucentColor scaledRed: (r * 16rFFFF) rounded scaledGreen: (g * 16rFFFF) rounded scaledBlue: (b * 16rFFFF) rounded.
+ color alpha: a
+ ].
+ ^ offset -> color
+
+ "Created: / 09-03-2016 / 09:04:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-03-2016 / 21:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+colorStopCount
+ "Gets the number of color stops specified in the given gradient pattern."
+
+ | countCellPtr count |
+
+ countCellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofInt.
+ [
+ CPrimitives cairo_pattern_get_color_stop_count: self _: countCellPtr.
+ count := countCellPtr longAt: 1.
+ ] ensure:[
+ countCellPtr free.
+ ].
+ ^ count
+
+ "Created: / 09-03-2016 / 09:02:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!PatternGradient methodsFor:'adding'!
+
+addColor: color stopAt: offset
+ "Adds a `color` (as Color or TranslucentColor) stop to a gradient pattern. The `offset` specifies
+ the location along the gradient's control vector. For example, a linear gradient's
+ control vector is from (x0,y0) to (x1,y1) while a radial gradient's control
+ vector is from any point on the start circle to the corresponding point on the
+ end circle.
+
+ The color is specified in the same way as in Cairo::GraphicsContext>>source: if passed
+ argument is a Color (or TranslucentColor)
+
+ If two (or more) stops are specified with identical offset values, they will be sorted
+ according to the order in which the stops are added, (stops added earlier will compare
+ less than stops added later). This can be useful for reliably making sharp color
+ transitions instead of the typical blend."
+
+ self addColorR: (color red / 100) G: (color green / 100) B: (color blue / 100) A: color alpha stopAt: offset
+
+ "Created: / 09-03-2016 / 08:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addColorR: r G: g B: b A: a stopAt: offset
+ "Adds a translucent color stop to a gradient pattern. The `offset` specifies
+ the location along the gradient's control vector. For example, a linear gradient's
+ control vector is from (x0,y0) to (x1,y1) while a radial gradient's control
+ vector is from any point on the start circle to the corresponding point on the
+ end circle.
+
+ The color is specified in the same way as in Cairo::GraphicsContext>>sourceR:G:B:A:.
+
+ If two (or more) stops are specified with identical offset values, they will be sorted
+ according to the order in which the stops are added, (stops added earlier will compare
+ less than stops added later). This can be useful for reliably making sharp color
+ transitions instead of the typical blend."
+
+ CPrimitives cairo_pattern_add_color_stop_rgba: self
+ _: offset asFloat
+ _: r asFloat _: g asFloat _: b asFloat _: a asFloat.
+ self statusCheck.
+
+ "Created: / 09-03-2016 / 08:56:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addColorR: r G: g B: b stopAt: offset
+ "Adds an opaque color stop to a gradient pattern. The `offset` specifies
+ the location along the gradient's control vector. For example, a linear gradient's
+ control vector is from (x0,y0) to (x1,y1) while a radial gradient's control
+ vector is from any point on the start circle to the corresponding point on the
+ end circle.
+
+ The color is specified in the same way as in Cairo::GraphicsContext>>sourceR:G:B:.
+
+ If two (or more) stops are specified with identical offset values, they will be sorted
+ according to the order in which the stops are added, (stops added earlier will compare
+ less than stops added later). This can be useful for reliably making sharp color
+ transitions instead of the typical blend."
+
+ CPrimitives cairo_pattern_add_color_stop_rgb: self
+ _: offset asFloat
+ _: r asFloat _: g asFloat _: b asFloat.
+ self statusCheck.
+
+ "Created: / 09-03-2016 / 08:56:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__PatternGradientLinear.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,37 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+PatternGradient subclass:#PatternGradientLinear
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Objects'
+!
+
+!PatternGradientLinear methodsFor:'accessing'!
+
+points
+ "Gets the gradient endpoints."
+
+ | x0CellPtr y0CellPtr x1CellPtr y1CellPtr points |
+
+ x0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ y0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ x1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ y1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ [
+ CPrimitives cairo_pattern_get_linear_points: self _: x0CellPtr _: y0CellPtr _: x1CellPtr _: y1CellPtr.
+ points := Array with: (x0CellPtr doubleAt:1) @ (y0CellPtr doubleAt:1)
+ with: (x1CellPtr doubleAt:1) @ (y1CellPtr doubleAt:1)
+ ] ensure:[
+ x0CellPtr free.
+ y0CellPtr free.
+ x1CellPtr free.
+ y1CellPtr free.
+ ].
+ ^ points
+
+ "Created: / 15-03-2016 / 21:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__PatternGradientRadial.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,43 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+PatternGradient subclass:#PatternGradientRadial
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Objects'
+!
+
+!PatternGradientRadial methodsFor:'accessing'!
+
+circles
+ "Gets the gradient circles."
+
+ | cx0CellPtr cy0CellPtr radius0CellPtr cx1CellPtr cy1CellPtr radius1CellPtr circles |
+
+ cx0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ cy0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ radius0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ cx1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ cy1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ radius1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ [
+ CPrimitives cairo_pattern_get_radial_circles: self _: cx0CellPtr _: cy0CellPtr _: radius0CellPtr _: cx1CellPtr _: cy1CellPtr _: radius1CellPtr.
+ circles := Array with: (cx0CellPtr doubleAt:1) @ (cy0CellPtr doubleAt:1)
+ with: (radius0CellPtr doubleAt:1)
+ with: (cx1CellPtr doubleAt:1) @ (cy1CellPtr doubleAt:1)
+ with: (radius1CellPtr doubleAt:1)
+ ] ensure:[
+ cx0CellPtr free.
+ cy0CellPtr free.
+ radius0CellPtr free.
+ cx1CellPtr free.
+ cy1CellPtr free.
+ radius1CellPtr free.
+ ].
+ ^ circles
+
+ "Created: / 15-03-2016 / 21:37:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__PatternSolid.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,56 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Pattern subclass:#PatternSolid
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Objects'
+!
+
+!PatternSolid methodsFor:'accessing'!
+
+color
+ | rb gb bb ab a color |
+
+ rb := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ gb := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ bb := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ ab := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
+ [
+ CPrimitives cairo_pattern_get_rgba: self _: rb _: gb _: bb _: ab.
+ a := ab doubleAt: 1.
+ a = 1.0 ifTrue:[
+ color := Color
+ scaledRed: ((rb doubleAt: 1) * 16rFFFF) rounded
+ scaledGreen: ((gb doubleAt: 1) * 16rFFFF) rounded
+ scaledBlue: ((bb doubleAt: 1) * 16rFFFF) rounded
+ ] ifFalse:[
+ color := TranslucentColor
+ scaledRed: ((rb doubleAt: 1) * 16rFFFF) rounded
+ scaledGreen: ((gb doubleAt: 1) * 16rFFFF) rounded
+ scaledBlue: ((bb doubleAt: 1) * 16rFFFF) rounded.
+ color alpha: a
+ ].
+
+ ] ensure:[
+ rb free.
+ gb free.
+ bb free.
+ ab free.
+ ].
+ ^ color
+
+ "Created: / 04-03-2016 / 07:06:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-03-2016 / 16:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!PatternSolid methodsFor:'testing'!
+
+isSolid
+ ^ true
+
+ "Created: / 04-03-2016 / 09:48:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__PatternSurface.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,31 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Pattern subclass:#PatternSurface
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Objects'
+!
+
+!PatternSurface methodsFor:'accessing'!
+
+surface
+ | surfacePtrCell surface |
+
+ surfacePtrCell := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofPointer clear: false.
+ [
+ CPrimitives cairo_pattern_get_surface: self _: surfacePtrCell.
+ surface := Surface basicNew.
+ surface setAddressFromBytes: surfacePtrCell asByteArray.
+ surface := surface reference.
+ surface initialize.
+ ] ensure:[
+ surfacePtrCell free.
+ ].
+ ^ surface.
+
+ "Created: / 05-03-2016 / 23:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/Cairo__ScaledFont.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__ScaledFont.st Mon Mar 21 22:28:05 2016 +0000
@@ -127,6 +127,18 @@
"Created: / 28-12-2014 / 22:10:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-02-2016 / 06:39:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_scaled_font_reference: self
+
+ "Modified: / 05-03-2016 / 10:33:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ScaledFont class methodsFor:'documentation'!
--- a/Cairo__Surface.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Surface.st Mon Mar 21 22:28:05 2016 +0000
@@ -157,6 +157,12 @@
!Surface methodsFor:'accessing'!
+cairo
+ ^ GraphicsContext onSurface: self
+
+ "Created: / 05-03-2016 / 22:25:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
referenceCount
"Return value or reference counter"
@@ -229,6 +235,36 @@
"Created: / 24-02-2016 / 17:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!Surface methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ self class == Cairo::Surface ifTrue:[
+ | type |
+
+ type := self type.
+ type == CAIRO_SURFACE_TYPE_IMAGE ifTrue:[
+ self changeClassTo: SurfaceImage.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
+ self changeClassTo: SurfaceXlib.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_WIN32 ifTrue:[
+ self changeClassTo: SurfaceWin32.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_PDF ifTrue:[
+ self changeClassTo: SurfacePDF.
+ ^ self.
+ ].
+ ].
+
+ "Created: / 04-03-2016 / 00:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 22:21:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Surface methodsFor:'private'!
destroy
@@ -242,6 +278,18 @@
"Created: / 28-12-2014 / 22:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 13-02-2016 / 16:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_surface_reference: self
+
+ "Modified: / 05-03-2016 / 10:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Surface methodsFor:'queries'!
--- a/Cairo__SurfaceImage.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__SurfaceImage.st Mon Mar 21 22:28:05 2016 +0000
@@ -62,3 +62,31 @@
"Created: / 27-02-2016 / 16:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!SurfaceImage methodsFor:'inspecting'!
+
+inspector2TabImageCairo
+ <inspector2Tab>
+
+ | v |
+
+ v := PluggableView new.
+ v redrawAction:[
+ | cr |
+
+ cr := v cairo.
+ [
+ cr sourceSurface: self x: 1 y: 1.
+ cr paint.
+ ] ensure:[
+ cr release.
+ ].
+ ].
+ ^self newInspector2Tab
+ label: 'Contents';
+ priority: 49;
+ view: (HVScrollableView forView: v);
+ yourself
+
+ "Created: / 31-12-2014 / 12:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/Cairo__TextCluster.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__TextCluster.st Mon Mar 21 22:28:05 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Constants'
!
+
!TextCluster class methodsFor:'accessing'!
libraryName
@@ -50,3 +51,10 @@
self longAt:1 + 4 put:value
! !
+!TextCluster class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Make.proto Sat Mar 05 20:22:21 2016 +0000
+++ b/Make.proto Mon Mar 21 22:28:05 2016 +0000
@@ -123,8 +123,10 @@
# build all mandatory prerequisite packages (containing superclasses) for this package
prereq:
- cd ../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -189,19 +191,24 @@
$(OUTDIR)Cairo__Matrix.$(O) Cairo__Matrix.$(H): Cairo__Matrix.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)Cairo__Rectangle.$(O) Cairo__Rectangle.$(H): Cairo__Rectangle.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)Cairo__TextExtents.$(O) Cairo__TextExtents.$(H): Cairo__TextExtents.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
-$(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Antialias.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Status.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Antialias.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Extend.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Status.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
$(OUTDIR)CairoScaledFont.$(O) CairoScaledFont.$(H): CairoScaledFont.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/FontDescription.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontFace.$(O) Cairo__FontFace.$(H): Cairo__FontFace.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontOptions.$(O) Cairo__FontOptions.$(H): Cairo__FontOptions.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__PatternType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__ScaledFont.$(O) Cairo__ScaledFont.$(H): Cairo__ScaledFont.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradient.$(O) Cairo__PatternGradient.$(H): Cairo__PatternGradient.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Pattern.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Status.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternSolid.$(O) Cairo__PatternSolid.$(H): Cairo__PatternSolid.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Pattern.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternSurface.$(O) Cairo__PatternSurface.$(H): Cairo__PatternSurface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Pattern.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceImage.$(O) Cairo__SurfaceImage.$(H): Cairo__SurfaceImage.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfacePDF.$(O) Cairo__SurfacePDF.$(H): Cairo__SurfacePDF.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceWin32.$(O) Cairo__SurfaceWin32.$(H): Cairo__SurfaceWin32.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceXlib.$(O) Cairo__SurfaceXlib.$(H): Cairo__SurfaceXlib.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/Image.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradientLinear.$(O) Cairo__PatternGradientLinear.$(H): Cairo__PatternGradientLinear.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Pattern.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__PatternGradient.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/stx_libbasic.$(H) $(INCLUDE_TOP)/stx/libview/Depth1Image.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/Image.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview2/stx_libview2.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradientRadial.$(O) Cairo__PatternGradientRadial.$(H): Cairo__PatternGradientRadial.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Pattern.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__PatternGradient.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/Make.spec Sat Mar 05 20:22:21 2016 +0000
+++ b/Make.spec Mon Mar 21 22:28:05 2016 +0000
@@ -104,10 +104,15 @@
Cairo::Pattern \
Cairo::ScaledFont \
Cairo::Surface \
+ Cairo::PatternGradient \
+ Cairo::PatternSolid \
+ Cairo::PatternSurface \
Cairo::SurfaceImage \
Cairo::SurfacePDF \
Cairo::SurfaceWin32 \
Cairo::SurfaceXlib \
+ Cairo::PatternGradientLinear \
+ Cairo::PatternGradientRadial \
@@ -166,10 +171,15 @@
$(OUTDIR_SLASH)Cairo__Pattern.$(O) \
$(OUTDIR_SLASH)Cairo__ScaledFont.$(O) \
$(OUTDIR_SLASH)Cairo__Surface.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternGradient.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternSolid.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternSurface.$(O) \
$(OUTDIR_SLASH)Cairo__SurfaceImage.$(O) \
$(OUTDIR_SLASH)Cairo__SurfacePDF.$(O) \
$(OUTDIR_SLASH)Cairo__SurfaceWin32.$(O) \
$(OUTDIR_SLASH)Cairo__SurfaceXlib.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternGradientLinear.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternGradientRadial.$(O) \
$(OUTDIR_SLASH)extensions.$(O) \
--- a/abbrev.stc Sat Mar 05 20:22:21 2016 +0000
+++ b/abbrev.stc Mon Mar 21 22:28:05 2016 +0000
@@ -54,10 +54,15 @@
Cairo::Pattern Cairo__Pattern stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::ScaledFont Cairo__ScaledFont stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::Surface Cairo__Surface stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::PatternGradient Cairo__PatternGradient stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::PatternSolid Cairo__PatternSolid stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::PatternSurface Cairo__PatternSurface stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::SurfaceImage Cairo__SurfaceImage stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::SurfacePDF Cairo__SurfacePDF stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::SurfaceWin32 Cairo__SurfaceWin32 stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::SurfaceXlib Cairo__SurfaceXlib stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::PatternGradientLinear Cairo__PatternGradientLinear stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::PatternGradientRadial Cairo__PatternGradientRadial stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::AbstractExamples Cairo__AbstractExamples stx:goodies/libcairo 'Cairo-Examples' 1
Cairo::AbstractViewer Cairo__AbstractViewer stx:goodies/libcairo 'Cairo-Examples' 1
Cairo::Examples1 Cairo__Examples1 stx:goodies/libcairo 'Cairo-Examples' 1
--- a/bc.mak Sat Mar 05 20:22:21 2016 +0000
+++ b/bc.mak Mon Mar 21 22:28:05 2016 +0000
@@ -52,7 +52,9 @@
# build all mandatory prerequisite packages (containing superclasses) for this package
prereq:
pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -114,19 +116,24 @@
$(OUTDIR)Cairo__Matrix.$(O) Cairo__Matrix.$(H): Cairo__Matrix.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)Cairo__Rectangle.$(O) Cairo__Rectangle.$(H): Cairo__Rectangle.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)Cairo__TextExtents.$(O) Cairo__TextExtents.$(H): Cairo__TextExtents.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
-$(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Antialias.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Status.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Antialias.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Extend.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Status.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
$(OUTDIR)CairoScaledFont.$(O) CairoScaledFont.$(H): CairoScaledFont.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\FontDescription.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontFace.$(O) Cairo__FontFace.$(H): Cairo__FontFace.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontOptions.$(O) Cairo__FontOptions.$(H): Cairo__FontOptions.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__PatternType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__ScaledFont.$(O) Cairo__ScaledFont.$(H): Cairo__ScaledFont.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradient.$(O) Cairo__PatternGradient.$(H): Cairo__PatternGradient.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Pattern.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Status.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternSolid.$(O) Cairo__PatternSolid.$(H): Cairo__PatternSolid.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Pattern.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternSurface.$(O) Cairo__PatternSurface.$(H): Cairo__PatternSurface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Pattern.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceImage.$(O) Cairo__SurfaceImage.$(H): Cairo__SurfaceImage.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfacePDF.$(O) Cairo__SurfacePDF.$(H): Cairo__SurfacePDF.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceWin32.$(O) Cairo__SurfaceWin32.$(H): Cairo__SurfaceWin32.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__SurfaceXlib.$(O) Cairo__SurfaceXlib.$(H): Cairo__SurfaceXlib.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\Image.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradientLinear.$(O) Cairo__PatternGradientLinear.$(H): Cairo__PatternGradientLinear.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Pattern.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__PatternGradient.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\stx_libbasic.$(H) $(INCLUDE_TOP)\stx\libview\Depth1Image.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\Image.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview2\stx_libview2.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternGradientRadial.$(O) Cairo__PatternGradientRadial.$(H): Cairo__PatternGradientRadial.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Pattern.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__PatternGradient.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/extensions.st Sat Mar 05 20:22:21 2016 +0000
+++ b/extensions.st Mon Mar 21 22:28:05 2016 +0000
@@ -1,5 +1,94 @@
"{ Package: 'stx:goodies/libcairo' }"!
+!Depth1Image methodsFor:'accessing'!
+
+bitsA1
+ | bitsA1 |
+
+ bitsA1 := ByteArray new: ((width + 31) // 32) * 4 * height.
+ self bitsA1Into: bitsA1.
+ ^ bitsA1
+
+ "Created: / 07-03-2016 / 17:57:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Depth1Image methodsFor:'accessing'!
+
+bitsA1Into: buffer
+ self bitsA1Into: buffer startingAt: 1
+
+ "Created: / 07-03-2016 / 17:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Depth1Image methodsFor:'accessing'!
+
+bitsA1Into: buffer startingAt: first
+ self bitsA1Into: buffer startingAt: first stride: ((width + 31) // 32) * 4
+
+ "Created: / 07-03-2016 / 18:02:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-03-2016 / 20:08:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Depth1Image methodsFor:'accessing'!
+
+bitsA1Into: buffer startingAt: first stride: stride
+ "Store each pixel is a 1-bit quantity holding an alpha value. Pixels are
+ packed together into 32-bit quantities. The ordering of the bits matches
+ the endianess of the platform. On a big-endian machine, the first pixel
+ is in the uppermost bit, on a little-endian machine the first pixel is
+ in the least-significant bit.
+ "
+ | widthInBytes baseInBuffer baseInPixelStore reverseBits |
+
+ widthInBytes := (width + 7) // 8.
+ ExternalBytes isBigEndian ifTrue:[
+ self breakPoint: #jv. "/ Untested code
+ 0 to: height - 1 do:[:y |
+ baseInBuffer := (stride * y) + first.
+ baseInPixelStore := (widthInBytes * y) + 1.
+ buffer replaceBytesFrom: baseInBuffer to: baseInBuffer + widthInBytes - 1 with: bytes startingAt: baseInPixelStore.
+ ].
+ ] ifFalse:[
+ reverseBits := ImageReader reverseBits.
+ "/reverseBits := (0 to: 255) asArray.
+
+ 0 to: height - 1 do:[:y |
+ | x4 |
+
+ baseInBuffer := (stride * y) + first.
+ baseInPixelStore := (widthInBytes * y) + 1.
+
+ x4 := 0.
+ [ x4 < widthInBytes ] whileTrue:[
+ buffer at: baseInBuffer + x4 + "3"0 put: (reverseBits at: (bytes at: baseInPixelStore + x4 + 0) + 1).
+ x4 + 1 < widthInBytes ifTrue:[ buffer at: baseInBuffer + x4 + "2"1 put: (reverseBits at: (bytes at: baseInPixelStore + x4 + 1) + 1) ].
+ x4 + 2 < widthInBytes ifTrue:[ buffer at: baseInBuffer + x4 + "1"2 put: (reverseBits at: (bytes at: baseInPixelStore + x4 + 2) + 1) ].
+ x4 + 3 < widthInBytes ifTrue:[ buffer at: baseInBuffer + x4 + "0"3 put: (reverseBits at: (bytes at: baseInPixelStore + x4 + 3) + 1) ].
+ x4 := x4 + 4.
+ ].
+ ]
+ ]
+.
+ "
+ (ImageMask width: 3 height: 3)
+ createPixelStore;
+ pixelAtX: 0 y:0 put: 1;
+ pixelAtX: 2 y:0 put: 1;
+ bitsA1.
+
+ "
+
+ "Created: / 07-03-2016 / 18:03:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 08-03-2016 / 14:13:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Depth1Image class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
!DeviceGraphicsContext methodsFor:'accessing'!
cairo
@@ -136,6 +225,43 @@
"Modified: / 24-02-2016 / 17:17:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!Image methodsFor:'converting'!
+
+asSurfaceWithFormat: format similarTo: surface
+ "Returns the receiver as Cairo::Surface (image) with given `format`. If `surface` is not
+ nil, then the new surface is made as compatible as possible for uploading to
+ and the use in conjunction with an `surface`.
+
+ CAVEAT: For now, only ARB32 and A1 formats are supported
+ "
+
+ | image |
+
+ surface notNil ifTrue:[
+ image := Cairo::Surface newImageWithFormat: format width: width height: height similarTo: surface.
+ ] ifFalse:[
+ image := Cairo::Surface newImageWithFormat: format width: width height: height.
+ ].
+ format == Cairo::Format CAIRO_FORMAT_ARGB32 ifTrue:[
+ self bitsARGB32Into: image data startingAt: 1 stride: image stride
+ ] ifFalse:[
+ format == Cairo::Format CAIRO_FORMAT_A1 ifTrue:[
+ self bitsA1Into: image data startingAt: 1 stride: image stride.
+ ] ifFalse:[
+ self error: 'Unsupported format'.
+ ^ nil.
+ ].
+ ].
+ "
+ image data asByteArray
+ "
+ image markDirty.
+ ^ image
+
+ "Created: / 07-03-2016 / 21:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 08-03-2016 / 14:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Image methodsFor:'inspecting'!
inspector2TabImageCairo
@@ -144,16 +270,8 @@
| view |
view := PluggableView new.
- view redrawAction:[
- | cr |
-
- cr := view cairo.
- [
- self displayOn: cr
- ] ensure:[
- cr release.
- ].
- ].
+ view cairoify.
+ view redrawAction:[ self displayOn: view ].
^self newInspector2Tab
label: 'Image (Cairo)';
priority: 49;
@@ -161,6 +279,7 @@
yourself
"Created: / 31-12-2014 / 12:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-03-2016 / 22:25:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SimpleView methodsFor:'accessing - cairo'!
@@ -315,6 +434,18 @@
"Modified: / 12-02-2016 / 16:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!stx_libbasic class methodsFor:'documentation'!
+
+version_HG
+ ^ '$Changeset: <not expanded> $'
+! !
+
+!stx_libview2 class methodsFor:'documentation'!
+
+version_HG
+ ^ '$Changeset: <not expanded> $'
+! !
+
!stx_goodies_libcairo class methodsFor:'documentation'!
extensionsVersion_HG
--- a/libInit.cc Sat Mar 05 20:22:21 2016 +0000
+++ b/libInit.cc Mon Mar 21 22:28:05 2016 +0000
@@ -16,75 +16,144 @@
DLL_EXPORT void _libstx_goodies_libcairo_InitDefinition() INIT_TEXT_SECTION;
#endif
-void _libstx_goodies_libcairo_InitDefinition(pass, __pRT__, snd)
-OBJ snd; struct __vmData__ *__pRT__; {
-__BEGIN_PACKAGE2__("libstx_goodies_libcairo__DFN", _libstx_goodies_libcairo_InitDefinition, "stx:goodies/libcairo");
-_stx_137goodies_137libcairo_Init(pass,__pRT__,snd);
+extern void _Cairo__Antialias_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__CError_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__CPrimitives_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__CStructure_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__ClockView_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Content_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Device_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__DeviceType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Extend_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FillRule_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Filter_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontSlant_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontWeight_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Format_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__HintMetrics_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__HintStyle_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__LineCap_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__LineJoin_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Operator_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Path_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PathData_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PathDataType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PdfVersion_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__RectangleInt_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__RectangleList_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Region_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__RegionOverlap_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Status_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SubpixelOrder_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfaceObserverMode_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfaceType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__TextCluster_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__TextClusterFlags_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__TextExampleView_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__UserDataKey_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _CairoGraphicsContextHandle_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _stx_137goodies_137libcairo_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__CObject_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontExtents_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Glyph_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Matrix_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Rectangle_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__TextExtents_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _CairoGraphicsContext_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _CairoScaledFont_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontFace_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__FontOptions_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__GraphicsContext_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Pattern_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__ScaledFont_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__Surface_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternGradient_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternSolid_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternSurface_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfaceImage_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfacePDF_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfaceWin32_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__SurfaceXlib_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternGradientLinear_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternGradientRadial_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
-__END_PACKAGE__();
+
+void _libstx_goodies_libcairo_InitDefinition(int pass, struct __vmData__ *__pRT__, OBJ snd)
+{
+ __BEGIN_PACKAGE2__("libstx_goodies_libcairo__DFN", _libstx_goodies_libcairo_InitDefinition, "stx:goodies/libcairo");
+ _stx_137goodies_137libcairo_Init(pass,__pRT__,snd);
+
+ __END_PACKAGE__();
}
-void _libstx_goodies_libcairo_Init(pass, __pRT__, snd)
-OBJ snd; struct __vmData__ *__pRT__; {
-__BEGIN_PACKAGE2__("libstx_goodies_libcairo", _libstx_goodies_libcairo_Init, "stx:goodies/libcairo");
-_Cairo__Antialias_Init(pass,__pRT__,snd);
-_Cairo__CError_Init(pass,__pRT__,snd);
-_Cairo__CPrimitives_Init(pass,__pRT__,snd);
-_Cairo__CStructure_Init(pass,__pRT__,snd);
-_Cairo__ClockView_Init(pass,__pRT__,snd);
-_Cairo__Content_Init(pass,__pRT__,snd);
-_Cairo__Device_Init(pass,__pRT__,snd);
-_Cairo__DeviceType_Init(pass,__pRT__,snd);
-_Cairo__Extend_Init(pass,__pRT__,snd);
-_Cairo__FillRule_Init(pass,__pRT__,snd);
-_Cairo__Filter_Init(pass,__pRT__,snd);
-_Cairo__FontSlant_Init(pass,__pRT__,snd);
-_Cairo__FontType_Init(pass,__pRT__,snd);
-_Cairo__FontWeight_Init(pass,__pRT__,snd);
-_Cairo__Format_Init(pass,__pRT__,snd);
-_Cairo__HintMetrics_Init(pass,__pRT__,snd);
-_Cairo__HintStyle_Init(pass,__pRT__,snd);
-_Cairo__LineCap_Init(pass,__pRT__,snd);
-_Cairo__LineJoin_Init(pass,__pRT__,snd);
-_Cairo__Operator_Init(pass,__pRT__,snd);
-_Cairo__Path_Init(pass,__pRT__,snd);
-_Cairo__PathData_Init(pass,__pRT__,snd);
-_Cairo__PathDataType_Init(pass,__pRT__,snd);
-_Cairo__PatternType_Init(pass,__pRT__,snd);
-_Cairo__PdfVersion_Init(pass,__pRT__,snd);
-_Cairo__RectangleInt_Init(pass,__pRT__,snd);
-_Cairo__RectangleList_Init(pass,__pRT__,snd);
-_Cairo__Region_Init(pass,__pRT__,snd);
-_Cairo__RegionOverlap_Init(pass,__pRT__,snd);
-_Cairo__Status_Init(pass,__pRT__,snd);
-_Cairo__SubpixelOrder_Init(pass,__pRT__,snd);
-_Cairo__SurfaceObserverMode_Init(pass,__pRT__,snd);
-_Cairo__SurfaceType_Init(pass,__pRT__,snd);
-_Cairo__TextCluster_Init(pass,__pRT__,snd);
-_Cairo__TextClusterFlags_Init(pass,__pRT__,snd);
-_Cairo__TextExampleView_Init(pass,__pRT__,snd);
-_Cairo__UserDataKey_Init(pass,__pRT__,snd);
-_CairoGraphicsContextHandle_Init(pass,__pRT__,snd);
-_stx_137goodies_137libcairo_Init(pass,__pRT__,snd);
-_Cairo__CObject_Init(pass,__pRT__,snd);
-_Cairo__FontExtents_Init(pass,__pRT__,snd);
-_Cairo__Glyph_Init(pass,__pRT__,snd);
-_Cairo__Matrix_Init(pass,__pRT__,snd);
-_Cairo__Rectangle_Init(pass,__pRT__,snd);
-_Cairo__TextExtents_Init(pass,__pRT__,snd);
-_CairoGraphicsContext_Init(pass,__pRT__,snd);
-_CairoScaledFont_Init(pass,__pRT__,snd);
-_Cairo__FontFace_Init(pass,__pRT__,snd);
-_Cairo__FontOptions_Init(pass,__pRT__,snd);
-_Cairo__GraphicsContext_Init(pass,__pRT__,snd);
-_Cairo__Pattern_Init(pass,__pRT__,snd);
-_Cairo__ScaledFont_Init(pass,__pRT__,snd);
-_Cairo__Surface_Init(pass,__pRT__,snd);
-_Cairo__SurfaceImage_Init(pass,__pRT__,snd);
-_Cairo__SurfacePDF_Init(pass,__pRT__,snd);
-_Cairo__SurfaceWin32_Init(pass,__pRT__,snd);
-_Cairo__SurfaceXlib_Init(pass,__pRT__,snd);
+void _libstx_goodies_libcairo_Init(int pass, struct __vmData__ *__pRT__, OBJ snd)
+{
+ __BEGIN_PACKAGE2__("libstx_goodies_libcairo", _libstx_goodies_libcairo_Init, "stx:goodies/libcairo");
+ _Cairo__Antialias_Init(pass,__pRT__,snd);
+ _Cairo__CError_Init(pass,__pRT__,snd);
+ _Cairo__CPrimitives_Init(pass,__pRT__,snd);
+ _Cairo__CStructure_Init(pass,__pRT__,snd);
+ _Cairo__ClockView_Init(pass,__pRT__,snd);
+ _Cairo__Content_Init(pass,__pRT__,snd);
+ _Cairo__Device_Init(pass,__pRT__,snd);
+ _Cairo__DeviceType_Init(pass,__pRT__,snd);
+ _Cairo__Extend_Init(pass,__pRT__,snd);
+ _Cairo__FillRule_Init(pass,__pRT__,snd);
+ _Cairo__Filter_Init(pass,__pRT__,snd);
+ _Cairo__FontSlant_Init(pass,__pRT__,snd);
+ _Cairo__FontType_Init(pass,__pRT__,snd);
+ _Cairo__FontWeight_Init(pass,__pRT__,snd);
+ _Cairo__Format_Init(pass,__pRT__,snd);
+ _Cairo__HintMetrics_Init(pass,__pRT__,snd);
+ _Cairo__HintStyle_Init(pass,__pRT__,snd);
+ _Cairo__LineCap_Init(pass,__pRT__,snd);
+ _Cairo__LineJoin_Init(pass,__pRT__,snd);
+ _Cairo__Operator_Init(pass,__pRT__,snd);
+ _Cairo__Path_Init(pass,__pRT__,snd);
+ _Cairo__PathData_Init(pass,__pRT__,snd);
+ _Cairo__PathDataType_Init(pass,__pRT__,snd);
+ _Cairo__PatternType_Init(pass,__pRT__,snd);
+ _Cairo__PdfVersion_Init(pass,__pRT__,snd);
+ _Cairo__RectangleInt_Init(pass,__pRT__,snd);
+ _Cairo__RectangleList_Init(pass,__pRT__,snd);
+ _Cairo__Region_Init(pass,__pRT__,snd);
+ _Cairo__RegionOverlap_Init(pass,__pRT__,snd);
+ _Cairo__Status_Init(pass,__pRT__,snd);
+ _Cairo__SubpixelOrder_Init(pass,__pRT__,snd);
+ _Cairo__SurfaceObserverMode_Init(pass,__pRT__,snd);
+ _Cairo__SurfaceType_Init(pass,__pRT__,snd);
+ _Cairo__TextCluster_Init(pass,__pRT__,snd);
+ _Cairo__TextClusterFlags_Init(pass,__pRT__,snd);
+ _Cairo__TextExampleView_Init(pass,__pRT__,snd);
+ _Cairo__UserDataKey_Init(pass,__pRT__,snd);
+ _CairoGraphicsContextHandle_Init(pass,__pRT__,snd);
+ _stx_137goodies_137libcairo_Init(pass,__pRT__,snd);
+ _Cairo__CObject_Init(pass,__pRT__,snd);
+ _Cairo__FontExtents_Init(pass,__pRT__,snd);
+ _Cairo__Glyph_Init(pass,__pRT__,snd);
+ _Cairo__Matrix_Init(pass,__pRT__,snd);
+ _Cairo__Rectangle_Init(pass,__pRT__,snd);
+ _Cairo__TextExtents_Init(pass,__pRT__,snd);
+ _CairoGraphicsContext_Init(pass,__pRT__,snd);
+ _CairoScaledFont_Init(pass,__pRT__,snd);
+ _Cairo__FontFace_Init(pass,__pRT__,snd);
+ _Cairo__FontOptions_Init(pass,__pRT__,snd);
+ _Cairo__GraphicsContext_Init(pass,__pRT__,snd);
+ _Cairo__Pattern_Init(pass,__pRT__,snd);
+ _Cairo__ScaledFont_Init(pass,__pRT__,snd);
+ _Cairo__Surface_Init(pass,__pRT__,snd);
+ _Cairo__PatternGradient_Init(pass,__pRT__,snd);
+ _Cairo__PatternSolid_Init(pass,__pRT__,snd);
+ _Cairo__PatternSurface_Init(pass,__pRT__,snd);
+ _Cairo__SurfaceImage_Init(pass,__pRT__,snd);
+ _Cairo__SurfacePDF_Init(pass,__pRT__,snd);
+ _Cairo__SurfaceWin32_Init(pass,__pRT__,snd);
+ _Cairo__SurfaceXlib_Init(pass,__pRT__,snd);
+ _Cairo__PatternGradientLinear_Init(pass,__pRT__,snd);
+ _Cairo__PatternGradientRadial_Init(pass,__pRT__,snd);
-_stx_137goodies_137libcairo_extensions_Init(pass,__pRT__,snd);
-__END_PACKAGE__();
+ _stx_137goodies_137libcairo_extensions_Init(pass,__pRT__,snd);
+ __END_PACKAGE__();
}
--- a/stx_goodies_libcairo.st Sat Mar 05 20:22:21 2016 +0000
+++ b/stx_goodies_libcairo.st Mon Mar 21 22:28:05 2016 +0000
@@ -57,7 +57,8 @@
^ #(
#'stx:libbasic' "ArrayedCollection - superclass of Cairo::CStructure"
- #'stx:libview' "DeviceGraphicsContext - extended"
+ #'stx:libview' "Depth1Image - extended"
+ #'stx:libview2' "stx_libview2 - extended"
)
!
@@ -118,8 +119,7 @@
by searching all classes (and their packages) which are referenced by my classes."
^ #(
- #'stx:libview2' "PluggableView - referenced by Image>>inspector2TabImageCairo"
- #'stx:libwidg' "HVScrollableView - referenced by Image>>inspector2TabImageCairo"
+ #'stx:libwidg' "HVScrollableView - referenced by Cairo::SurfaceImage>>inspector2TabImageCairo"
)
!
@@ -196,10 +196,15 @@
#'Cairo::Pattern'
#'Cairo::ScaledFont'
#'Cairo::Surface'
+ #'Cairo::PatternGradient'
+ #'Cairo::PatternSolid'
+ #'Cairo::PatternSurface'
#'Cairo::SurfaceImage'
#'Cairo::SurfacePDF'
#'Cairo::SurfaceWin32'
#'Cairo::SurfaceXlib'
+ #'Cairo::PatternGradientLinear'
+ #'Cairo::PatternGradientRadial'
(#'Cairo::AbstractExamples' autoload)
(#'Cairo::AbstractViewer' autoload)
(#'Cairo::Examples1' autoload)
@@ -234,6 +239,14 @@
GraphicsMedium cairoify
SimpleView cairoify
SimpleView cairoSurface
+ 'stx_libbasic class' #'version_HG'
+ 'stx_libview2 class' #'version_HG'
+ Depth1Image bitsA1
+ Depth1Image bitsA1Into:
+ Depth1Image bitsA1Into:startingAt:
+ Depth1Image bitsA1Into:startingAt:stride:
+ Image asSurfaceWithFormat:similarTo:
+ 'Depth1Image class' #'version_HG'
)
! !
--- a/tests/Cairo__GraphicsContextTests.st Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/Cairo__GraphicsContextTests.st Mon Mar 21 22:28:05 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Tests'
!
+
!GraphicsContextTests methodsFor:'running'!
setUp
@@ -35,6 +36,33 @@
"Created: / 18-02-2016 / 08:37:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!GraphicsContextTests methodsFor:'tests - source'!
+
+test_source_01
+ | c |
+
+ cr sourceR: 1 G: 0 B: 0.
+ c := cr source color.
+ self assert: c = Color red.
+ "/ Now try to get rid of the pattern,
+ "/ this tests that we tell cairo
+ "/ that the pattern is referenced from
+ "/ outside...
+ Smalltalk garbageCollect
+
+ "Created: / 05-03-2016 / 12:32:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_source_02
+ | c |
+
+ cr source: (Pattern color: Color red).
+ c := cr source color.
+ self assert: c = Color red.
+
+ "Created: / 05-03-2016 / 22:17:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!GraphicsContextTests methodsFor:'tests - text'!
test_01
@@ -56,3 +84,10 @@
"Modified: / 18-02-2016 / 10:14:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!GraphicsContextTests class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/Cairo__PatternTests.st Mon Mar 21 22:28:05 2016 +0000
@@ -0,0 +1,114 @@
+"{ Package: 'stx:goodies/libcairo/tests' }"
+
+"{ NameSpace: Cairo }"
+
+TestCase subclass:#PatternTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Tests'
+!
+
+
+!PatternTests methodsFor:'tests - gradient'!
+
+test_linear_01
+ | p s |
+
+ p := Cairo::Pattern linearFromX: 0.0 y: 0.0 toX: 1.0 y: 1.0.
+ p addColor: Color red stopAt: 0.0.
+ p addColor: Color green stopAt: 1.0.
+
+ self assert: p colorStopCount = 2.
+ s := p colorStopAtIndex: 1.
+ self assert: s key = 0.0.
+ self assert: s value = Color red.
+
+ s := p colorStopAtIndex: 2.
+ self assert: s key = 1.0.
+ self assert: s value = Color green.
+
+ self should: [ p colorStopAtIndex: -1 ] raise: Object indexNotFoundSignal.
+ self should: [ p colorStopAtIndex: 3 ] raise: Object indexNotFoundSignal.
+
+ "Created: / 15-03-2016 / 20:59:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_linear_02
+ | p points |
+
+ p := Cairo::Pattern linearFromX: 0.0 y: 0.0 toX: 1.0 y: 1.0.
+ points := p points.
+ self assert: points first x = 0.0.
+ self assert: points first y = 0.0.
+ self assert: points second x = 1.0.
+ self assert: points second y = 1.0.
+
+ "Created: / 15-03-2016 / 21:40:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_radial_02
+ | p circles |
+
+ p := Cairo::Pattern radialFromX: 0.0 y: 0.0 radius: 2.0 toX: 1.0 y: 1.0 radius: 3.0.
+ circles := p circles.
+ self assert: circles first x = 0.0.
+ self assert: circles first y = 0.0.
+ self assert: circles second = 2.0.
+ self assert: circles third x = 1.0.
+ self assert: circles third y = 1.0.
+ self assert: circles fourth = 3.0.
+
+ "Created: / 15-03-2016 / 22:21:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!PatternTests methodsFor:'tests - solid'!
+
+test_solid_01
+ | p |
+
+ p := Cairo::Pattern R: 1 G: 0 B: 0.
+ self assert: p isSolid.
+ self assert: p color = Color red.
+ p release.
+
+ p := Cairo::Pattern R: 0.5 G: 0.5 B: 0.5 A: 0.5.
+ self assert: p isSolid.
+ self assert: p color = ((Color scaledRed: 32768 scaledGreen: 32768 scaledBlue: 32768) alpha: 0.5).
+ p release.
+
+ p := Cairo::Pattern color: Color red.
+ self assert: p isSolid.
+ self assert: p color = Color red.
+ p release.
+
+ "Created: / 04-03-2016 / 09:49:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 22:12:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!PatternTests methodsFor:'tests - surface'!
+
+test_surface_01
+ | image imageCr pattern |
+
+ image := Surface newImageWithFormat: Format CAIRO_FORMAT_ARGB32 width: 2 height: 2.
+ imageCr := image cairo.
+ imageCr sourceR: 0 G: 1 B: 0.
+ imageCr paint.
+ image flush.
+ self assert: (image data unsignedLongAt: 1) = 16rFF00FF00.
+
+ pattern := Pattern surface: image.
+ image := pattern surface.
+ self assert: (image data unsignedLongAt: 1) = 16rFF00FF00.
+
+ "Created: / 05-03-2016 / 22:29:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!PatternTests class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/tests/Make.proto Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/Make.proto Mon Mar 21 22:28:05 2016 +0000
@@ -101,12 +101,12 @@
# build all mandatory prerequisite packages (containing superclasses) for this package
prereq:
- cd ../../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ cd ../../sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -127,6 +127,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)Cairo__GraphicsContextTests.$(O) Cairo__GraphicsContextTests.$(H): Cairo__GraphicsContextTests.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternTests.$(O) Cairo__PatternTests.$(H): Cairo__PatternTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_libcairo_tests.$(O) stx_goodies_libcairo_tests.$(H): stx_goodies_libcairo_tests.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/tests/Make.spec Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/Make.spec Mon Mar 21 22:28:05 2016 +0000
@@ -52,6 +52,7 @@
COMMON_CLASSES= \
Cairo::GraphicsContextTests \
+ Cairo::PatternTests \
stx_goodies_libcairo_tests \
@@ -59,6 +60,7 @@
COMMON_OBJS= \
$(OUTDIR_SLASH)Cairo__GraphicsContextTests.$(O) \
+ $(OUTDIR_SLASH)Cairo__PatternTests.$(O) \
$(OUTDIR_SLASH)stx_goodies_libcairo_tests.$(O) \
--- a/tests/abbrev.stc Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/abbrev.stc Mon Mar 21 22:28:05 2016 +0000
@@ -2,4 +2,5 @@
# this file is needed for stc to be able to compile modules independently.
# it provides information about a classes filename, category and especially namespace.
Cairo::GraphicsContextTests Cairo__GraphicsContextTests stx:goodies/libcairo/tests 'Cairo-Tests' 1
+Cairo::PatternTests Cairo__PatternTests stx:goodies/libcairo/tests 'Cairo-Tests' 1
stx_goodies_libcairo_tests stx_goodies_libcairo_tests stx:goodies/libcairo/tests '* Projects & Packages *' 3
--- a/tests/bc.mak Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/bc.mak Mon Mar 21 22:28:05 2016 +0000
@@ -54,8 +54,8 @@
pushd ..\..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
- pushd ..\..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -74,6 +74,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)Cairo__GraphicsContextTests.$(O) Cairo__GraphicsContextTests.$(H): Cairo__GraphicsContextTests.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__PatternTests.$(O) Cairo__PatternTests.$(H): Cairo__PatternTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_libcairo_tests.$(O) stx_goodies_libcairo_tests.$(H): stx_goodies_libcairo_tests.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/tests/libInit.cc Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/libInit.cc Mon Mar 21 22:28:05 2016 +0000
@@ -16,20 +16,26 @@
DLL_EXPORT void _libstx_goodies_libcairo_tests_InitDefinition() INIT_TEXT_SECTION;
#endif
-void _libstx_goodies_libcairo_tests_InitDefinition(pass, __pRT__, snd)
-OBJ snd; struct __vmData__ *__pRT__; {
-__BEGIN_PACKAGE2__("libstx_goodies_libcairo_tests__DFN", _libstx_goodies_libcairo_tests_InitDefinition, "stx:goodies/libcairo/tests");
-_stx_137goodies_137libcairo_137tests_Init(pass,__pRT__,snd);
+extern void _Cairo__GraphicsContextTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _Cairo__PatternTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _stx_137goodies_137libcairo_137tests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+
-__END_PACKAGE__();
+void _libstx_goodies_libcairo_tests_InitDefinition(int pass, struct __vmData__ *__pRT__, OBJ snd)
+{
+ __BEGIN_PACKAGE2__("libstx_goodies_libcairo_tests__DFN", _libstx_goodies_libcairo_tests_InitDefinition, "stx:goodies/libcairo/tests");
+ _stx_137goodies_137libcairo_137tests_Init(pass,__pRT__,snd);
+
+ __END_PACKAGE__();
}
-void _libstx_goodies_libcairo_tests_Init(pass, __pRT__, snd)
-OBJ snd; struct __vmData__ *__pRT__; {
-__BEGIN_PACKAGE2__("libstx_goodies_libcairo_tests", _libstx_goodies_libcairo_tests_Init, "stx:goodies/libcairo/tests");
-_Cairo__GraphicsContextTests_Init(pass,__pRT__,snd);
-_stx_137goodies_137libcairo_137tests_Init(pass,__pRT__,snd);
+void _libstx_goodies_libcairo_tests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd)
+{
+ __BEGIN_PACKAGE2__("libstx_goodies_libcairo_tests", _libstx_goodies_libcairo_tests_Init, "stx:goodies/libcairo/tests");
+ _Cairo__GraphicsContextTests_Init(pass,__pRT__,snd);
+ _Cairo__PatternTests_Init(pass,__pRT__,snd);
+ _stx_137goodies_137libcairo_137tests_Init(pass,__pRT__,snd);
-__END_PACKAGE__();
+ __END_PACKAGE__();
}
--- a/tests/stx_goodies_libcairo_tests.st Sat Mar 05 20:22:21 2016 +0000
+++ b/tests/stx_goodies_libcairo_tests.st Mon Mar 21 22:28:05 2016 +0000
@@ -47,7 +47,7 @@
by searching all classes (and their packages) which are referenced by my classes."
^ #(
- #'stx:libview' "FontDescription - referenced by Cairo::GraphicsContextTests>>test_01"
+ #'stx:libview' "Color - referenced by Cairo::GraphicsContextTests>>test_source_01"
)
!
@@ -72,6 +72,7 @@
^ #(
"<className> or (<className> attributes...) in load order"
#'Cairo::GraphicsContextTests'
+ #'Cairo::PatternTests'
#'stx_goodies_libcairo_tests'
)
!