Hi,
I have a problem with some gradients between Windows and Mac, If you load the attached package together with Akamura and Cairo you can see the differences. ;-) Rgrds, @+Maarten, <?xml version="1.0"?> <st-source> <time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on June 20, 2008 at 7:31:10 am</time-stamp> <!-- Package TestDrive* --> <class> <name>TickingView</name> <environment>Smalltalk</environment> <super>UI.View</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars></inst-vars> <class-inst-vars></class-inst-vars> <imports></imports> <category></category> <attributes> <package>TestDrive</package> </attributes> </class> <class> <name>TestDrivingView</name> <environment>Smalltalk</environment> <super>TickingView</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars>startVerticalScrollGrid strokeEndPoint startScrollPoint </inst-vars> <class-inst-vars></class-inst-vars> <imports> CairoGraphics.* </imports> <category></category> <attributes> <package>TestDrive</package> </attributes> </class> <class> <name>TestDriver</name> <environment>Smalltalk</environment> <super>UI.ApplicationModel</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars>testDrive </inst-vars> <class-inst-vars></class-inst-vars> <imports> CairoGraphics.* </imports> <category></category> <attributes> <package>TestDrive</package> </attributes> </class> <methods> <class-id>TickingView class</class-id> <category>accessing</category> <body package="TestDrive" selector="installIn:">installIn: aDemoUI ^self subclassResponsibility</body> <body package="TestDrive" selector="label">label ^self subclassResponsibility</body> </methods> <methods> <class-id>TickingView class</class-id> <category>utilities</category> <body package="TestDrive" selector="addDisplayModeToMenuBuilder:for:">addDisplayModeToMenuBuilder: aMenuBuilder for: aDemoUI aMenuBuilder addLabel: self label value: [self installIn: aDemoUI]</body> </methods> <methods> <class-id>TickingView</class-id> <category>accessing</category> <body package="TestDrive" selector="outerContainer">outerContainer "Answer the Wrapper whose component can be exchanged by another TickingView. By default, this is the receiver's container. Subclasses may override this, e.g. for demonstrating the effect of wrapping the TickingView in a Wrapper." ^self container</body> </methods> <methods> <class-id>TickingView</class-id> <category>displaying</category> <body package="TestDrive" selector="setupTicking">setupTicking self isActivityTicking ifFalse: [self startActivityRate: 1000 / 40] "used to be 1000/40"</body> <body package="TestDrive" selector="renderBackgroundOn:">renderBackgroundOn: aCR self subclassResponsibility</body> <body package="TestDrive" selector="isQuartzAvailable">isQuartzAvailable ^'MacOSX' match: Screen default platformName</body> <body package="TestDrive" selector="isCairoAvailable">isCairoAvailable ^#{CairoGraphics.CairoContext} isDefined " and: [('MacOSX' match: Screen default platformName) not ] "</body> </methods> <methods> <class-id>TickingView</class-id> <category>extra activity</category> <body package="TestDrive" selector="activityTickEvent:">activityTickEvent: aTickEvent | times | self isOpen ifFalse: [^self stopActivity]. times := Array with: (nil) with: (Time millisecondsToRun: [self displayOn: self graphicsContext]) with: aTickEvent deltaTime * 1000. InputState default shiftDown ifTrue: [Transcript print: times; cr; endEntry]</body> </methods> <methods> <class-id>TickingView</class-id> <category>utilities</category> <body package="TestDrive" selector="addDisplayModeToMenuBuilder:for:">addDisplayModeToMenuBuilder: aMenuBuilder for: aDemoUI aMenuBuilder addLabel: 'Cairo' value: [aDemoUI doCairoBackend].</body> </methods> <methods> <class-id>TestDriver class</class-id> <category>interface specs</category> <body package="TestDrive" selector="windowSpec">windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: 'Unlabeled Canvas' #bounds: #(#{Graphics.Rectangle} 640 400 840 600 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.ArbitraryComponentSpec} #layout: #(#{Graphics.LayoutFrame} 2 0 2 0 -2 1 -2 1 ) #name: #ViewHolder1 #flags: 11 #component: #testDrive ) ) ) )</body> </methods> <methods> <class-id>TestDriver</class-id> <category>initialize-release</category> <body package="TestDrive" selector="initialize">initialize "Initialize a newly created instance. This method must answer the receiver." super initialize. " testDrive := TestDrivingView new model: self." "testDrive := View new model: self." ^self</body> </methods> <methods> <class-id>TestDriver</class-id> <category>accessing</category> <body package="TestDrive" selector="testDrive">testDrive testDrive isNil ifTrue: [testDrive := TestDrivingView new model: self]. ^testDrive</body> </methods> <methods> <class-id>TestDrivingView class</class-id> <category>accessing</category> <body package="TestDrive" selector="label">label " *** This method was defined by Maarten.TickingView class as a subclass responsibility. Replace its body with a proper implementation. *** " self error: 'Subclass responsibility stub not reimplemented'</body> <body package="TestDrive" selector="installIn:">installIn: aDemoUI " *** This method was defined by Maarten.TickingView class as a subclass responsibility. Replace its body with a proper implementation. *** " self error: 'Subclass responsibility stub not reimplemented'</body> </methods> <methods> <class-id>TestDrivingView</class-id> <category>controller accessing</category> <body package="TestDrive" selector="defaultController">defaultController | ctrl | ctrl := super defaultController. ctrl downBlock: [:pt | self downBlockWithPoint: pt]. ctrl upBlock: [:pt | self upBlockWithPoint: pt]. ctrl moveBlock: [:pt | self moveBlockWithPoint: pt]. ^ctrl</body> <body package="TestDrive" selector="defaultControllerClass">defaultControllerClass ^Smalltalk.Akamaru.BetterWidgetController</body> <body package="TestDrive" selector="downBlockWithPoint:">downBlockWithPoint: startPoint "Start drawing a new line when the <Select> button is pressed. Keep showing the crosshair when pressed." startVerticalScrollGrid := 0. strokeEndPoint := nil. startScrollPoint := startPoint</body> <body package="TestDrive" selector="moveBlockWithPoint:">moveBlockWithPoint: movingPoint | horizontalScrollGrid verticalScrollGrid | "endScrollPoint := movingPoint." horizontalScrollGrid := movingPoint x - startScrollPoint x. verticalScrollGrid := movingPoint y - startScrollPoint y. self container scroll: horizontalScrollGrid @ (verticalScrollGrid // 22)</body> <body package="TestDrive" selector="upBlockWithPoint:">upBlockWithPoint: endPoint "End drawing a new line when the <Select> button is released. Keep showing the crosshair when pressed." | | startScrollPoint := nil</body> </methods> <methods> <class-id>TestDrivingView</class-id> <category>displaying</category> <body package="TestDrive" selector="renderOn:">renderOn: aCR aCR strokeJoin: JoinStyle round. aCR strokeCap: CapStyle round. aCR pushGroup. self renderBackgroundOn: aCR. self draw: aCR. aCR popGroupToSource. aCR paint</body> <body package="TestDrive" selector="draw:">draw: aCR | aRectangle gradient | aCR sourceRed: 0.9 green: 0 blue: 0 alpha: 0.2. aRectangle := Rectangle origin: 100 @ 100 corner: 200 @ 200. gradient := RadialGradient from: aRectangle origin + (0 @ 4 negated) radius: 6 to: aRectangle origin + ((aRectangle width * 0.8) @ 0 negated) radius: 1. aCR sourcePattern: gradient. gradient addStopAt: 0 red: 0.07 green: 0.1 blue: 0.34. gradient addStopAt: 1 red: 0.45 green: 0.62 blue: 0.8. aRectangle := Rectangle origin: 100 @ 100 corner: 200 @ 200. aCR rectangle: aRectangle. aCR fill. aCR sourceRed: 0.9 green: 0 blue: 0 alpha: 0.2. aCR arcRotationStart: 0 sweep: Double pi centerX: 120 y: 120 radius: 100. aCR moveTo: self bounds origin. aCR lineTo: self bounds corner. aCR lineWidth: 10. aCR stroke. aCR sourceRed: 1 green: 0 blue: 0 alpha: 0.4; circleCenter: 100 @ 100 radius: 40; fillPreserve; sourceRed: 0.8 green: 0 blue: 0 alpha: 0.2; strokeWidth: 1; stroke</body> <body package="TestDrive" selector="displayOn:">displayOn: aGC Transcript show: 'CairoAvailable ' , self isCairoAvailable printString , ' Quartz Available ' , self isQuartzAvailable printString; cr. self isCairoAvailable ifFalse: [^self showNoCairoOn: aGC] ifTrue: [self setupTicking. "self renderOn: aGC myCairoContext " aGC newCairoContextWhile: [:cr | self renderOn: cr]]</body> <body package="TestDrive" selector="renderBackgroundOn:">renderBackgroundOn: aCR aCR sourceRed: 1 green: 1 blue: 1. aCR paint</body> <body package="TestDrive" selector="taskGradient:width:">taskGradient: aStart width: aWidth | gradient | gradient := RadialGradient from: aStart + (0 @ 4 negated) radius: 0 to: aStart + ((aWidth * 0.4) @ 0 negated) radius: 60. gradient addStopAt: 0 red: 0.85 green: 0.9 blue: 0.95 alpha:0.7. gradient addStopAt: 1 red: 0.3 green: 0.854 blue: 1 alpha:0.7. ^gradient</body> <body package="TestDrive" selector="showNoCairoOn:">showNoCairoOn: gc | fond textAttribute ca | gc paint: (ColorValue red: 0.79 green: 0.78 blue: 0.71). fond := TextAttributes default defaultFont copy. fond pixelSize: 24. ca := CharacterAttributes newWithDefaultAttributes. ca setDefaultQuery: fond. textAttribute := TextAttributes characterAttributes: ca. textAttribute baseline: 0. textAttribute alignment: 2. fond := gc fontPolicy findFont: fond. gc paint: ColorValue black. gc font: fond. (('GTK - Cairo Graphics libraries are not available' asComposedText textStyle: textAttribute) compositionWidth: 200; centered) displayOn: gc at: self bounds corner / 2</body> </methods> </st-source> _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |