--- a/CairoGraphicsContext.st Wed Feb 24 09:13:04 2016 +0000
+++ b/CairoGraphicsContext.st Wed Feb 24 18:21:58 2016 +0000
@@ -190,12 +190,12 @@
transformation notNil ifTrue:[
cr
scale: transformation scale;
- transform: transformation translation.
+ translate: transformation translation.
]
]
"Created: / 01-01-2015 / 12:07:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 23-02-2016 / 15:55:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-02-2016 / 17:28:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CairoGraphicsContext methodsFor:'basic drawing'!
@@ -280,7 +280,7 @@
"Modified: / 21-02-2016 / 15:34:34 / jv"
!
-displayString:aStringArg from:index1Arg to:index2Arg x:x y:y opaque:opaqueArg maxWidth:maxWidth
+displayString:string from:index1 to:index2 x:x y:y opaque:opaqueArg maxWidth:maxWidth
"draw a substring at the coordinate x/y - draw foreground pixels in
paint-color and (if opaque is true), background pixels in bgPaint-color.
If the transformation involves scaling, the font's point-size is scaled as appropriate.
@@ -288,7 +288,7 @@
the case where paint and/or bgPaint are dithered colors.
maxWidth is the maximum width of the string in pixels or nil if unknown."
- | opaque string |
+ | opaque |
"
if backgroundPaint color is nil, we assume
this is a non-opaque draw
@@ -302,50 +302,27 @@
self initGC
].
- (aStringArg isString not or:[aStringArg isText]) ifTrue:[
+ (string isString not or:[string isText]) ifTrue:[
"
hook for non-strings (i.e. attributed text)
that 'thing' should know how to display itself ...
"
- aStringArg displayOn:self x:x y:y from:index1Arg to:index2Arg opaque:opaque.
+ string displayOn:self x:x y:y from:index1 to:index2 opaque:opaque.
^ self
].
- (index1Arg == 1 and:[ index2Arg == aStringArg size ]) ifTrue:[
- string := aStringArg
+ font class == CairoScaledFont ifTrue:[
+ font displayString:string from:index1 to:index2 x:x y:y cr:cr fg: paint bg: bgPaint opaque:opaque
] ifFalse:[
- string := aStringArg copyFrom: index1Arg to: index2Arg
+ Logger warning:'Drawing text using non-Cairo font (%1 )on CairoGraphicsContext' with: font class name.
+ cr surface flush.
+ super displayString:string from:index1 to:index2 x:x y:y opaque:opaqueArg maxWidth:maxWidth.
+ cr surface markDirty.
].
- cr save.
- [
- | extents |
-
- extents := cr textExtents: string.
- cr rectangleX: x + extents xBearing ceiling y: y - font ascent ceiling width: extents xAdvance ceiling height: font height ceiling.
- cr lineWidth: 0.
-
- opaque ifTrue:[
- cr source: bgPaint.
- cr fill.
- ] ifFalse:[
- "/ I'm not sure why this is required but if not done,
- "/ selected text is not rendered correcrtly...
- cr stroke.
- ].
-
- self assert: cr status == CAIRO_STATUS_SUCCESS.
- cr source: paint.
- cr moveToX: x y: y.
- cr showText: string.
- self assert: cr status == CAIRO_STATUS_SUCCESS.
- ] ensure:[
- cr restore.
- ]
-
"Created: / 16-02-2016 / 10:51:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 18-02-2016 / 21:12:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 19-02-2016 / 21:04:49 / jv"
+ "Modified: / 24-02-2016 / 17:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CairoGraphicsContext methodsFor:'basic filling'!
@@ -442,9 +419,13 @@
cr notNil ifTrue:[
cr surface flush
].
- ^ super copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
+ super copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY.
+ cr notNil ifTrue:[
+ cr surface markDirty
+ ].
"Created: / 18-02-2016 / 20:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-02-2016 / 18:19:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
@@ -459,9 +440,13 @@
cr notNil ifTrue:[
cr surface flush
].
- ^ super copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
+ super copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async.
+ cr notNil ifTrue:[
+ cr surface markDirty
+ ].
"Created: / 18-02-2016 / 20:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-02-2016 / 18:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
@@ -474,10 +459,14 @@
cr notNil ifTrue:[
cr surface flush
].
- ^ super copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
+ super copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h.
+ cr notNil ifTrue:[
+ cr surface markDirty
+ ].
"Created: / 18-02-2016 / 20:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 21-02-2016 / 15:35:11 / jv"
+ "Modified: / 24-02-2016 / 18:19:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CairoGraphicsContext methodsFor:'drawing'!
@@ -527,9 +516,13 @@
cr notNil ifTrue:[
cr surface flush
].
- ^ super displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm
+ super displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm.
+ cr notNil ifTrue:[
+ cr surface markDirty
+ ].
"Created: / 18-02-2016 / 20:28:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-02-2016 / 18:19:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
displayRoundRectangleX:x y:y width:w height:h wCorner:wCorn hCorner:hCorn