base.hpp

00001 /* $Id: base.hpp 11684 2007-12-23 10:56:02Z rubidium $ */
00002 
00003 #ifndef BLITTER_BASE_HPP
00004 #define BLITTER_BASE_HPP
00005 
00006 #include "../spritecache.h"
00007 #include "../spriteloader/spriteloader.hpp"
00008 #include "../zoom_type.h"
00009 
00010 enum BlitterMode {
00011   BM_NORMAL,
00012   BM_COLOUR_REMAP,
00013   BM_TRANSPARENT,
00014 };
00015 
00019 class Blitter {
00020 public:
00021   struct BlitterParams {
00022     const void *sprite;      
00023     const byte *remap;       
00024 
00025     int skip_left, skip_top; 
00026     int width, height;       
00027     int sprite_width;        
00028     int sprite_height;       
00029     int left, top;           
00030 
00031     void *dst;               
00032     int pitch;               
00033   };
00034 
00035   enum PaletteAnimation {
00036     PALETTE_ANIMATION_NONE,           
00037     PALETTE_ANIMATION_VIDEO_BACKEND,  
00038     PALETTE_ANIMATION_BLITTER,        
00039   };
00040 
00041   typedef void *AllocatorProc(size_t size);
00042 
00047   virtual uint8 GetScreenDepth() = 0;
00048 
00052   virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
00053 
00063   virtual void DrawColorMappingRect(void *dst, int width, int height, int pal) = 0;
00064 
00068   virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
00069 
00078   virtual void *MoveTo(const void *video, int x, int y) = 0;
00079 
00087   virtual void SetPixel(void *video, int x, int y, uint8 color) = 0;
00088 
00096   virtual void SetPixelIfEmpty(void *video, int x, int y, uint8 color) = 0;
00097 
00104   virtual void DrawRect(void *video, int width, int height, uint8 color) = 0;
00105 
00117   virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color) = 0;
00118 
00127   virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
00128 
00137   virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0;
00138 
00147   virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0;
00148 
00159   virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0;
00160 
00167   virtual int BufferSize(int width, int height) = 0;
00168 
00175   virtual void PaletteAnimate(uint start, uint count) = 0;
00176 
00181   virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
00182 
00186   virtual const char *GetName() = 0;
00187 
00188   virtual ~Blitter() { }
00189 };
00190 
00191 #endif /* BLITTER_BASE_HPP */

Generated on Mon Sep 22 20:34:14 2008 for openttd by  doxygen 1.5.6