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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 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

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
FTKS Posted - Aug 09 2022 : 03:30:40
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 16 2022 : 05:26:38
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
FTKS Posted - Aug 10 2022 : 01:33:14
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


xequte Posted - Aug 10 2022 : 00:29:27
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