Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wbmp.h

Go to the documentation of this file.
00001 /* ==================================================================== 
00002  * The Kannel Software License, Version 1.0 
00003  * 
00004  * Copyright (c) 2001-2008 Kannel Group  
00005  * Copyright (c) 1998-2001 WapIT Ltd.   
00006  * All rights reserved. 
00007  * 
00008  * Redistribution and use in source and binary forms, with or without 
00009  * modification, are permitted provided that the following conditions 
00010  * are met: 
00011  * 
00012  * 1. Redistributions of source code must retain the above copyright 
00013  *    notice, this list of conditions and the following disclaimer. 
00014  * 
00015  * 2. Redistributions in binary form must reproduce the above copyright 
00016  *    notice, this list of conditions and the following disclaimer in 
00017  *    the documentation and/or other materials provided with the 
00018  *    distribution. 
00019  * 
00020  * 3. The end-user documentation included with the redistribution, 
00021  *    if any, must include the following acknowledgment: 
00022  *       "This product includes software developed by the 
00023  *        Kannel Group (http://www.kannel.org/)." 
00024  *    Alternately, this acknowledgment may appear in the software itself, 
00025  *    if and wherever such third-party acknowledgments normally appear. 
00026  * 
00027  * 4. The names "Kannel" and "Kannel Group" must not be used to 
00028  *    endorse or promote products derived from this software without 
00029  *    prior written permission. For written permission, please  
00030  *    contact org@kannel.org. 
00031  * 
00032  * 5. Products derived from this software may not be called "Kannel", 
00033  *    nor may "Kannel" appear in their name, without prior written 
00034  *    permission of the Kannel Group. 
00035  * 
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00039  * DISCLAIMED.  IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS 
00040  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,  
00041  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  
00042  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
00043  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
00044  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE  
00045  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,  
00046  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00047  * ==================================================================== 
00048  * 
00049  * This software consists of voluntary contributions made by many 
00050  * individuals on behalf of the Kannel Group.  For more information on  
00051  * the Kannel Group, please see <http://www.kannel.org/>. 
00052  * 
00053  * Portions of this software are based upon software originally written at  
00054  * WapIT Ltd., Helsinki, Finland for the Kannel project.  
00055  */ 
00056 
00057 #ifndef WBMP_H
00058 #define WBMP_H
00059 
00060 /* WBMP - Wireless Bitmap
00061  *
00062  * Kalle Marjola 1999 for WapIT Ltd.
00063  *
00064  * functions to store WBMPs and and create Octet strings from them
00065  */
00066 
00067 #include "gwlib/gwlib.h"
00068 
00069 
00070 /* extension header parameters... not implemented/supported in any WBMP
00071  * yet... but for future reference, although I'm quite sure there is
00072  * something wrong in these...
00073  */
00074 typedef struct extparam {
00075     Octet   bitfield;   /* if bitfield additional data */
00076     /* or */
00077     char    param[9];   /* parameter */
00078     char    value[17];  /* and associated value */
00079 } ExtParam;
00080     
00081 /* WBMP - wireless bitmap format
00082  *
00083  * structure to define wireless bitmap - not complete!
00084  */
00085 typedef struct wbmp {
00086     MultibyteInt        type_field;
00087     Octet           fix_header_field;
00088     /* extension header is a bit more complicated thing that what is
00089      * represented here but the spesification is a bit obfuscated one
00090      * and they are not yet used to anything, so it is left undefined
00091      */
00092     ExtParam        *ext_header_field;
00093     int         exthdr_count;   /* total # of ext headers */
00094     MultibyteInt    width;
00095     MultibyteInt    height;
00096     Octet       *main_image;
00097     Octet       **animated_image;
00098     int         animimg_count;  /* total # of animated images */
00099 } WBMP;
00100 
00101 /* create a new empty WBMP struct. Return a pointer to it or NULL if
00102  * operation fails
00103  */
00104 WBMP *wbmp_create_empty(void);
00105 
00106 
00107 /* delete given WBMP, including freeing the pixmap */
00108 void wbmp_delete(WBMP *pic);
00109 
00110 
00111 #define NEGATIVE    1   /* source has white=0, black=1 */
00112 #define REVERSE     2   /* source has righmost as most significant */
00113 
00114 /* create a new bitmap
00115  *
00116  * type: 0 (B/W, Uncompressed bitmap) WBMP - the only type currently
00117  *  specificated.
00118  *
00119  * width and height are size of the bitmap,
00120  * data is the entire bitmap; from left-top corner to righ-bottom;
00121  * if the width is not dividable by 8, the rest of the row is padded with
00122  * zeros. bytes are ordered big-endian
00123  *
00124  * target: black=0, white=1, most significant leftmost
00125  *
00126  * You can generate raw bitmap in Linux (RH 6.0) with following line:
00127  * %> convert -monochrome input_file target.mono
00128  *
00129  * ..which then requires flags REVERSE and NEGATIVE
00130  *
00131  * return pointer to created WBMP, or NULL if fails
00132  */
00133 WBMP *wbmp_create(int type, int width, int height, Octet *data, int flags);
00134 
00135 /* create Octet stream out of given WBMP
00136  * return the length of stream, *stream is set to new stream which must
00137  * be freed by the caller
00138  */
00139 int wbmp_create_stream(WBMP *pic, Octet **stream);
00140 
00141 
00142 #endif
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.