sgdk: bmp.h Source File

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

bmp.h
Go to the documentation of this file.

    00001
    00022 #include "maths.h"
    00023 #include "vdp.h"
    00024 #include "pal.h"
    00025
    00026 #ifndef _BMP_H_
    00027 #define _BMP_H_
    00028
    00029
    00030 #define BMP_PLANWIDTH_SFT           planeWidthSft
    00031 #define BMP_PLANHEIGHT_SFT          planeHeightSft
    00032
    00036 #define BMP_PLANWIDTH               64
    00037
    00041 #define BMP_PLANHEIGHT              64
    00042
    00043 #define BMP_CELLWIDTH_SFT           5
    00044
    00048 #define BMP_CELLWIDTH               (1 << BMP_CELLWIDTH_SFT)
    00049
    00053 #define BMP_CELLHEIGHT              20
    00054 #define BMP_CELLWIDTHMASK           (BMP_CELLWIDTH - 1)
    00055
    00056 #define BMP_CELLXOFFSET             (((screenWidth >> 3) - BMP_CELLWIDTH) / 2)
    00057 #define BMP_CELLYOFFSET             (((screenHeight >> 3) - BMP_CELLHEIGHT) / 2)
    00058
    00059 #define BMP_XPIXPERTILE_SFT         3
    00060 #define BMP_YPIXPERTILE_SFT         3
    00061
    00065 #define BMP_XPIXPERTILE             (1 << BMP_XPIXPERTILE_SFT)
    00066
    00070 #define BMP_YPIXPERTILE             (1 << BMP_YPIXPERTILE_SFT)
    00071 #define BMP_XPIXPERTILEMASK         (BMP_XPIXPERTILE - 1)
    00072 #define BMP_YPIXPERTILEMASK         (BMP_YPIXPERTILE - 1)
    00073
    00074 #define BMP_WIDTH_SFT               (BMP_CELLWIDTH_SFT + BMP_XPIXPERTILE_SFT)
    00075
    00079 #define BMP_WIDTH                   (1 << BMP_WIDTH_SFT)
    00080
    00084 #define BMP_HEIGHT                  (BMP_CELLHEIGHT * BMP_YPIXPERTILE)
    00085 #define BMP_WIDTH_MASK              (BMP_WIDTH - 1)
    00086
    00087 #define BMP_PITCH_SFT               (BMP_CELLWIDTH_SFT + 2)
    00088
    00092 #define BMP_PITCH                   (1 << BMP_PITCH_SFT)
    00093 #define BMP_PITCH_MASK              (BMP_PITCH - 1)
    00094
    00099 #define BMP_GENBMP16_WIDTH(genbmp16)    ((genbmp16)[0])
    00100
    00104 #define BMP_GENBMP16_HEIGHT(genbmp16)   ((genbmp16)[1])
    00105
    00109 #define BMP_GENBMP16_PALETTE(genbmp16)  (&((genbmp16)[2]))
    00110
    00114 #define BMP_GENBMP16_IMAGE(genbmp16)    (&((genbmp16)[18]))
    00115
    00119 #define BMP_GETPIXEL(x, y)      BMP_getPixelFast(x, y)
    00120
    00124 #define BMP_SETPIXEL(x, y, col) BMP_setPixelFast(x, y, col)
    00125
    00126
    00127 #define BMP_BASETILEINDEX       TILE_USERINDEX
    00128
    00129 #define BMP_FB0TILEINDEX        BMP_BASETILEINDEX
    00130 #define BMP_FB1TILEINDEX        (BMP_BASETILEINDEX + (BMP_CELLWIDTH * BMP_CELLHEIGHT))
    00131
    00132 #define BMP_FB0ENDTILEINDEX     (BMP_FB0TILEINDEX + (BMP_CELLWIDTH * BMP_CELLHEIGHT))
    00133 #define BMP_FB1ENDTILEINDEX     (BMP_FB1TILEINDEX + (BMP_CELLWIDTH * BMP_CELLHEIGHT))
    00134
    00135 #define BMP_BASETILE            (BMP_BASETILEINDEX * 32)
    00136 #define BMP_FB0TILE             (BMP_FB0TILEINDEX * 32)
    00137 #define BMP_FB1TILE             (BMP_FB1TILEINDEX * 32)
    00138
    00139
    00159 typedef struct
    00160 {
    00161     u16 compression;
    00162     u16 w;
    00163     u16 h;
    00164     const Palette *palette;
    00165     const u8 *image;
    00166 } Bitmap;
    00167
    00178 typedef struct
    00179 {
    00180     Vect2D_s16 pt;
    00181     u16 col;
    00182 } Pixel;
    00183
    00196 typedef struct
    00197 {
    00198     Vect2D_s16 pt1;
    00199     Vect2D_s16 pt2;
    00200     u16 col;
    00201 } Line;
    00202
    00217 typedef struct
    00218 {
    00219     Vect2D_s16 pt1;
    00220     Vect2D_s16 pt2;
    00221     Vect2D_s16 pt3;
    00222     u16 col;
    00223 } Triangle;
    00224
    00225
    00229 extern u8 *bmp_buffer_read;
    00233 extern u8 *bmp_buffer_write;
    00234
    00235
    00259 void BMP_init(u16 double_buffer, VDPPlane plane, u16 palette, u16 priority);
    00266 void BMP_end();
    00273 void BMP_reset();
    00285 void BMP_setBufferCopy(u16 value);
    00310 u16 BMP_flip(u16 async);
    00311
    00316 void BMP_clear();
    00317
    00330 u8*  BMP_getWritePointer(u16 x, u16 y);
    00343 u8*  BMP_getReadPointer(u16 x, u16 y);
    00344
    00345
    00350 u16  BMP_hasFlipRequestPending();
    00355 void BMP_waitWhileFlipRequestPending();
    00360 u16  BMP_hasFlipInProgess();
    00366 void BMP_waitFlipComplete();
    00367
    00379 void BMP_drawText(const char *str, u16 x, u16 y);
    00391 void BMP_clearText(u16 x, u16 y, u16 w);
    00399 void BMP_clearTextLine(u16 y);
    00400
    00408 void BMP_showFPS(u16 float_display);
    00409
    00422 u8   BMP_getPixel(u16 x, u16 y);
    00435 u8   BMP_getPixelFast(u16 x, u16 y);
    00450 void BMP_setPixel(u16 x, u16 y, u8 col);
    00465 void BMP_setPixelFast(u16 x, u16 y, u8 col);
    00478  void BMP_setPixels_V2D(const Vect2D_u16 *crd, u8 col, u16 num);
    00491  void BMP_setPixelsFast_V2D(const Vect2D_u16 *crd, u8 col, u16 num);
    00501  void BMP_setPixels(const Pixel *pixels, u16 num);
    00511  void BMP_setPixelsFast(const Pixel *pixels, u16 num);
    00512
    00523 u16   BMP_clipLine(Line *l);
    00532 void BMP_drawLine(Line *l);
    00545 u16 BMP_isPolygonCulled(const Vect2D_s16 *pts, u16 num);
    00560 u16 BMP_drawPolygon(const Vect2D_s16 *pts, u16 num, u8 col);
    00561
    00582 void BMP_drawBitmapData(const u8 *data, u16 x, u16 y, u16 w, u16 h, u32 pitch);
    00605 u16 BMP_drawBitmap(const Bitmap *bitmap, u16 x, u16 y, u16 loadpal);
    00633 u16 BMP_drawBitmapScaled(const Bitmap *bitmap, u16 x, u16 y, u16 w, u16 h, u16 loadpal);
    00634
    00639 void BMP_loadBitmapData(const u8 *data, u16 x, u16 y, u16 w, u16 h, u32 pitch);
    00644 void BMP_loadBitmap(const Bitmap *bitmap, u16 x, u16 y, u16 loadpal);
    00649 void BMP_loadAndScaleBitmap(const Bitmap *bitmap, u16 x, u16 y, u16 w, u16 h, u16 loadpal);
    00650
    00655 void BMP_getBitmapPalette(const Bitmap *bitmap, u16 *pal);
    00656
    00681 void BMP_scale(const u8 *src_buf, u16 src_wb, u16 src_h, u16 src_pitch, u8 *dst_buf, u16 dst_wb, u16 dst_h, u16 dst_pitch);
    00682
    00683
    00684 #endif // _BMP_H_
    00685

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines