Ok. Let me start.
Excellent I want to learn. And I will ask cyrille to read all that. The first things is that we should get Rome working then we fix the api.
Rome/Athens adds variouls extension methods to classes which are involved with graphics. Here is one of them:
GradientFillStyle>>installOnRomePluginCanvas: aCanvas | colorStops i | colorStops := WordArray new: colorRamp size * 3. i := 0. colorRamp do: [:stop | colorStops at: (i:=i+1) put: (stop key * 65536.0) rounded. colorStops at: (i:=i+1) put: stop value privateRGB. colorStops at: (i:=i+1) put: stop value privateAlpha]. radial == true ifTrue: [ aCanvas primFillRadialGradientOriginX: origin x asFloat y: origin y asFloat directionX: direction x asFloat y: direction y asFloat normalX: self normal x asFloat y: self normal y asFloat colorStops: colorStops] ifFalse: [ aCanvas primFillLinearGradientOriginX: origin x asFloat y: origin y asFloat directionX: direction x asFloat y: direction y asFloat colorStops: colorStops]
Good: - a conversion method is context sensitive (it takes a canvas as an argument) Bad: - this conversion method will work only for Rome plugin and nothing else.
how to you see that?
This means, that if i'd want to use different canvas, i will need to add another method which will perform a conversion.
you lost me there. But I ;m sure that you will explain it to me :)
But this can be avoided, if we provide a generic canvas method to create a gradient fills. Then this method could be renamed to #installOnRomeCanvas: and implementation will consist of messages, sent to canvas to build a gradient fill.
do you have a sketch that I follow the example 100%
Another example:
asRomeFill , asRomeFont
- this is bad. Its not a context-sensitive. And therefore , an implementation of these methods assumes that it will provide the most suitable conversion of fill or font for Rome backend. But depending on backend, it may not be the case! So, all methods like this, should always use a canvas as argument and talk back to canvas to perform a conversion.
I see we need a factory and the canvas will play this role. Stef
Stef
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project