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
 Is it possible to insert thumbnail backgrounds?

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
Greg Lumley Posted - Jul 15 2012 : 12:47:53
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.
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jul 18 2012 : 03:25:11
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
Greg Lumley Posted - Jul 16 2012 : 09:08:39
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.
xequte Posted - Jul 16 2012 : 02:36:08
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