src/blitter/base.hpp
author rubidium
Sun, 14 Oct 2007 19:57:15 +0000
changeset 7726 a9c8beebf2c1
parent 6989 1768ca0091cb
child 8121 3bc6351e7369
permissions -rw-r--r--
(svn r11261) -Codechange: Draw selection sprites (HT_RECT, HT_POINT, HT_RAIL) on foundations as ChildSprite of the foundation, not as single ParentSprite. Patch by frosch.
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     1
/* $Id$ */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     2
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     3
#ifndef BLITTER_BASE_HPP
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     4
#define BLITTER_BASE_HPP
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     5
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     6
#include "../spritecache.h"
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     7
#include "../spriteloader/spriteloader.hpp"
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     8
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     9
enum BlitterMode {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    10
	BM_NORMAL,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    11
	BM_COLOUR_REMAP,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    12
	BM_TRANSPARENT,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    13
};
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    14
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    15
/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    16
 * How all blitters should look like. Extend this class to make your own.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    17
 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    18
class Blitter {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    19
public:
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    20
	struct BlitterParams {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    21
		const void *sprite;      ///< Pointer to the sprite how ever the encoder stored it
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    22
		const byte *remap;       ///< XXX -- Temporary storage for remap array
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    23
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    24
		int skip_left, skip_top; ///< How much pixels of the source to skip on the left and top (based on zoom of dst)
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    25
		int width, height;       ///< The width and height in pixels that needs to be drawn to dst
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    26
		int sprite_width;        ///< Real width of the sprite
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    27
		int sprite_height;       ///< Real height of the sprite
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    28
		int left, top;           ///< The offset in the 'dst' in pixels to start drawing
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    29
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    30
		void *dst;               ///< Destination buffer
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    31
		int pitch;               ///< The pitch of the destination buffer
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    32
	};
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    33
6960
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    34
	enum PaletteAnimation {
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    35
		PALETTE_ANIMATION_NONE,           ///< No palette animation
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    36
		PALETTE_ANIMATION_VIDEO_BACKEND,  ///< Palette animation should be done by video backend (8bpp only!)
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    37
		PALETTE_ANIMATION_BLITTER,        ///< The blitter takes care of the palette animation
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    38
	};
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
    39
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    40
	typedef void *AllocatorProc(size_t size);
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    41
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    42
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    43
	 * Get the screen depth this blitter works for.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    44
	 *  This is either: 8, 16, 24 or 32.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    45
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    46
	virtual uint8 GetScreenDepth() = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    47
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    48
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    49
	 * Draw an image to the screen, given an amount of params defined above.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    50
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    51
	virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    52
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    53
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    54
	 * Draw a colortable to the screen. This is: the color of the screen is read
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    55
	 *  and is looked-up in the palette to match a new color, which then is put
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    56
	 *  on the screen again.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    57
	 * @param dst the destination pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    58
	 * @param width the width of the buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    59
	 * @param height the height of the buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    60
	 * @param pal the palette to use.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    61
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    62
	virtual void DrawColorMappingRect(void *dst, int width, int height, int pal) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    63
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    64
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    65
	 * Convert a sprite from the loader to our own format.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    66
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    67
	virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    68
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    69
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    70
	 * Move the destination pointer the requested amount x and y, keeping in mind
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    71
	 *  any pitch and bpp of the renderer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    72
	 * @param video The destination pointer (video-buffer) to scroll.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    73
	 * @param x How much you want to scroll to the right.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    74
	 * @param y How much you want to scroll to the bottom.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    75
	 * @return A new destination pointer moved the the requested place.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    76
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    77
	virtual void *MoveTo(const void *video, int x, int y) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    78
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    79
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    80
	 * Draw a pixel with a given color on the video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    81
	 * @param video The destination pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    82
	 * @param x The x position within video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    83
	 * @param y The y position within video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    84
	 * @param color A 8bpp mapping color.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    85
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    86
	virtual void SetPixel(void *video, int x, int y, uint8 color) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    87
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    88
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    89
	 * Draw a pixel with a given color on the video-buffer if there is currently a black pixel.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    90
	 * @param video The destination pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    91
	 * @param x The x position within video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    92
	 * @param y The y position within video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    93
	 * @param color A 8bpp mapping color.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    94
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    95
	virtual void SetPixelIfEmpty(void *video, int x, int y, uint8 color) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    96
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    97
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    98
	 * Make a single horizontal line in a single color on the video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    99
	 * @param video The destination pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   100
	 * @param width The lenght of the line.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   101
	 * @param color A 8bpp mapping color.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   102
	 */
6947
2e14760f63f9 (svn r10201) -Codechange: Replace Blitter::SetHorizontalLine with Blitter::DrawRect, as the former was only used by the rectangle drawing code anyway. This lets us draw rectangles in one go.
peter1138
parents: 6940
diff changeset
   103
	virtual void DrawRect(void *video, int width, int height, uint8 color) = 0;
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   104
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   105
	/**
6948
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   106
	 * Draw a line with a given color.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   107
	 * @param video The destination pointer (video-buffer).
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   108
	 * @param x The x coordinate from where the line starts.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   109
	 * @param y The y coordinate from where the line starts.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   110
	 * @param x2 The x coordinate to where the line goes.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   111
	 * @param y2 The y coordinate to where the lines goes.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   112
	 * @param screen_width The width of the screen you are drawing in (to avoid buffer-overflows).
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   113
	 * @param screen_height The height of the screen you are drawing in (to avoid buffer-overflows).
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   114
	 * @param color A 8bpp mapping color.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   115
	 */
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   116
	virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color) = 0;
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   117
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   118
	/**
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   119
	 * Copy from a buffer to the screen.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   120
	 * @param video The destionation pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   121
	 * @param src The buffer from which the data will be read.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   122
	 * @param width The width of the buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   123
	 * @param height The height of the buffer.
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   124
	 * @note You can not do anything with the content of the buffer, as the blitter can store non-pixel data in it too!
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   125
	 */
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   126
	virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   127
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   128
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   129
	 * Copy from the screen to a buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   130
	 * @param video The destination pointer (video-buffer).
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   131
	 * @param dst The buffer in which the data will be stored.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   132
	 * @param width The width of the buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   133
	 * @param height The height of the buffer.
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   134
	 * @note You can not do anything with the content of the buffer, as the blitter can store non-pixel data in it too!
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   135
	 */
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   136
	virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0;
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   137
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   138
	/**
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   139
	 * Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   140
	 * @param video The destination pointer (video-buffer).
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   141
	 * @param dst The buffer in which the data will be stored.
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   142
	 * @param width The width of the buffer.
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   143
	 * @param height The height of the buffer.
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   144
	 * @param dst_pitch The pitch (byte per line) of the destination buffer.
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   145
	 */
