Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

bitmap.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  Bitmap
 Structure for in-memory bitmaps. More...

struct  BitmapFileHeader
 Compound structure for Windows .bmp files. More...


Defines

#define BLT_CLEAR   0
#define BLT_NOR   1
#define BLT_NOTAND   2
#define BLT_NOTCOPY   3
#define BLT_ANDNOT   4
#define BLT_NOT   5
#define BLT_XOR   6
#define BLT_NAND   7
#define BLT_AND   8
#define BLT_NEXOR   9
#define BLT_NOP   10
#define BLT_NOTOR   11
#define BLT_COPY   12
#define BLT_ORNOT   13
#define BLT_OR   14
#define BLT_SET   15
#define DPI2PPM(dpi)   ((100.0/2.54)*dpi)
#define PPM2DPI(ppm)   ((ppm/(100.0/2.54))
#define BMP_BGCOLOR   0x96ff00
#define BMP_FGCOLOR   0x182800

Typedefs

typedef Bitmap Bitmap
 Structure for in-memory bitmaps.


Functions

 typedef (BM_BlitFunc)(char *dst
char BM_GetPixel (Bitmap *bm, int x, int y)
 Get the color of the pixel located at (x,y).

void BM_PutPixel (Bitmap *bm, int x, int y, char color)
 Set or clear a pixel located at (x,y).

BitmapBM_Alloc (int w, int h)
 Allocate a Bitmap structure.

void BM_Free (Bitmap *bm)
 Free a Bitmap structure.

BitmapBM_Copy (Bitmap *bm)
 Copy a Bitmap.

void BM_Clear (Bitmap *bm, char pattern=0x00)
 Clear a Bitmap's bmBits.

void BM_Invert (Bitmap *bm)
 Invert all pixel of a Bitmap.

void BM_Scroll (Bitmap *bm, int dx, int dy)
 Scroll bitmap contents.

BitmapBM_Load (char *fn)
 Load a bitmap from a bmp file.

void BM_Save (Bitmap *bm, char *fn)
 Save a bitmap into a bmp file.

void BM_Blit (Bitmap *dst, int x, int y, Bitmap *src, int u=0, int v=0, int w=-1, int h=-1, int mode=BLT_COPY)
 Copy a region between two Bitmaps (with clipping).

void BM_FastBlit (Bitmap *dst, int x, int y, Bitmap *src, int u=0, int v=0, int w=-1, int h=-1, int mode=BLT_COPY)
 Copy a region between two Bitmaps (without clipping).


Variables

int dstwidth
int char * src
int char int srcwidth
int char int int width
int char int int int pages
int char int int int char shift
int char int int int char char fbm
int char int int int char
char char 
lbm
BM_BlitFunc BM_Blit_Copy
BM_BlitFunc BM_Blit_NotCopy
BM_BlitFunc BM_Blit_And
BM_BlitFunc BM_Blit_Nand
BM_BlitFunc BM_Blit_NotAnd
BM_BlitFunc BM_Blit_AndNot
BM_BlitFunc BM_Blit_Or
BM_BlitFunc BM_Blit_Nor
BM_BlitFunc BM_Blit_NotOr
BM_BlitFunc BM_Blit_OrNot
BM_BlitFunc BM_Blit_Xor
BM_BlitFunc BM_Blit_Nexor


Define Documentation

#define BLT_AND   8
 

Definition at line 15 of file bitmap.h.

#define BLT_ANDNOT   4
 

Definition at line 11 of file bitmap.h.

#define BLT_CLEAR   0
 

Definition at line 7 of file bitmap.h.

#define BLT_COPY   12
 

Definition at line 19 of file bitmap.h.

Referenced by GFX_ProgressBar().

#define BLT_NAND   7
 

Definition at line 14 of file bitmap.h.

#define BLT_NEXOR   9
 

Definition at line 16 of file bitmap.h.

#define BLT_NOP   10
 

Definition at line 17 of file bitmap.h.

#define BLT_NOR   1
 

Definition at line 8 of file bitmap.h.

#define BLT_NOT   5
 

Definition at line 12 of file bitmap.h.

#define BLT_NOTAND   2
 

Definition at line 9 of file bitmap.h.

#define BLT_NOTCOPY   3
 

Definition at line 10 of file bitmap.h.

#define BLT_NOTOR   11
 

Definition at line 18 of file bitmap.h.

#define BLT_OR   14
 

Definition at line 21 of file bitmap.h.

Referenced by GFX_Init().

#define BLT_ORNOT   13
 

Definition at line 20 of file bitmap.h.

#define BLT_SET   15
 

Definition at line 22 of file bitmap.h.

#define BLT_XOR   6
 

Definition at line 13 of file bitmap.h.

Referenced by GFX_ProgressBar().

#define BMP_BGCOLOR   0x96ff00
 

Definition at line 31 of file bitmap.h.

Referenced by BM_Save().

#define BMP_FGCOLOR   0x182800
 

Definition at line 32 of file bitmap.h.

Referenced by BM_Save().

#define DPI2PPM dpi       ((100.0/2.54)*dpi)
 

Definition at line 26 of file bitmap.h.

Referenced by BM_Save().

#define PPM2DPI ppm       ((ppm/(100.0/2.54))
 

Definition at line 27 of file bitmap.h.


Typedef Documentation

typedef struct Bitmap Bitmap
 

Structure for in-memory bitmaps.

This structure is somewhat special, because the bmBits do directly follow the width and height entries. So be careful, and use BM_Alloc/Free to handle Bitmap structures.

The reason behind this is, that the Bitmap structure and its bmBits can be adressed by using a single segment register.

bmBitsSize will will be set to the size of the bmBits part by BM_Alloc() (and should always be a multiple of two).


Function Documentation

Bitmap* BM_Alloc int    w,
int    h
 

Allocate a Bitmap structure.

Parameters:
w, h  width and height of bitmap
Returns:
Pointer to bitmap structure or NULL if out of memory.
Note:
The bitmap is not cleared for performance reasons. Do this by using BM_Clear().

Definition at line 44 of file bitmap.cpp.

References Bitmap::bmBitsSize, Bitmap::height, and Bitmap::width.

Referenced by BM_Copy(), BM_Load(), and gfxTest().

void BM_Blit Bitmap   dst,
int    x,
int    y,
Bitmap   src,
int    u,
int    v,
int    w,
int    h,
int    mode
 

Copy a region between two Bitmaps (with clipping).

Note:
This function does clipping, and is therefore quite inefficient for copying small regions. Don't use this to copy text, or other small bitmaps. Do the clipping yourself, and use the fastblt functions instead.
Parameters:
dst  pointer to destination Bitmap
x,y  destination coordinates
w,h  width and height in pixels
u,v  source coordinates
mode  blitmode (BLT_COPY, BLT_OR..)
Note:
source width [height] is used, if w [h] is set to -1.
implement overlapping region copies (by using a temporary bitmap).

Definition at line 335 of file bitmap.cpp.

References BM_FastBlit(), Bitmap::height, src, and Bitmap::width.

Referenced by BM_Scroll(), GFX_Print(), and gfxTest().

void BM_Clear Bitmap   bm,
char    pattern
 

Clear a Bitmap's bmBits.

Parameters:
bm  pointer to a Bitmap structure.
pattern  byte pattern to use.

Definition at line 104 of file bitmap.cpp.

References Bitmap::bmBits, and Bitmap::bmBitsSize.

Referenced by BM_Load(), BM_Scroll(), and gfxTest().

Bitmap* BM_Copy Bitmap   bm
 

Copy a Bitmap.

Parameters:
bm  pointer to bitmap to copy.
Returns:
pointer to copied bitmap, or NULL if out of memory.

Definition at line 66 of file bitmap.cpp.

References BM_Alloc(), Bitmap::bmBits, Bitmap::bmBitsSize, Bitmap::height, and Bitmap::width.

Referenced by BM_Scroll().

void BM_FastBlit Bitmap   dst,
int    x,
int    y,
Bitmap   src,
int    u,
int    v,
int    w,
int    h,
int    mode
 

Copy a region between two Bitmaps (without clipping).

Note:
This function does not do clipping. You'll have to take care of that yourself.
Parameters:
dst  pointer to destination Bitmap
x,y  destination coordinates
w,h  width and height in pixels
u,v  source coordinates
op  one of the BLT_XXX blitmode constants
Note:
source width [height] is used, if w [h] is set to -1.
This function doesn't handle overlapping source and destination regions (the blit does always start at the top-left corner).

Definition at line 398 of file bitmap.cpp.

References blitFuncs, Bitmap::bmBits, fbm, Bitmap::height, lbm, pages, shift, src, and Bitmap::width.

Referenced by BM_Blit(), and GFX_FillRect().

void BM_Free Bitmap   bm
 

Free a Bitmap structure.

BM_Free frees a Bitmap (and its bmBits) previously allocated by BM_Alloc.

Parameters:
bm  pointer to a Bitmap structure.
Note:
bmBits are only freed, if the pointer is non-null.

Definition at line 87 of file bitmap.cpp.

References Bitmap::bmBitsSize, Bitmap::height, and Bitmap::width.

Referenced by BM_Scroll(), and gfxTest().

char BM_GetPixel Bitmap   bm,
int    x,
int    y
[inline]
 

Get the color of the pixel located at (x,y).

Parameters:
bm  pointer to bitmap
x  x coordinate
y  y coordinate
Returns:
0 if pixel is cleared, != 0 if set

Definition at line 127 of file bitmap.h.

References Bitmap::bmBits, Bitmap::height, and Bitmap::width.

void BM_Invert Bitmap   bm
 

Invert all pixel of a Bitmap.

Parameters:
bm  pointer to a Bitmap structure.

Definition at line 115 of file bitmap.cpp.

References Bitmap::bmBits, and Bitmap::bmBitsSize.

Bitmap* BM_Load char *    fn
 

Load a bitmap from a bmp file.

This function allocates and loads a bitmap from a windows .bmp file. Only two color, uncompressed bitmaps are supported.

Parameters:
fn  filename to load.
Returns:
pointer to a Bitmap structure or NULL if an error occured.

Definition at line 183 of file bitmap.cpp.

References BitmapFileHeader::bfOffBits, BitmapFileHeader::bfType, BitmapFileHeader::biBitCount, BitmapFileHeader::biCompression, BitmapFileHeader::biHeight, BitmapFileHeader::biPlanes, BitmapFileHeader::biWidth, BM_Alloc(), BM_Clear(), Bitmap::bmBits, Bitmap::bmBitsSize, Bitmap::height, src, and Bitmap::width.

Referenced by gfxTest().

void BM_PutPixel Bitmap   bm,
int    x,
int    y,
char    color
[inline]
 

Set or clear a pixel located at (x,y).

Parameters:
bm  pointer to bitmap
x  x coordinate
y  y coordinate
color  color of the pixel. Either 0 or 1

Definition at line 147 of file bitmap.h.

References Bitmap::bmBits, Bitmap::height, and Bitmap::width.

Referenced by GFX_Circle(), and GFX_Line().

void BM_Save Bitmap   bm,
char *    fn
 

Save a bitmap into a bmp file.

This function saves a bitmap into a two-color, uncompressed windows .bmp file.

Parameters:
bm  Bitmap to save.
fn  filename to save to.

Definition at line 252 of file bitmap.cpp.

References BitmapFileHeader::bfOffBits, BitmapFileHeader::bfReserved1, BitmapFileHeader::bfReserved2, BitmapFileHeader::bfSize, BitmapFileHeader::bfType, BitmapFileHeader::biBitCount, BitmapFileHeader::biClrImportant, BitmapFileHeader::biClrUsed, BitmapFileHeader::biCompression, BitmapFileHeader::biHeight, BitmapFileHeader::biPlanes, BitmapFileHeader::biSize, BitmapFileHeader::biSizeImage, BitmapFileHeader::biWidth, BitmapFileHeader::biXPelsPerMeter, BitmapFileHeader::biYPelsPerMeter, Bitmap::bmBits, BMP_BGCOLOR, BMP_FGCOLOR, BitmapFileHeader::color0, BitmapFileHeader::color1, DPI2PPM, Bitmap::height, src, and Bitmap::width.

Referenced by gfxTest().

void BM_Scroll Bitmap   bm,
int    dx,
int    dy
 

Scroll bitmap contents.

Parameters:
bm  pointer to a Bitmap structure.
dx, dy  shift by (dx, dy) pixels.

Todo:
re-implement this function as an in-place move!

Definition at line 161 of file bitmap.cpp.

References BM_Blit(), BM_Clear(), BM_Copy(), and BM_Free().

typedef BM_BlitFunc   
 


Variable Documentation

BM_BlitFunc BM_Blit_And
 

Definition at line 110 of file bitmap.h.

BM_BlitFunc BM_Blit_AndNot
 

Definition at line 111 of file bitmap.h.

BM_BlitFunc BM_Blit_Copy
 

Definition at line 109 of file bitmap.h.

BM_BlitFunc BM_Blit_Nand
 

Definition at line 110 of file bitmap.h.

BM_BlitFunc BM_Blit_Nexor
 

Definition at line 114 of file bitmap.h.

BM_BlitFunc BM_Blit_Nor
 

Definition at line 112 of file bitmap.h.

BM_BlitFunc BM_Blit_NotAnd
 

Definition at line 111 of file bitmap.h.

BM_BlitFunc BM_Blit_NotCopy
 

Definition at line 109 of file bitmap.h.

BM_BlitFunc BM_Blit_NotOr
 

Definition at line 113 of file bitmap.h.

BM_BlitFunc BM_Blit_Or
 

Definition at line 112 of file bitmap.h.

BM_BlitFunc BM_Blit_OrNot
 

Definition at line 113 of file bitmap.h.

BM_BlitFunc BM_Blit_Xor
 

Definition at line 114 of file bitmap.h.

int dstwidth
 

Definition at line 101 of file bitmap.h.

int char int int int char char fbm
 

Definition at line 101 of file bitmap.h.

Referenced by BM_FastBlit(), and GFX_VLine().

int char int int int char char char lbm
 

Definition at line 101 of file bitmap.h.

Referenced by BM_FastBlit(), and GFX_VLine().

int char int int int pages
 

Definition at line 101 of file bitmap.h.

Referenced by BM_FastBlit(), GFX_VLine(), and printScratch().

int char int int int char shift
 

Definition at line 101 of file bitmap.h.

Referenced by BM_FastBlit().

int char* src
 

Definition at line 101 of file bitmap.h.

Referenced by AMD_StartDma(), BM_Blit(), BM_FastBlit(), BM_Load(), BM_Save(), BUF_Write(), GFX_FillRect(), hal_get_dma_info(), hal_start_dma(), HexDump(), LCD_Update(), packdomain(), REP_OUTSB(), REP_OUTSW(), and url_decode().

int char int srcwidth
 

Definition at line 101 of file bitmap.h.

int char int int width
 

Definition at line 101 of file bitmap.h.

Referenced by GFX_PrintAt(), GFX_Printf(), GFX_PrintfAt(), GFX_ProgressBar(), and GFX_TextWidth().


Generated on Sun Aug 4 21:47:30 2002 for k/os mp3v2 by doxygen1.2.16