[DEMO] A screenshot of SDL + Cairo + Morph
Brian Rice
water at tunes.org
Sun Dec 4 16:40:50 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Dec 4, 2005, at 4:34 PM, Todd Fleming wrote:
> I fixed my refactored code and grabbed this screenshot:
>
> <moz-screenshot-1.jpg>
Sweet! :)
> This is generated by the following:
> morph@(ContextMorph traits) paint
> [
> inform: 'ContextMorph paint'.
>
> morph context `>> [
> sourceRGB: (Color r: 0 g: 0 b: 0).
> rectangle: (Rectangle origin: 0 , 0 extent: 640 , 480). fill.
>
> sourceRGB: (Color r: 1 g: 1 b: 1).
> rectangle: (Rectangle origin: 50 , 50 extent: 300 , 300).
> fill.
>
> sourceRGB: (Color r: 1 g: 0 b: 0).
> rectangle: (Rectangle origin: 100 , 100 extent: 100 , 100).
> fill.
>
> sourceRGB: (Color r: 0 g: 1 b: 0) alpha: 0.5.
> rectangle: (Rectangle origin: 150 , 150 extent: 100 , 100).
> fill.
>
> sourceRGB: (Color r: 0 g: 0 b: 1) alpha: 0.5.
> rectangle: (Rectangle origin: 200 , 200 extent: 100 , 100).
> fill.
>
> sourceRGB: (Color r: 1 g: 0 b: 0).
> rectangle: (Rectangle origin: 300 , 100 extent: 100 , 100).
> fill.
> lineWidth: 10. sourceRGB: (Color r: 0 g: 0 b: 1).
> rectangle: (Rectangle origin: 300 , 100 extent: 100 , 100).
> stroke.
>
> lineWidth: 5. sourceRGB: (Color r: 1 g: 1 b: 1).
> save.
> lineWidth: 10. sourceRGB: (Color r: 1 g: 0 b: 0).
> moveTo: 500, 100. lineTo: 600, 200. stroke.
> restore.
> moveTo: 500, 100. lineTo: 600, 200. stroke.
>
> sourceRGB: (Color r: 1 g: 0 b: 0).
> moveTo: 500, 400. lineTo: 550, 300. lineTo: 600, 400.
> lineTo: 500, 325. lineTo: 600, 325. closePath. stroke.
> sourceRGB: (Color r: 1 g: 1 b: 1).
> moveTo: 500, 400. lineTo: 550, 300. lineTo: 600, 400.
> lineTo: 500, 325. lineTo: 600, 325. fill.
> ].
> ].
That looks really good, idiomatically. Just a good example of
emulating Logo with a flexible-enough syntax. :)
Having to specify rgb so much is a little awkward. We do have named
colors in colors.slate, but they do use floating point. Perhaps we
can just do a simpler "Color Red" etc. for the simpler primary/
secondary palette with just integers, or just modify colors.slate for
the primaries and secondaries. (It was produced by running a quick
script over the X11 reference color set table, of course.)
- --
- -Brian
http://tunes.org/~water/brice.vcf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFDk4yXPVkAvLW1zf4RAuOaAJ9y4Hmtf92mhOlNeY6Bg35lDGwxtgCfeltk
zacwYYHVkHiu0d/5mCQVyTw=
=gbrO
-----END PGP SIGNATURE-----
More information about the Slate
mailing list