Writing/Reading bitmap data

Started by
4 comments, last by programering 21 years ago

    

struct sequence_data    // the sequence data

{
   short nr_of_frames;     // number of frames in this sequence

   short *frame_indexes;   // an array of frame indexes

};



struct bitmap_data    // the bitmap data

{
   short nr_of_frames;   // number of frames in this bitmap

   SDL_Rect *frames;     // an array of rectangles in this bitmap

   short nr_of_sequences;   // number of sequences in this bitmap

   struct sequence_data *sequences;  // an array of sequences

   SDL_Surface bitmap;    // the image surface

};

    
Maybe it shall be called collection instead of bitmap? Can I store and get this data in/from a file? Anton Karlsson Klingis Entertainment Games with silly humor [edited by - programering on March 17, 2003 8:00:17 AM]
Advertisement
Not directly since the pointers wouldn''t make any sense when you loaded it in again.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
How does the SDL_Surface structure looks like?
How is the SDL_Surface structure built up, where''s the pointers in the SDL_Surface structure?
What SDL_Surface/Image data shall I then store in the file?

Anton Karlsson
Klingis Entertainment
Games with silly humor
Wait a minute. How did you get the values in the structure in the first place if you don''t know what they are? Anyway you can check the SDL headers for details of these structures.

I''d recommend not saving structures directly but recreating the steps you did to fill in the structure in the beginning.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
How shall I do then?

Also I was thinking about different color tables.

A number of different color tables.
Setting up the colors I use in the bitmap.

An example of this:

------color table 0:
color index/id: 0 = green
color index/id: 1 = red
color index/id: 2 = blue
color index/id: 3 = black

------color table 1:
color index/id: 0 = yellow
color index/id: 1 = red
color index/id: 2 = green
color index/id: 3 = black

And then the color index/id structure order in one bitmap frame:

0,3,1,3,2,0
0,1,3,2,3,0
0,1,2,3,2,0
0,1,3,2,1,0
0,3,2,1,2,0

It''s just an example.



Anton Karlsson
Klingis Entertainment
Games with silly humor
If it looks like this then?




    struct sequence_data{   // number of frames in this sequence   short nr_of_frames;    // an array of the bitmap rect indexes   short *frames;};  struct color_table{   // an array of color settings   Uint32 *table;};  struct image_data{   short width;   short height;    // an array of color id/index   // in a structure order   short *structure;};  struct bitmap_collection{   // number of bitmaps   short nr_of_bitmaps;    // an array of rectangles specifying   // the regions of the bitmaps   SDL_Rect *bitmaps;    // number of sequences   short nr_of_sequences;    // an array of sequences   struct sequence_data *sequences;    // number of colors in the whole image   short nr_of_colors;    // number of color tables   short nr_of_color_tables;    // an array of different color tables   struct color_table *colors;    // the image containing the bitmaps   struct image_data image;};  





Anton Karlsson
Klingis Entertainment
Games with silly humor

This topic is closed to new replies.

Advertisement