PageRenderTime 312ms CodeModel.GetById 113ms app.highlight 9ms RepoModel.GetById 129ms app.codeStats 0ms

/src/ftk_bitmap.h

http://ftk.googlecode.com/
C++ Header | 104 lines | 57 code | 18 blank | 29 comment | 2 complexity | 4a468df154822bf5d4e99934a62f5bb5 MD5 | raw file
  1/*
  2 * File: ftk_bitmap.h    
  3 * Author:  Li XianJing <xianjimli@hotmail.com>
  4 * Brief:   Ftk bitmap
  5 *
  6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
  7 *
  8 * Licensed under the Academic Free License version 2.1
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or
 13 * (at your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program; if not, write to the Free Software
 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 23 */
 24
 25/*
 26 * History:
 27 * ================================================================
 28 * 2009-10-03 Li XianJing <xianjimli@hotmail.com> created
 29 *
 30 */
 31#ifndef FTK_BITMAP_H
 32#define FTK_BITMAP_H
 33
 34#include "ftk_typedef.h"
 35#include "ftk_log.h"
 36#include "ftk_allocator.h"
 37
 38FTK_BEGIN_DECLS
 39
 40struct _FtkBitmap;
 41typedef struct _FtkBitmap FtkBitmap;
 42
 43struct _FtkBitmap
 44{
 45	int ref;
 46	void* data;
 47	void* data1;
 48	void* data2;
 49	char priv[1];
 50};
 51
 52FtkBitmap* ftk_bitmap_create_with_native(void* bitmap);
 53FtkBitmap* ftk_bitmap_create(int w, int h, FtkColor clear_color);
 54void*      ftk_bitmap_get_native(FtkBitmap* thiz);
 55void ftk_bitmap_destroy(FtkBitmap* thiz);
 56FtkColor ftk_bitmap_get_pixel(FtkBitmap* thiz, int x, int y);
 57
 58int     ftk_bitmap_width(FtkBitmap* thiz);
 59int     ftk_bitmap_height(FtkBitmap* thiz);
 60FtkColor*  ftk_bitmap_lock(FtkBitmap* thiz);
 61void    ftk_bitmap_unlock(FtkBitmap* thiz);
 62void       ftk_bitmap_ref(FtkBitmap* thiz);
 63void       ftk_bitmap_unref(FtkBitmap* thiz);
 64void       ftk_bitmap_clear(FtkBitmap* thiz, FtkColor c);
 65Ret        ftk_bitmap_copy_from_bitmap(FtkBitmap* thiz, FtkBitmap* other);
 66
 67Ret ftk_bitmap_copy_from_data_bgr24(FtkBitmap* bitmap, 
 68	void* data, int dw, int dh, FtkRect* rect);
 69Ret ftk_bitmap_copy_to_data_bgr24(FtkBitmap* bitmap, FtkRect* rect, 
 70	void* data, int ox, int oy, int dw, int dh);
 71
 72Ret ftk_bitmap_copy_from_data_bgra32(FtkBitmap* bitmap, 
 73	void* data, int dw, int dh, FtkRect* rect);
 74Ret ftk_bitmap_copy_to_data_bgra32(FtkBitmap* bitmap, FtkRect* rect, 
 75	void* data, int ox, int oy, int dw, int dh);
 76
 77Ret ftk_bitmap_copy_from_data_argb32(FtkBitmap* bitmap, 
 78	void* data, int dw, int dh, FtkRect* rect);
 79Ret ftk_bitmap_copy_to_data_argb32(FtkBitmap* bitmap, FtkRect* rect, 
 80	void* data, int ox, int oy, int dw, int dh);
 81
 82Ret ftk_bitmap_copy_from_data_rgb565(FtkBitmap* bitmap, 
 83	void* data, int dw, int dh, FtkRect* rect);
 84Ret ftk_bitmap_copy_to_data_rgb565(FtkBitmap* bitmap, FtkRect* rect, 
 85	void* data, int ox, int oy, int dw, int dh);
 86
 87Ret ftk_bitmap_copy_from_data_rgba32(FtkBitmap* bitmap, 
 88	void* data, int dw, int dh, FtkRect* rect);
 89Ret ftk_bitmap_copy_to_data_rgba32(FtkBitmap* bitmap, FtkRect* rect, 
 90	void* data, int ox, int oy, int dw, int dh);
 91
 92typedef Ret (*FtkBitmapCopyFromData)(FtkBitmap* bitmap, 
 93	void* data, int dw, int dh, FtkRect* rect);
 94typedef Ret (*FtkBitmapCopyToData)(FtkBitmap* bitmap, FtkRect* rect, 
 95	void* data, int ox, int oy, int dw, int dh);
 96
 97#define FTK_BITMAP_UNREF(bitmap) if(bitmap != NULL) { ftk_bitmap_unref(bitmap); bitmap = NULL;}
 98
 99Ret ftk_bitmap_auto_test(void);
100
101FTK_END_DECLS
102
103#endif/*FTK_BITMAP_H*/
104