View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

PluggableListMorph luminance error

by: L Sparks

When using the PluggableListMorph you will get an error if you attempt to pass in an InfiniteForm. For example:
myMorph := RectangleMorph new.
myMorph color: (InfiniteForm with: (GIFReadWriter formFromFileNamed: 'pics\mfbg.gif')).

This method works fine for most morphs. However, if you have this call on a RectangleMorph that has a PluggableListMorph associated with it then it will give you a luminance error.
for example the following code will error:
myMorph := RectangleMorph new.
myMorph color: (InfiniteForm with: (GIFReadWriter formFromFileNamed: 'pics\mfbg.gif')).
myPlugMorph := PluggableListMorph new.
myMorph addMorph: myPlugMorph.

or if you do:
myMorph := RectangleMorph new.
myPlugMorph := PluggableListMorph new.
myMorph addMorph: myPMorph.
myPlugMorph color: (InfiniteForm with: (GIFReadWriter formFromFileNamed: 'pics\mfbg.gif')).

if you created the file as a color that you wanted to use what you can do is create that color with the Color class. The way to go about this is either creating a temporary color instance or create a method that returns an instance of the color and add it to the Color class or to your own class. I added it to my own class for fileOut purposes at turn in. The code for my method is as follows:
silver
"returns a silver color"
^ Color
r: 0.87
g: 0.87
b: 0.87.

The way the rgb works is that it is a percentage of the 255. So if the color has a red factor of 121 then take 121/255 and that is your percentage.
Hopefully this will help you avoid headaches with the PluggableListMorph.

Link to this Page