BitmapSequence Struct Reference

Inheritance diagram for BitmapSequence

Inheritance graph


Public Methods

struct BitmapSequence* BitmapSequence_ctor (struct BitmapSequence *ptr_bitmap_sequence)
struct BitmapSequence* BitmapSequence_ctor_Ex (struct BitmapSequence *ptr_bitmap_sequence, char *file_name)
void BitmapSequence_dtor (struct BitmapSequence *ptr_bitmap_sequence, int memory_flag)
int BitmapSequence_get_size (struct BitmapSequence *ptr_bitmap_sequence)
struct BitmapBitmapSequence_get_bitmap (struct BitmapSequence *ptr_bitmap_sequence, int bitmap_index)
bool BitmapSequence_load (struct BitmapSequence *ptr_bitmap_sequence, struct Input *input)
bool BitmapSequence_store (struct BitmapSequence *ptr_bitmap_sequence, struct Output *output)


Detailed Description

While the Bitmap structure above is used for working with a single bitmapped image, the BitmapSequence is used for working with a Bitmap array. To create a BitmapSequence object, you must use the BitmapSequence_ctor function.

Use the BitmapSequence_dtor function to release the created object by after you work with it. To receive the bitmap object from the bitmap sequence, use the BitmapSequence_get_bitmap function.

The BitmapSequence get size function determines the number of bitmap objects in the BitmapSequence object you can receive. Bitmap structure operations with streams are designated the same way. They are implemented in the BitmapSequence_load and BitmapSequence_store functions.

Please pay special attention to the examples for these functions.

See also:
Bitmaps and Bitmap Sequences


Member Function Documentation

struct BitmapSequence * BitmapSequence_ctor ( struct BitmapSequence * ptr_bitmap_sequence )
 

Simple BitmapSequence constructor.
Creates an empty bitmap sequence.

Parameters:
ptr_bitmap_sequence   A pointer to the BitmapSequence structure
Returns:
A pointer to the initialized BitmapSequence object
   #include <cybiko.h>
     ...
     struct BitmapSequence bmps;
     BitmapSequence_ctor( &bmps );
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );
See also:
BitmapSequence_ctor_Ex.

struct BitmapSequence * BitmapSequence_ctor_Ex ( struct BitmapSequence * ptr_bitmap_sequence,
char * file_name )
 

This is the extended version of the BitmapSequence_ctor function.
It allows you to use a resource for creating a BitmapSequence object.

Parameters:
ptr_bitmap_sequence   A pointer to the BitmapSequence structure
file_name   A name of file, where BitmapSequense's data were stored
Returns:
A pointer to the initialized BitmapSequence object
   #include <cybiko.h>
     ...
     struct BitmapSequence bmps;
     BitmapSequence_ctor_Ex( &bmps, "MyFont.pic" );
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );
See also:
BitmapSequence_ctor.

void BitmapSequence_dtor ( struct BitmapSequence * ptr_bitmap_sequence,
int memory_flag )
 

Destructor.
This function deletes the BitmapSequence object.

Parameters:
ptr_bitmap_sequence   A pointer to the initialized BitmapSequence object
memory_flag   Can be FREE_MEMORY or LEAVE_MEMORY. If the memory was allocated for the object by malloc(), use FREE_MEMORY to free it. If the object was static or allocated in stack
Returns:
None
   #include <cybiko.h>
     ...
     struct BitmapSequence bmps;
     BitmapSequence_ctor_Ex( &bmps, "MyFont.pic" );
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );
See also:
FREE_MEMORY, LEAVE_MEMORY.

struct Bitmap * BitmapSequence_get_bitmap ( struct BitmapSequence * ptr_bitmap_sequence,
int bitmap_index )
 

Returns a pointer on the Bitmap object that has the 'bitmap_index' index.

Parameters:
ptr_bitmap_sequence   A pointer to the BitmapSequence object
bitmap_index   The bitmap index in the BitmapSequence structure
Returns:
A pointer to the Bitmap object that has the 'bitmap_index' index
   #include <cybiko.h>
     ...
     struct BitmapSequence bmps;
     struct Bitmap * ptr_bmp_symbol_A;
     BitmapSequence_ctor_Ex( &bmps , "font_1.pic" );
     ...
     ptr_bmp_symbol_A = BitmapSequence_get_bitmap( &bmps, 0 );
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );

int BitmapSequence_get_size ( struct BitmapSequence * ptr_bitmap_sequence )
 

Returns the number of bitmaps in a BitmapSequence object.

Parameters:
ptr_bitmap_sequence   A pointer to the initialized BitmapSequence object
Returns:
The number of bitmaps in the BitmapSequence object
   #include <cybiko.h>
     ...
     struct BitmapSequence bmps;
     BitmapSequence_ctor_Ex( &bmps, "MyFont.pic" );
     ...
     TRACE( "%d symbols in this font", BitmapSequence_get_size( &bmps ) );
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );

bool BitmapSequence_load ( struct BitmapSequence * ptr_bitmap_sequence,
struct Input * input )
 

Loads the bitmap sequence from an opened stream.

Parameters:
ptr_bitmap_sequence   A pointer to the BitmapSequence object
input   A pointer to the Input stream
Returns:
TRUE if bitmap sequence was loaded successfully
   #include <cybiko.h>
     ...
     struct Input * ptr_input;
     struct BitmapSequence bmps;
     ...
     // Your make file must have the archive resource "bmp.pic" linked by filer.exe.
     // For an example, see the Cybiko Compiler's Introduction Section.
     ptr_input = open_resource_Ex( "font_1.pic" );
     ...
     if( !BitmapSequence_load( &bmps, ptr_input ) )
     {
        ...
     }
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );
     Input_dtor( ptr_input, FREE_MEMORY );
See also:
BitmapSequence_store.

bool BitmapSequence_store ( struct BitmapSequence * ptr_bitmap_sequence,
struct Output * output )
 

Stores a bitmap sequence to an opened stream.

Parameters:
ptr_bitmap_sequence   A pointer to the BitmapSequence object
output   A pointer to the Output stream
Returns:
TRUE if the bitmap sequence was stored successfully
   #include <cybiko.h>
     ...
     struct Output * ptr_output;
     bool fBmp_store;
     struct BitmapSequence bmps;
     struct module_t main_module;
     ...
     init_module( &main_module ); // Application module initialization
     ...
     BitmapSequence_ctor( &bmps );
     ...
     // Your make file must have the archive resource "bmp.pic" linked by filer.exe.
     // For an example, see the Cybiko Compiler's Introduction Section.
     ptr_output = Archive_open_write_Ex( main_module.m_process->module->archive, "font_1.pic" );
     fBmp_store = BitmapSequence_store( &bmps, ptr_output );
     ...
     BitmapSequence_dtor( &bmps, LEAVE_MEMORY );
     Output_dtor( ptr_output, FREE_MEMORY );
See also:
BitmapSequence_load.