00001 /* liqbase 00002 * Copyright (C) 2008 Gary Birkett 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License version 2 00006 * as published by the Free Software Foundation. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 00018 /* 00019 * 00020 * Header for the liqimage bitmap class 00021 * 00022 */ 00023 #ifndef LIQIMAGE_H 00024 #define LIQIMAGE_H 00025 00026 00027 typedef struct liqimage // you might recognise this as deriving from the XVImage structure :) 00028 { 00029 unsigned int usagecount; 00030 int width; 00031 int height; 00032 int data_size; 00033 int num_planes; 00034 int *offsets; 00035 int *pitches; 00036 unsigned char *data; 00037 int dpix; 00038 int dpiy; 00039 void *XVImageSource; // set if this image is initialized from an XVImage structure (ie uses other memory) 00040 00041 } 00042 liqimage; 00043 00044 00045 //######################################################################### 00046 //######################################################################### 00047 //######################################################################### additional constructors 00048 //######################################################################### 00049 //######################################################################### 00050 liqimage * liqimage_cache_lookuponly(char *filename,int maxw,int maxh,int allowalpha); 00051 liqimage * liqimage_cache_getfile(char *filename,int maxw,int maxh,int allowalpha); 00052 void liqimage_cache_release(liqimage *self); 00053 00054 liqimage * liqimage_newatsize( int w,int h,int allowalpha); 00055 liqimage * liqimage_newfromfile( char *filename,int maxw,int maxh,int allowalpha); 00056 liqimage * liqimage_newfromfilejpeg( char *filename); 00057 liqimage * liqimage_newfromfilepng( char *filename,int allowalpha); 00058 00059 //######################################################################### 00060 //######################################################################### 00061 //######################################################################### standard object handling 00062 //######################################################################### 00063 //######################################################################### 00064 00065 liqimage * liqimage_new(); 00066 liqimage * liqimage_hold(liqimage *self); 00067 void liqimage_release(liqimage *self); 00068 void liqimage_free(liqimage *self); 00069 00070 //######################################################################### 00071 //######################################################################### 00072 //######################################################################### class methods 00073 //######################################################################### 00074 //######################################################################### 00075 00076 void liqimage_pagereset( liqimage *self); 00077 void liqimage_pagedefine( liqimage *self,int w,int h,int dpix,int dpiy,int hasalpha); 00078 void liqimage_pagedefinefromXVImage( liqimage *self,void *XvImagePtr,int dpix,int dpiy); 00079 //int liqimage_pageloadjpeg( liqimage *self,char * filename); 00080 int liqimage_pageloadjpeg( liqimage *self,char * filename,int maxw,int maxh); 00081 int liqimage_pageloadpng( liqimage *self,char * filename,int maxw,int maxh,int allowalpha); 00082 int liqimage_pageloadpng_memstream( liqimage *self,char * filename,char *srcdata, int srcsize,int maxw,int maxh,int allowalpha); 00083 00084 int liqimage_pagesavepng(liqimage *self,char * filename); 00085 #endif