X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=gfx%2Fgfx_p.h;h=0df757187da4955bc47121800db47500d81eeb71;hb=6b2099c56772961182353617a8d4b839f6a1a6db;hp=5afc26e4321de175bf1d494293b5f4805b534752;hpb=59522a49bb5e019984284cc75a99b49a5e1c5f4e;p=bertos.git diff --git a/gfx/gfx_p.h b/gfx/gfx_p.h index 5afc26e4..0df75718 100755 --- a/gfx/gfx_p.h +++ b/gfx/gfx_p.h @@ -15,6 +15,15 @@ /*#* *#* $Log$ + *#* Revision 1.4 2006/03/22 09:50:37 bernie + *#* Use the same format for fonts and rasters. + *#* + *#* Revision 1.3 2006/02/15 09:10:15 bernie + *#* Implement prop fonts; Fix algo styles. + *#* + *#* Revision 1.2 2006/02/10 12:28:33 bernie + *#* Add font support in bitmaps; Make bitmap formats public. + *#* *#* Revision 1.1 2006/01/26 00:32:49 bernie *#* Graphics private header. *#* @@ -23,28 +32,23 @@ #ifndef GFX_GFX_P_H #define GFX_GFX_P_H -/** - * \name Known pixel formats for bitmap representation. - * \{ - */ -#define BITMAP_FMT_PLANAR_H_MSB 1 /**< Planar pixels, horizontal bytes, MSB left. */ -#define BITMAP_FMT_PLANAR_V_LSB 2 /**< Planar pixels, vertical bytes, LSB top. */ -/* \} */ #if CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_H_MSB - #define BM_ADDR(bm, x, y) ((bm)->raster + (y) * (bm)->stride + ((x) / 8)) - #define BM_MASK(bm, x, y) (1 << (7 - (x) % 8)) + #define RAST_ADDR(raster, x, y, stride) ((raster) + (y) * (stride) + (x) / 8) + #define RAST_MASK(raster, x, y) (1 << (7 - (x) % 8)) #elif CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_V_LSB - #define BM_ADDR(bm, x, y) ((bm)->raster + ((y) / 8) * (bm)->stride + (x)) - #define BM_MASK(bm, x, y) (1 << ((y) % 8)) - + #define RAST_ADDR(raster, x, y, stride) ((raster) + ((y) / 8) * (stride) + (x)) + #define RAST_MASK(raster, x, y) (1 << ((y) % 8)) #else #error Unknown value of CONFIG_BITMAP_FMT #endif /* CONFIG_BITMAP_FMT */ +#define BM_ADDR(bm, x, y) RAST_ADDR((bm)->raster, (x), (y), (bm)->stride) +#define BM_MASK(bm, x, y) RAST_MASK((bm)->raster, (x), (y)) + /*! * Plot a pixel in bitmap \a bm. * @@ -88,5 +92,7 @@ #define BM_READPIXEL(bm, x, y) \ ( *BM_ADDR(bm, x, y) & BM_MASK(bm, x, y) ? 1 : 0 ) +#define RAST_READPIXEL(raster, x, y, stride) \ + ( *RAST_ADDR(raster, x, y, stride) & RAST_MASK(raster, x, y) ? 1 : 0 ) #endif /* GFX_GFX_P_H */