41 #if defined(TARGET_HOST_WIN32) || defined(TARGET_HOST_WINCE) 57 unsigned int col32 = nColor | (nColor<<16);
58 unsigned int* dst = (
unsigned int*)
getPixels();
89 int nSx0,
int nSy0,
int nSx1,
int nSy1,
93 sx0 = nSx0, sy0 = nSy0, sx1 = nSx1, sy1 = nSy1,
94 dx0 = nX, dy0 = nY, dx1 = nX+nSx1-nSx0, dy1 = nY+nSy1-nSy0;
99 const unsigned short* src = nImage->
getPixels();
103 { sx0 += -dx0; dx0 = 0; }
105 { sy0 += -dy0; dy0 = 0; }
112 int w = sx1-sx0, h = sy1-sy0,
x,
y;
115 dst += dy0*
width + dx0;
120 memcpy(dst, src, 2*w);
153 Image::fillRect(
int nX0,
int nY0,
int nX1,
int nY1,
int nRed,
int nGreen,
int nBlue,
int nOpacity)
159 Image::fillRect(
int nX0,
int nY0,
int nX1,
int nY1,
unsigned short nColor,
int nOpacity)
166 int w,w0 = nX1-nX0, h = nY1-nY0;
167 unsigned short* dst = (
unsigned short*)
getPixels();
169 dst += nX0 + nY0*
width;
212 { dx = x2 - x1; incx = 1; }
214 { dx = x1 - x2; incx = -1; }
217 { dy = y2 - y1; incy = 1; }
219 { dy = y1 - y2; incy = -1; }
221 int offset = y*
width + x,
223 incyBuf = incy*
width;
229 pixels[offset] = color;
241 pixels[offset] = color;
244 y += incy; offset += incyBuf;
248 x += incx; offset += incxBuf;
250 pixels[offset] = color;
259 pixels[offset] = color;
262 x += incx; offset += incxBuf;
266 y += incy; offset += incyBuf;
268 pixels[offset] = color;
277 pixels[y*
width + x] = col;
290 if(nOwner && nPixels==
NULL)
291 nPixels =
new unsigned short[nWidth*nHeight];
292 return new Image(nWidth, nHeight, nPixels, nOwner);
void setPixel(int x, int y, unsigned short col)
Sets a pixel.
int getHeight() const
Returns the height of the image.
void drawLine(int x1, int y1, int x2, int y2, unsigned short col)
Renders a straight line from x1/y1 to x2/y1 with the color 'col'.
void drawImage(int nX, int nY, const Image *nImage, int nSx0, int nSy0, int nSx1, int nSy1, bool nTransparent=false)
Draws another bitmap inside this bitmap.
static Image * createFromPixelBuffer(int nWidth, int nHeight, unsigned short *nPixels, bool nOwner)
Creates an Image object directly from a pixel buffer.
void fillRect(int nX0, int nY0, int nX1, int nY1, int nRed, int nGreen, int nBlue, int nTransparency=0)
Fills a rectangle with the given color ans transparency.
TFSIMD_FORCE_INLINE const tfScalar & y() const
unsigned short getColorKey() const
void clear(int nRed, int nGreen, int nBlue)
Clears the bitmap with the given RGB color.
void setPixels(int nWidth, int nHeight, unsigned short *nPixels, bool nPixelsOwner)
Sets a new pixel buffer.
TFSIMD_FORCE_INLINE const tfScalar & x() const
Image(int nWidth, int nHeight, unsigned short *nPixels, bool nPixelsOwner)
int getWidth() const
Returns the width of the image.
TFSIMD_FORCE_INLINE const tfScalar & w() const
The Image class provides basic RGB565 image handing capabilities.
unsigned short * getPixels()
Returns the pixel buffer.