//--------------------------------------------------------------------------- #include #include //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl void SetPixel( TImage * const image, const int x, const int y, const unsigned char red, const unsigned char green, const unsigned char blue) { assert(image!=0 && "Image is NULL"); assert(image->Picture->Bitmap!=0 && "Bitmap is NULL"); assert(image->Picture->Bitmap->PixelFormat == pf32bit && "Bitmap must be 32 bit"); assert( x >= 0 && "x coordinat is below zero"); assert( y >= 0 && "y coordinat is below zero"); assert( x < image->Picture->Bitmap->Width && "x coordinat is beyond image width"); assert( y < image->Picture->Bitmap->Height && "y coordinat is beyond image height"); static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+2] = red; static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+1] = green; static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+0] = blue; } //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl void SetPixelClx( TImage * const image, const int x, const int y, const TColor color) { assert(image!=0 && "Image is NULL"); assert(image->Picture->Bitmap!=0 && "Bitmap is NULL"); assert(image->Picture->Bitmap->PixelFormat == pf32bit && "Bitmap must be 32 bit"); assert( x >= 0 && "x coordinat is below zero"); assert( y >= 0 && "y coordinat is below zero"); assert( x < image->Picture->Bitmap->Width && "x coordinat is beyond image width"); assert( y < image->Picture->Bitmap->Height && "y coordinat is beyond image height"); static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+2] = GetRValue(color); static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+1] = GetGValue(color); static_cast(image->Picture->Bitmap->ScanLine[y])[x*4+0] = GetBValue(color); }