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
 Is it possible to insert thumbnail backgrounds?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Greg Lumley

South Africa
8 Posts

Posted - Jul 15 2012 :  12:47:53  Show Profile  Reply
Hi, I have an app whereby the user "marks" images.

I'd like to display "marked" images within the "all thumbs" overview.

I thought about changing the background if the image has been selected or perhaps I need to overlay an image over the existing thumbnail as it loads?

What would you advise and how would you go about it?

Thank you.

Greg.

Greg.

xequte

39053 Posts

Posted - Jul 16 2012 :  02:36:08  Show Profile  Reply
Hi Greg

Can you use the OnImageDraw even to apply your markings to the bitmap:

http://www.imageen.com/help/TImageEnMView.OnImageDraw.html



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

Greg Lumley

South Africa
8 Posts

Posted - Jul 16 2012 :  09:08:39  Show Profile  Reply
Hi Nigel, thank you!

Could you let me know how I could place a small icon in the same way... an example if you don't mind?

Please bear with me, I come from a PHP background so much of the "Draw" canvas methods are so new to me. I now realise just how little I actually know...

G

Greg.
Go to Top of Page

xequte

39053 Posts

Posted - Jul 18 2012 :  03:25:11  Show Profile  Reply
Hi Greg

How about something like this:


// Draws the specified bitmap onto another bitmap,
// if bTransparent is true then the bottom left pixel are used to determine the
// transparecny color
procedure DrawBitmapOntoImage(SourceBMP: TBitmap; // the bitmap to draw
                              DestCanvas: TCanvas;                  // the Canvas to draw onto
                              DestCanvasWidth: Integer;             // The width of the canvas we are drawing on
                              DestCanvasHeight: Integer;            // The Height of the canvas we are drawing on
                              iLeft: Integer;
                              iTop: Integer;                        // the position to draw SourceBMP
                              bTransparent: boolean); // if true then all pixels of the same color as the the bottom left pixel are drawn as transparen
var
  TempBMP : TBitmap;
  rctObject : Trect;
begin
  tempbmp := TBitmap.create;
  try
    RctObject := rect(iLeft,
                      iTop,
                      iLeft + SourceBMP.width,
                      iTop + SourceBMP.Height);

    // check that it doesn't extend beyond the end of the image
    if RctObject.right > DestCanvasWidth then
      RctObject.right := DestCanvasWidth;
    if RctObject.bottom > DestCanvasHeight then
      RctObject.bottom := DestCanvasHeight;

    TempBMP.width  := RctObject.right - RctObject.left;
    TempBMP.height := RctObject.bottom - RctObject.top;

    TempBMP.canvas.copymode := cmsrcCopy;
    TempBMP.canvas.copyrect(rect(0, 0, TempBMP.width, TempBMP.height), DestCanvas, RctObject);

    SourceBMP.width := RctObject.right - RctObject.left;
    SourceBMP.height := RctObject.bottom - RctObject.top;

    SourceBMP.transparent := bTransparent;

    TempBMP.canvas.Draw(0, 0, SourceBMP);

    if (bTransparent = false) then
      DestCanvas.copyrect(RctObject, SourceBMP.canvas, rect(0, 0, SourceBMP.width, SourceBMP.height))
    else
      DestCanvas.copyrect(RctObject, TempBMP.canvas, rect(0, 0, TempBMP.width, TempBMP.height));
  finally
    tempbmp.free;
  end;
end;


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