# base.hpp

Go to the documentation of this file.

    00001 /* $Id: base.hpp 15428 2009-02-09 02:57:15Z rubidium $ */
    00002
    00005 #ifndef BLITTER_BASE_HPP
    00006 #define BLITTER_BASE_HPP
    00007
    00008 #include "../spritecache.h"
    00009 #include "../spriteloader/spriteloader.hpp"
    00010 #include "../zoom_type.h"
    00011
    00012 enum BlitterMode {
    00013   BM_NORMAL,
    00014   BM_COLOUR_REMAP,
    00015   BM_TRANSPARENT,
    00016 };
    00017
    00021 class Blitter {
    00022 public:
    00023   struct BlitterParams {
    00024     const void *sprite;
    00025     const byte *remap;
    00026
    00027     int skip_left, skip_top;
    00028     int width, height;
    00029     int sprite_width;
    00030     int sprite_height;
    00031     int left, top;
    00032
    00033     void *dst;
    00034     int pitch;
    00035   };
    00036
    00037   enum PaletteAnimation {
    00038     PALETTE_ANIMATION_NONE,
    00039     PALETTE_ANIMATION_VIDEO_BACKEND,
    00040     PALETTE_ANIMATION_BLITTER,
    00041   };
    00042
    00043   typedef void *AllocatorProc(size_t size);
    00044
    00049   virtual uint8 GetScreenDepth() = 0;
    00050
    00054   virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
    00055
    00065   virtual void DrawColourMappingRect(void *dst, int width, int height, int pal) = 0;
    00066
    00070   virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
    00071
    00080   virtual void *MoveTo(const void *video, int x, int y) = 0;
    00081
    00089   virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
    00090
    00098   virtual void SetPixelIfEmpty(void *video, int x, int y, uint8 colour) = 0;
    00099
    00106   virtual void DrawRect(void *video, int width, int height, uint8 colour) = 0;
    00107
    00119   virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour) = 0;
    00120
    00129   virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
    00130
    00139   virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0;
    00140
    00149   virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0;
    00150
    00161   virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0;
    00162
    00169   virtual int BufferSize(int width, int height) = 0;
    00170
    00177   virtual void PaletteAnimate(uint start, uint count) = 0;
    00178
    00183   virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
    00184
    00188   virtual const char *GetName() = 0;
    00189
    00193   virtual int GetBytesPerPixel() = 0;
    00194
    00195   virtual ~Blitter() { }
    00196 };
    00197
    00198 #endif /* BLITTER_BASE_HPP */