src/blitter/base.hpp
author bjarni
Thu, 19 Jun 2008 17:54:23 +0000
changeset 9561 f236daaaf93a
parent 9111 48ce04029fe4
child 9925 e6abeb1fc804
permissions -rw-r--r--
(svn r13584) -Fix: [OSX] Fixed issue where 10.5 failed to switch to fullscreen
This is done by selecting the 32bpp-anim blitter by default as it seems Apple removed some 8bpp support
Since this is done at runtime the same binary will still select 8bpp on 10.3 and 10.4
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
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8123
diff changeset
     3
/** @file base.hpp Base for all blitters. */
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8123
diff changeset
     4
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     5
#ifndef BLITTER_BASE_HPP
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     6
#define BLITTER_BASE_HPP
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     7
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     8
#include "../spritecache.h"
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
     9
#include "../spriteloader/spriteloader.hpp"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
    10
#include "../zoom_type.h"
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    11
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    12
enum BlitterMode {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    13
	BM_NORMAL,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    14
	BM_COLOUR_REMAP,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    15
	BM_TRANSPARENT,
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    16
};
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
/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    19
 * 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
    20
 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    21
class Blitter {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    22
public:
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    23
	struct BlitterParams {
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    24
		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
    25
		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
    26
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    27
		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
    28
		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
    29
		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
    30
		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
    31
		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
    32
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    33
		void *dst;               ///< Destination buffer
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    34
		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
    35
	};
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    36
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
    37
	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
    38
		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
    39
		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
    40
		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
    41
	};
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
    42
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    43
	typedef void *AllocatorProc(size_t size);
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    44
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
	 * 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
    47
	 *  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
    48
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    49
	virtual uint8 GetScreenDepth() = 0;
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
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    52
	 * 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
    53
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    54
	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
    55
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    56
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    57
	 * 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
    58
	 *  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
    59
	 *  on the screen again.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    60
	 * @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
    61
	 * @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
    62
	 * @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
    63
	 * @param pal the palette to use.
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
	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
    66
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    67
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    68
	 * 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
    69
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    70
	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
    71
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    72
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    73
	 * 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
    74
	 *  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
    75
	 * @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
    76
	 * @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
    77
	 * @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
    78
	 * @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
    79
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    80
	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
    81
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    82
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    83
	 * 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
    84
	 * @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
    85
	 * @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
    86
	 * @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
    87
	 * @param color A 8bpp mapping color.
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
	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
    90
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    91
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
    92
	 * 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
    93
	 * @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
    94
	 * @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
    95
	 * @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
    96
	 * @param color A 8bpp mapping color.
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
	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
    99
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   100
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   101
	 * 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
   102
	 * @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
   103
	 * @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
   104
	 * @param color A 8bpp mapping color.
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   105
	 */
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
   106
	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
   107
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   108
	/**
6948
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   109
	 * Draw a line with a given color.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   110
	 * @param video The destination pointer (video-buffer).
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   111
	 * @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
   112
	 * @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
   113
	 * @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
   114
	 * @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
   115
	 * @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
   116
	 * @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
   117
	 * @param color A 8bpp mapping color.
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   118
	 */
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   119
	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
   120
d7d326482813 (svn r10203) -Codechange: more moving things to blitter-layer: DrawLine
truelight
parents: 6947
diff changeset
   121
	/**
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   122
	 * 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
   123
	 * @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
   124
	 * @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
   125
	 * @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
   126
	 * @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
   127
	 * @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
   128
	 */
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
   129
	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
   130
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   131
	/**
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   132
	 * 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
   133
	 * @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
   134
	 * @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
   135
	 * @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
   136
	 * @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
   137
	 * @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
   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
	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
   140
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   141
	/**
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
   142
	 * 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
   143
	 * @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
   144
	 * @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
   145
	 * @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
   146
	 * @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
   147
	 * @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
   148
	 */
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
   149
	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
   150
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   151
	/**
6951
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   152
	 * Scroll the videobuffer some 'x' and 'y' value.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   153
	 * @param video The buffer to scroll into.
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   154
	 * @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
   155
	 * @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
   156
	 * @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
   157
	 * @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
   158
	 * @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
   159
	 * @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
   160
	 */
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   161
	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
   162
b24e0f108ede (svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
truelight
parents: 6948
diff changeset
   163
	/**
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   164
	 * 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
   165
	 * @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
   166
	 * @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
   167
	 * @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
   168
	 */
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   169
	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
   170
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
   171
	/**
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
	 * 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
   173
	 *  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
   174
	 * @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
   175
	 * @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
   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
	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
   178
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
	 * 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
   181
	 * @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
   182
	 */
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
   183
	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
   184
6989
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   185
	/**
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   186
	 * 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
   187
	 */
1768ca0091cb (svn r10245) -Codechange: added GetName also to all Blitters, instead of only the Factory
truelight
parents: 6985
diff changeset
   188
	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
   189
6937
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   190
	virtual ~Blitter() { }
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   191
};
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   192
40c760fcf1f6 (svn r10190) -Codechange: merged renderer and blitter to one single class API: blitter
truelight
parents:
diff changeset
   193
#endif /* BLITTER_BASE_HPP */