6985
d50d59dca7c1 (svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents: 6960
diff changeset
   146
	virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0;
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   147
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   148
	/**
6951
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   149
	 * Scroll the videobuffer some 'x' and 'y' value.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   150
	 * @param video The buffer to scroll into.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   151
	 * @param left The left value of the screen to scroll.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   152
	 * @param top The top value of the screen to scroll.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   153
	 * @param width The width of the screen to scroll.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   154
	 * @param height The height of the screen to scroll.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   155
	 * @param scroll_x How much to scroll in X.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   156
	 * @param scroll_y How much to scroll in Y.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   157
	 */
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   158
	virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0;
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   159
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   160
	/**
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   161
	 * Calculate how much memory there is needed for an image of this size in the video-buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   162
	 * @param width The width of the buffer-to-be.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   163
	 * @param height The height of the buffer-to-be.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   164
	 * @return The size needed for the buffer.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   165
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   166
	virtual int BufferSize(int width, int height) = 0;
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   167
6960
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   168
	/**
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   169
	 * Called when the 8bpp palette is changed; you should redraw all pixels on the screen that
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   170
	 *  are equal to the 8bpp palette indexes 'start' to 'start + count'.
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   171
	 * @param start The start index in the 8bpp palette.
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   172
	 * @param count The amount of indexes that are (possible) changed.
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   173
	 */
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   174
	virtual void PaletteAnimate(uint start, uint count) = 0;
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   175
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   176
	/**
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   177
	 * Check if the blitter uses palette animation at all.
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   178
	 * @return True if it uses palette animation.
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   179
	 */
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   180
	virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
356d856462b6 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 6951
diff changeset
   181
6989
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   182
	/**
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   183
	 * Get the naem of the blitter, the same as the Factory-instance returns.
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   184
	 */
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   185
	virtual const char *GetName() = 0;
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   186
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   187
	virtual ~Blitter() { }
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   188
};
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   189
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   190
#endif /* BLITTER_BASE_HPP */