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
 Help with Proc.CastColor

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
jwest Posted - Jul 10 2013 : 13:06:02
Hi,

I am drawing at runtime 18 rectangles in a IEBitMap of TImageEnVect component. Each rectangle is subdivided into 4 parts(rectangles).
I am not using Objects. I am using lineto, moveto and Rectangle methods.
I have to choose portions(rectangles) of any of them to paint at runtime.
I am trying:

procedure TForm5.ImageEnVect1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
with ImageEnVect1 do begin
BX := XScr2Bmp ( X );
BY := YScr2Bmp ( Y );
end;
RGBColor := TColor2TRGB ( clRed );
ImageEnVect1.Proc.CastColor ( BX, BY, RGBColor, 10);
end;

This works well when I click inside a rectangle part, but if I click out of a rectangle all ImageEnVect is painted.
When I click out of a rectangle, IŽd like no paint action.

I need paint only the rectangle portion clicked. Is there a way to do it without to use objects?

Thanks in advance,

Luiz
2   L A T E S T    R E P L I E S    (Newest First)
jwest Posted - Jul 11 2013 : 13:50:00
I will try it.

Thanks,

Luiz
w2m Posted - Jul 10 2013 : 15:32:46
I don't think there is a way around your problem because CastColor casts the pixel color biased on the colors around the cursor point and the tolerance value... so the key to figure this out is what colors to I want to allow filling?

If your backbround color is clWhite or some other specific color then you can get the color under the pixel with
iColorUnderCursor := TRGB2TColor(ImageEnView1.Layers[ImageEnView1.LayersCurrent].Bitmap.Pixels[BX, BY]);
if iColorUnderCursor <> clWhite then
begin
  ImageEnView1.Proc.CastColor(AX, AY, TColor2TRGB(clRed), 10);        
end
else
begin
  ShowMessage('The color being cast is white.  Can not cast white colors.');
end;

This of course will not permit filling inside the rectangle if the colors inside the rectangle is White. If the color under the mouse can be any color then this will not work of course and I do not know of a another way to proceed.

You can also draw your rectangle with a solid brush which would eliminate the need to castcolor all together. This is probably the best way to proceed, but your explanation does not describe enough of what you are trying to do to try to determine another approach.

I hope this helps.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html