base.hpp

Go to the documentation of this file.
00001 /* $Id: base.hpp 21782 2011-01-14 15:34:33Z frosch $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef BLITTER_BASE_HPP
00013 #define BLITTER_BASE_HPP
00014 
00015 #include "../spritecache.h"
00016 #include "../spriteloader/spriteloader.hpp"
00017 
00018 enum BlitterMode {
00019   BM_NORMAL,
00020   BM_COLOUR_REMAP,
00021   BM_TRANSPARENT,
00022 };
00023 
00027 class Blitter {
00028 public:
00029   struct BlitterParams {
00030     const void *sprite;      
00031     const byte *remap;       
00032 
00033     int skip_left, skip_top; 
00034     int width, height;       
00035     int sprite_width;        
00036     int sprite_height;       
00037     int left, top;           
00038 
00039     void *dst;               
00040     int pitch;               
00041   };
00042 
00043   enum PaletteAnimation {
00044     PALETTE_ANIMATION_NONE,           
00045     PALETTE_ANIMATION_VIDEO_BACKEND,  
00046     PALETTE_ANIMATION_BLITTER,        
00047   };
00048 
00053   virtual uint8 GetScreenDepth() = 0;
00054 
00058   virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
00059 
00069   virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) = 0;
00070 
00074   virtual Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
00075 
00084   virtual void *MoveTo(const void *video, int x, int y) = 0;
00085 
00093   virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
00094 
00102   virtual void DrawRect(void *video, int width, int height, uint8 colour) = 0;
00103 
00115   virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour) = 0;
00116 
00125   virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
00126 
00135   virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0;
00136 
00145   virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0;
00146 
00157   virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0;
00158 
00165   virtual int BufferSize(int width, int height) = 0;
00166 
00173   virtual void PaletteAnimate(uint start, uint count) = 0;
00174 
00179   virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
00180 
00184   virtual const char *GetName() = 0;
00185 
00189   virtual int GetBytesPerPixel() = 0;
00190 
00194   virtual void PostResize() { };
00195 
00196   virtual ~Blitter() { }
00197 };
00198 
00199 #endif /* BLITTER_BASE_HPP */

Generated on Fri Mar 4 21:36:57 2011 for OpenTTD by  doxygen 1.6.1