[help] How can I get from an array of byte sized integers to a bitmap.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[help] How can I get from an array of byte sized integers to a bitmap.

Jerome Peace

[help] How can I get from an array of byte sized
integers to a bitmap.

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.

Has anyone solved this problem before?

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.

Anyone know of an easy and robust way to do this?

Yours in curiosity and service, --Jerome Peace




      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


Reply | Threaded
Open this post in threaded view
|

Re: [help] How can I get from an array of byte sized integers to a bitmap.

Herbert König
Hello Jerome,


JP> [help] How can I get from an array of byte sized
JP> integers to a bitmap.

I think this is a classical BitBlt. My problem are 800 FloatArrays,
each 300 entries.

BitBlt just has many many options. One rule is: one big BitBlt is
faster than many small BitBlts.

JP> I have an array of integers (all less than 255 ).
JP> I have a color form and a pallette for 255 colors.
JP> I have the number of columns and rows that the array
JP> represents.
JP> I want to create a bitmap to map the array onto its
JP> pallette. I'm not quite sure what the intervening
JP> steps are.

Right now i look into my code and I don't understand it in the time I
have. Sorry! But I have an Array of 256 Forms each representing a
possible shade of blue. That was necessary when a dot was bigger than
1@1 pixels.

But I know there are ways to fill a Form from an Array (ByteArray?) and
vice versa, search the list for storing an image in a method.

JP> Anyone know of an easy and robust way to do this?

I didn't find BitBlt easy but it's robust.

Cheers

Herbert                            mailto:[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: [help] How can I get from an array of byte sized integers to a bitmap.

Yoshiki Ohshima-2
In reply to this post by Jerome Peace
> 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