Aggiunte funzione per istanziare una XI_BITMAP dalle risorse
git-svn-id: svn://10.65.10.50/trunk@5790 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ec6f8ee4af
commit
7f16a46079
@ -39,6 +39,26 @@ xi_bitmap_create( char *filename, XI_BITMAP_MODE mode )
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
XI_BITMAP *
|
||||
xi_bitmap_create_res( short id, XI_BITMAP_MODE mode )
|
||||
{
|
||||
XI_BITMAP *bitmap;
|
||||
|
||||
bitmap = XinMemoryZeroAlloc( sizeof( XI_BITMAP ) );
|
||||
if ( id != 0 )
|
||||
{
|
||||
bitmap->xin_bitmap = XinBitmapReadRes( id );
|
||||
if ( bitmap->xin_bitmap == NULL )
|
||||
{
|
||||
XinMemoryFree( bitmap );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
bitmap->mode = mode;
|
||||
bitmap->ref_count = 1;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
XI_BITMAP *
|
||||
xi_bitmap_copy( XI_BITMAP * bitmap )
|
||||
{
|
||||
|
23
xi/xiport.c
23
xi/xiport.c
@ -5054,6 +5054,29 @@ XinBitmapRead( char *filename )
|
||||
/*START*/
|
||||
}
|
||||
|
||||
/*START*/
|
||||
/*
|
||||
this function allocates, and reads a bitmap from the resource file.
|
||||
*/
|
||||
XinBitmap *
|
||||
XinBitmapReadRes( short id)
|
||||
{
|
||||
/*END*/
|
||||
XVT_IMAGE image;
|
||||
XinBitmap *bitmap;
|
||||
|
||||
if ( ( image = xvt_res_get_image( id ) ) == NULL )
|
||||
return NULL;
|
||||
bitmap = XinMemoryAlloc( sizeof( XinBitmap ) );
|
||||
bitmap->image = image;
|
||||
if ( xin_palette == NULL )
|
||||
xin_palette = xvt_palet_create( XVT_PALETTE_USER, NULL );
|
||||
xvt_palet_add_colors_from_image( xin_palette, bitmap->image );
|
||||
xvt_vobj_set_palet( SCREEN_WIN, xin_palette );
|
||||
return bitmap;
|
||||
/*START*/
|
||||
}
|
||||
|
||||
/*
|
||||
this function returns the width and height of the
|
||||
specified bitmap.
|
||||
|
@ -818,6 +818,7 @@ extern "C"
|
||||
/* Bitmaps */
|
||||
void XinBitmapDestroy( XinBitmap * bitmap );
|
||||
XinBitmap *XinBitmapRead( char *filename );
|
||||
XinBitmap *XinBitmapReadRes( short id );
|
||||
void XinBitmapSizeGet( XinBitmap * bitmap, short *pwidth, short *pheight );
|
||||
|
||||
/* Printing */
|
||||
|
Loading…
x
Reference in New Issue
Block a user