c语言实现的bitmap,功能可用,已经过测试,如果需要其他操作(字节序转换、清空等),可自行添加。
大家可在此下载源代码:下载源代码
/* bitmap.h
*
* Copyright (C) 2013, 2013 chashen. All Rights Reserved.
* Written by chashen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _BITMAP_H_
#define _BITMAP_H_
typedef struct tagBitmap
{
unsigned int uiMemSize; /* bitmap所占内存大小,不包括本头部 */
unsigned int uiMaxBitID; /* 最大有效位 */
unsigned char aucPtr[0]; /* bitmap数据区 */
}BITMAP_S;
BITMAP_S *Bitmap_Create(unsigned int uiMaxBitID);
void Bitmap_Destroy(BITMAP_S *pstBitmap);
void Bitmap_Set(BITMAP_S *pstBitmap, unsigned int uiPos);
void Bitmap_Reset(BITMAP_S *pstB