# base.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    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   BM_COLOUR_OPAQUE,
    00023   BM_SHADOW
    00024 };
    00025
    00029 class Blitter {
    00030 public:
    00031   struct BlitterParams {
    00032     const void *sprite;
    00033     const byte *remap;
    00034
    00035     int skip_left, skip_top;
    00036     int width, height;
    00037     int sprite_width;
    00038     int sprite_height;
    00039     int left, top;
    00040
    00041     void *dst;
    00042     int pitch;
    00043     uint hue;
    00044     uint m;
    00045   };
    00046
    00047   enum PaletteAnimation {
    00048     PALETTE_ANIMATION_NONE,
    00049     PALETTE_ANIMATION_VIDEO_BACKEND,
    00050     PALETTE_ANIMATION_BLITTER,
    00051   };
    00052
    00057   virtual uint8 GetScreenDepth() = 0;
    00058
    00062   virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
    00063
    00073   virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) = 0;
    00074
    00078   virtual Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
    00079
    00088   virtual void *MoveTo(const void *video, int x, int y) = 0;
    00089
    00097   virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
    00098
    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
    00198   virtual void PostResize() { };
    00199
    00200   virtual ~Blitter() { }
    00201 };
    00202
    00203 #endif /* BLITTER_BASE_HPP */