Board index » cppbuilder » Drawing on GIF or JPG image

Drawing on GIF or JPG image


2005-08-04 08:54:44 PM
cppbuilder2
I want to draw indicators on top of a background picture. This works if the
image loaded is a bitmap but if it is a jpg or gif image I cannot draw on
the image canvas.
The code is as follows for loading any type of image as a background
BackgroundImage->Picture->LoadFromFile(Name)
In a separate control, derived from a TImage, which is placed on top of the
Background Image I do the following
TRect Src;
...
Canvas->CopyMode = cmSrcCopy;
Canvas->CopyRect(ClientRect, BackgroundImage->Canvas, Src);
Then I do the necessary drawing to get my result, which works only with BMP
images.
EInvalidOperation 'Can only modify an image if it contains a bitmap' is
generated at the CopyRect.
Can anyone advise?
TIA
Ian
 
 

Re:Drawing on GIF or JPG image

"Ian Bromfield" < XXXX@XXXXX.COM >wrote in message
Quote
I want to draw indicators on top of a background picture. This works if
the image loaded is a bitmap but if it is a jpg or gif image I cannot draw
on the image canvas.
Load the picture internally, then copy it to a bitmap then write on the
bitmap.
HTH
Jonathan
 

Re:Drawing on GIF or JPG image

"Ian Bromfield" < XXXX@XXXXX.COM >wrote in message
Quote
Canvas->CopyRect(ClientRect, BackgroundImage->Canvas, Src);
The TImage::Canvas property is only valid for bitmaps. Try using Draw()
instead:
Canvas->Draw(ClientRect.Left, ClientRect.Top,
BackgroundImage->Picture->Graphic);
Gambit
 

{smallsort}