CairoGraphicsContext: Fixed paint setting
Even though methods like #foreground: / #foreground:background: method
are marked obsolete for quite some time, a lot of core widgets are still
using them (!). Therefore CairoGraphicsContext must implement them to
correctly update Cairo context.
This fixes issues with EditField.
--- a/CairoGraphicsContext.st Tue Apr 05 08:02:32 2016 +0100
+++ b/CairoGraphicsContext.st Tue Apr 05 10:00:57 2016 +0100
@@ -185,9 +185,8 @@
super deviceClippingBounds: aRectangleOrNil.
self deviceCoordinatesDo:[
cr notNil ifTrue:[
- aRectangleOrNil isNil ifTrue:[
- cr clipReset
- ] ifFalse:[
+ cr clipReset.
+ aRectangleOrNil notNil ifTrue:[
cr rectangleX: aRectangleOrNil left
y: aRectangleOrNil top
width: aRectangleOrNil width
@@ -198,6 +197,7 @@
].
"Created: / 27-03-2016 / 00:09:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-04-2016 / 16:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
function:aFunctionSymbol
@@ -279,6 +279,56 @@
"Modified: / 02-04-2016 / 15:55:29 / jv"
! !
+!CairoGraphicsContext methodsFor:'accessing-internals'!
+
+foreground:aColor
+ <resource: #obsolete>
+ "set the internal foreground color for drawing - aColor must be a real color.
+ OBSOLETE: this method will vanish; use #paint: / #paint:on:"
+
+ (aColor ~~ foreground) ifTrue:[
+ aColor notNil ifTrue:[
+ super foreground:aColor.
+ cr notNil ifTrue:[
+ cr source: paint.
+ ].
+ ]
+ ]
+
+ "Created: / 05-04-2016 / 16:59:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+foreground:fgColor background:bgColor
+ <resource: #obsolete>
+ "set both internal foreground and internal background colors
+ - these must be real colors.
+ OBSOLETE: this method will vanish; use #paint: / #paint:on:"
+
+ ((fgColor ~~ foreground) or:[bgColor ~~ background]) ifTrue:[
+ super foreground:fgColor background:bgColor.
+ cr notNil ifTrue:[
+ cr source: paint.
+ ].
+ ]
+
+ "Created: / 05-04-2016 / 17:00:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+foreground:aColor function:fun
+ <resource: #obsolete>
+ "set the foreground color and function for drawing.
+ OBSOLETE: this method will vanish; use #paint: / #paint:on:"
+
+ ((aColor ~~ foreground) or:[fun ~~ function]) ifTrue:[
+ super foreground:aColor function:fun.
+ cr notNil ifTrue:[
+ cr source: paint.
+ ].
+ ]
+
+ "Created: / 05-04-2016 / 17:01:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CairoGraphicsContext methodsFor:'accessing-transformation'!
transformation:aTransformation
--- a/Cairo__LineJoin.st Tue Apr 05 08:02:32 2016 +0100
+++ b/Cairo__LineJoin.st Tue Apr 05 10:00:57 2016 +0100
@@ -9,6 +9,7 @@
category:'Cairo-Constants'
!
+
!LineJoin class methodsFor:'initialization'!
initialize
@@ -35,5 +36,12 @@
^CAIRO_LINE_JOIN_ROUND
! !
+!LineJoin class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
LineJoin initialize!
--- a/tests/CairoGraphicsContextTests.st Tue Apr 05 08:02:32 2016 +0100
+++ b/tests/CairoGraphicsContextTests.st Tue Apr 05 10:00:57 2016 +0100
@@ -322,6 +322,29 @@
top open.
"Created: / 04-04-2016 / 18:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+manual_02
+ "
+ CairoGraphicsContextTests new manual_02
+ "
+
+ |top textView |
+
+ top := StandardSystemView new.
+ top extent:300@25.
+
+ textView := EditField new.
+ textView cairoify.
+ textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
+ top addSubView:textView.
+
+
+
+ top open.
+
+ "Created: / 05-04-2016 / 09:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-04-2016 / 13:04:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CairoGraphicsContextTests class methodsFor:'documentation'!