From 4d64e4cd434426234a5c313c151cd79b6afc299e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Sat, 6 Jul 2002 17:50:18 +0000 Subject: *** empty log message *** svn path=/trunk/Framestein/; revision=27 --- Plugins/pixels.h | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Plugins/pixels.h (limited to 'Plugins/pixels.h') diff --git a/Plugins/pixels.h b/Plugins/pixels.h new file mode 100644 index 0000000..4dd1264 --- /dev/null +++ b/Plugins/pixels.h @@ -0,0 +1,117 @@ +// Easy iteration thru pixels, see green.cpp and tile.cpp for examples +// NOTE: using this class could be a bit slower than manipulating the bits directly.. +// +// changes to 0.20 +// - pixelformat-aware functions red() green() blue() and putrgb() +// - dot16() dot24() and dot32() added +// - get/put dot() removed, use above + +#include "plugin.h" + +#ifndef _PIXELSH +#define _PIXELSH + +class pixels +{ +private: + _frame m_f; + pixel8 *p8; // pointer to a row of 8-bit pixels + pixel16 *p16; + pixel24 *p24; + pixel32 *p32; + + __inline void updaterowp(); +public: + int x, y; + + pixels(const _frame &f) + { + m_f = f; + x = -1; + y = 0; + p8 = 0; + next(); + } + + __inline pixel8 dot8() { return p8[x]; } + __inline pixel16 dot16() { return p16[x]; } + __inline pixel24 dot24() { return p24[x]; } + __inline pixel32 dot32() { return p32[x]; } + + __inline void dot8(pixel8 c) { p8[x] = c; } + __inline void dot16(pixel16 c) { p16[x] = c; } + __inline void dot24(pixel24 c) { p24[x] = c; } + __inline void dot32(pixel32 c) { p32[x] = c; } + + __inline byte red(); + __inline byte green(); + __inline byte blue(); + + __inline void putrgb(byte r, byte g, byte b); + + __inline void moveto(int tox, int toy) + { if(tox