#Image Structures
6 messages in this thread
I'm trying to learn to program Image Structures in C. Can anyone tell me
the proper format for the "struct" and the proper format for the image
data. I want to start with something simple like a small square or a
circle (both filled and unfilled).
Thanks, Rodger
– via Whap!
Well, there are 2 parts to the Image structure.
The ImageData for the structure must reside in chip ram and consist of word
aligned bits (i.e. rounded up to the nearest double byte boundary). To get
something like a square we would have:
__chip USHORT idata[] = {
/* **** **** **.. …. */ 0xFFC0,
/* **.. …. **.. …. */ 0xC0C0,
/* **.. …. **.. …. */ 0xC0C0,
/* **.. …. **.. …. */ 0xC0C0,
/* **.. …. **.. …. */ 0xC0C0,
/* **.. …. **.. …. */ 0xC0C0,
/* **.. …. **.. …. */ 0xC0C0,
/* **** **** **.. …. */ 0xFFC0
};
Next you need the image structure itself. This does NOT have to be in chip
ram and can be simply declared as:
struct Image MyImage = {
0, 0, 10, 8, 1, /* Left, top, width, height, depth */
idata, /* Location of your image data in chip ram */
0, 0, NULL }; /* PlanePick, PlaneOnOff, Next Image */
Note that the width in this case is 10 because that is how large our data
is. The system will automatically skip to the next word to get the next
row of data.
John A. Toebes, VIII – via Whap!
Thanks John,
I see where I was going wrong. My width wasn't correct.
Rodger
– via Whap!
That reminds me of one difference I'd noticed under WB 2.0…examples of
the image structure (like in your previous message) which would look okay
under WB 1.3 ends up looking funny under WB 2.0. So what's going on? What
has been changed? (I know, I know, I'd have looked it up in the new RKM
set, but I'm still hunting for that Libraries book in the stores.)
— Angeli
My best guess would be color differences. Note that 1.3 and 2.0 have
switched the color schemes around.
John A. Toebes, VIII – via Whap!
Last I heard was that Addison-Wesley had run into a production
glitch, and the 3rd Ed. Libraries RKM won't be out till mid-March.