On Mon, 6 Mar 2000, Carl G. Gruden wrote:
> > http://swiki.gsug.org:8888/color?ff0000
> Nice colored pixel Bert, it seems to create a 43byte .gif with a pixel
> having the color value specified in the url. (Nice to see that it is case
> insensitive.)
And there's yet more - if you leave out the ?... part you get a
transparent pixel ;-)
> I would be interested in peeking at the code.
I'll attach it:
swiki/default/addresses/color.book
* color parsing and response
* this might require the changes I posted in
searchprogress-bf.cs to make streaming response work
onepixelgif-bf.1.cs
* hard-coded (doesn't use GIFWriter) for speed
> By the way is there an English version of your Swiki for the German impaired
> folks on this list?
Not until someone volunteers to translate it - it's the discussion area of
the German (actually, the German-speaking) Smalltalkers, and thus it's
natural to use our native language.
However, it's still in beta (the "real" GSUG swiki is at port 8080), so
you can play with the features even if you don't understand a word. The
icons are the same. For example, the "colored pixel" address is used for
the progress bar in the search page so one can customize the color in the
settings file, rather than manually creating a new gif each time.
-Bert-
'From Squeak2.7 of 5 January 2000 [latest update: #1762] on 7 March 2000 at 9:32:25
am'!
"Change Set: onepixelgif-bf
Date: 18 February 2000
Author: Bert Freudenberg
Make a 1x1 GIF from a Color."!
!Color methodsFor: 'conversions' stamp: 'bf 2/18/2000 16:55'!
writeOnePixelGifOn:
aStream
"Write a 1x1 gif image onto aStream"
aStream nextPutAll: #(71 73 70 56
57 97 1 0 1 0 128 0 0).
#(privateRed privateGreen privateBlue) do:
[:c | aStream nextPut: (self perform: c) * 255 // ComponentMax].
aStream
nextPutAll: #(255 255 255 33 249 4 1 10 0 1 0 44 0 0 0 0 1 0 1 0 0 2 2).
self
isTransparent
ifTrue: [aStream nextPut: 76]
ifFalse: [aStream
nextPut: 68].
aStream nextPutAll: #(1 0 59 )! !
request
responseHeaderAt: 'Content-Type' put: MIMEDocument contentTypeGif;
success.
request formFields keys someElement in: [:col |
request stream
nextPutAll: (ByteArray streamContents: [:strm |
(col
ifNil: [Color transparent]
ifNotNil: [Color
r: ('16r0', col asUppercase) asNumber >> 16 \\ 256 / 255.0
g: ('16r0', col asUppercase) asNumber >> 8 \\ 256 / 255.0
b: ('16r0', col asUppercase) asNumber >> 0 \\ 256 / 255.0])
writeOnePixelGifOn: strm]) asString].
request stopResponse.
'Done'