[help] How can I get from an array of byte sized integers to a
bitmap.
Yoshiki Ohshima
yoshiki at vpri.org
Tue Jan 29 22:20:23 UTC 2008
> I have an array of integers (all less than 255 ).
> I have a color form and a pallette for 255 colors.
> I have the number of columns and rows that the array
> represents.
> I want to create a bitmap to map the array onto its
> pallette. I'm not quite sure what the intervening
> steps are.
This description is very vague, I have to say.
- Is the array of integers actually an Array object?
- The "palette" is Bitmap, yes?
- What are the number of columns and rows? What are inside?
> Has anyone solved this problem before?
For example, in the OLPC image,
SugarLibrary>>imageFor:color:grayOutColor: has some obscure logic to
recolor a form. This may be different but I have a hunch that this
may be somewhat similar. Especially #hackBits: will be your weapon.
(Also, see Bitmap>>asByteArray, etc.)
> The application I have will essentially update the
> array over time and I wish to display it visually. I
> would like to do it in a time efficient way rather
> than pixel by pixel.
>
> I've looked at the options in the image and I am not
> sure which ones are right.
>
> Ideally once the color form is set up I should be able
> to update it just by updating the bitmap from the
> array periodically.
BitBlt can do a lot of stuff. I'm almost sure that you can find the
right operations on right data array type.
-- Yoshiki
More information about the Squeak-dev
mailing list
|