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
 How to remove a drawn Border from thumbnail?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Jul 09 2016 :  07:53:45  Show Profile  Reply
Hello,

I am using following code to draw border around thumbnails:
iemPhotos.SelectedImage := j;
iemPhotos.IEBitmap.Canvas.Pen.Color := TRGB2TColor(CreateRGB(0, 255, 0));
iemPhotos.IEBitmap.Canvas.Pen.Width := 7;
iemPhotos.IEBitmap.Canvas.Brush.Style := bsClear;
iemPhotos.IEBitmap.Canvas.Rectangle(1, 1, iemPhotos.IEBitmap.Width, iemPhotos.IEBitmap.Height);

Now if I want to remove this border how can I do it?

TIA


Yogi Yang

w2m

USA
1990 Posts

Posted - Jul 09 2016 :  15:27:47  Show Profile  Reply
Your code paints the bitmap pixels so there is no way that I know of to remove the border unless you use save undo and undo or replace the bitmap with a copy of the original bitmap. If the border was painted on a transparent layer, then if could be removed if the layer is deleted.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38616 Posts

Posted - Jul 09 2016 :  17:42:58  Show Profile  Reply
Yes, you would be better to paint to the canvas in one of the draw events.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

yogiyang

India
727 Posts

Posted - Jul 13 2016 :  06:23:05  Show Profile  Reply
Hello,

But I am using ImageEnMView.

Is it possible to save undo for each thumbnail?

I could not find Draw Event.

And I am highlighting the images that are Portrait by drawing a border around them.

Is there any other way to highlight images of interest in ImageEnMView?

TIA


Yogi Yang
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jul 13 2016 :  09:13:58  Show Profile  Reply
Just look in the events in the help file:
// Display the image index and sizes on bottom of the thumbnail
// Ensure you have set the BottomGap property
procedure TForm1.ImageEnMView1ImageDraw(Sender: TObject; idx: Integer; Left, Top: Integer; Canvas: TCanvas);
begin
  with canvas do
  begin
    Font.Height := 15;
    Font.Color := clWhite;
    TextOut(Left, Top + imageenmview1.ThumbHeight - imageenmview1.bottomgap + 2, IntToStr(idx));
    TextOut(Left, Top, IntToStr(imageenmview1.ImageWidth[idx]) + 'x' + IntToStr(imageenmview1.ImageHeight[idx]));
  end;
end;

Declaration
property OnImageDraw2: TIEImageDraw2Event;

Description
Occurs whenever an image is painted. Same as OnImageDraw but includes ImageRect to return the thumbnail rectangle.

Here is some code that draws a rect around the thumbnail if the thumbnail height is > thumbnail height (Portrait).

procedure TForm1.ImageEnMView1ImageDraw(Sender: TObject; idx, Left, Top: Integer; Canvas: TCanvas);
{Draw a green rect if the thumbnail is portrait}
var
  iWidth: integer;
  iHeight: integer;
begin
  iWidth := ImageEnMView1.ImageOriginalWidth[idx];
  iHeight :=  ImageEnMView1.ImageOriginalHeight[idx];
  if iHeight > iWidth then
  with Canvas do
  begin
    Pen.Color := TRGB2TColor(CreateRGB(0, 255, 0));
    Pen.Width := 4;
    Brush.Style := bsClear;
    Canvas.Rectangle(Left, Top, Left + ImageEnMView1.ThumbWidth, Top + ImageEnMView1.ThumbHeight);
  end;
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

yogiyang

India
727 Posts

Posted - Jul 13 2016 :  10:44:23  Show Profile  Reply
Thanks Bill.

I will look into this.

Actually I was searching for Draw event and it is ImageDraw event.

How stupid of me.


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: