ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Setting color for specific pixel in a layer using C++ builder
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

FTKS

5 Posts

Posted - Aug 09 2022 :  03:30:40  Show Profile  Reply
Hello ImageEn-Team,

I want to create a segmented bar in a layer, where each segnment is painted in a different color.

To do this I tried to paint each pixel of the specific layer in one color using the bitmap of image layers. For this I used to for loops for the size of the rectangle to paint:



ImageEnView1->CurrentLayer->Bitmap->PixelFormat = ie24RGB;
for (int x = 1; x < PixelWidthRec/2 ; x++)
{
    for (int y = 1; y < PixelHeightRec; y++)
    {
      ImageEnView1->CurrentLayer->Bitmap->Pixels_ie24RGB[x, y] = TColor2TRGB(clRed);      
    }
}


based on the example given in https://www.imageen.com/help/index.php?topic=TIEBitmap.Pixels. But this gives me the error message
 
[bcc32 mistake] E2034 converting from 'TRGB' to 'int' not possible

which stumped me tbh.

For testing purposes I tried reversing the equation to:

TColor TempColor = TRGB2TColor(ImageEnView1->CurrentLayer->Bitmap->Pixels_ie24RGB[x, y]);


which gave me the error message
 
[bcc32 Fehler]E2193 Not enough parameter to call '_fastcall TIEBitmap::GetPixels(int,int)'



Is approach correct and did I miss anything to get these error messages? And is there another way to color pixels in a layer?

With best regards

Stefan

xequte

38610 Posts

Posted - Aug 10 2022 :  00:29:27  Show Profile  Reply
Hi Stefan

How about if you just use:

ImageEnView1->CurrentLayer->Bitmap->Pixels_ie24RGB[x, y] = CreateRGB( 255, 0, 0 );

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

FTKS

5 Posts

Posted - Aug 10 2022 :  01:33:14  Show Profile  Reply
Hello Nigel,

thank you for your quick response.

I tried implementing your code, but this line still give the following error messages:

 

[bcc32 Fehler]E2034 converting from'TRGB' to 'int' not possible
[bcc32 Fehler]E2342 No Match of the parameter type 'y' ('int' expected, 'TRGB' received)
[bcc32 Fehler]E2193 Not enough parameter to call '_fastcall TIEBitmap::SetPixels_ie24RGB(int,int,TRGB)'


(These are just liberal translation from me)

With best regards

Stefan


Go to Top of Page

xequte

38610 Posts

Posted - Aug 16 2022 :  05:26:38  Show Profile  Reply
Sorry Stefan,

In a C++ multi-dimensional array, the item must be specified using multiple [][] instead of comma separated values. So the code should be:

ImageEnView1->CurrentLayer->Bitmap->Pixels_ie24RGB[x][y] = TColor2TRGB(clRed);


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: