Article View: alt.comp.borland-delphi
Article #646Canvas.Point Problems...
From: Michael Jervis
Date: Tue, 04 Jan 2000 00:00
Date: Tue, 04 Jan 2000 00:00
69 lines
3030 bytes
3030 bytes
I am trying to create an image from one bitmap and a template, of which I am
copying only the parts that are NOT a certain colour.
Only it doesn't work.
I have an object MonoSterSkin, which represents a bitmap image of a certain
size for a part of a winamp skins. It has 3 methods. Save, Set and
AddTemplate. It has a private variable of type TBitmap.
The Save method just uses the SaveToFileMethod of the TBitmap (DestImage).
The Set Method uses the TBitmap.Create; method to create the DestImage:
DestImage := TBitmap.Create;
Then Sizes the bitmap to the dimensions fo the winamp skin element
(monoster.bmp).
The Set method is passed a bitmap object from which it copies two portions
to two places in destimage.
DestImage.Canvas.CopyRect(SrcRect, theSource.Canvas, DestRect);
(possibly got src and dest the wrong way round here!)
This works fine, and I can then save the image and it looks right, having 4
sub rectangles made from 2 rectangles of theSOurce tiled in a certain way.
So I am adding the addTemplate method. This takes a file name of a bitmap
file that is one pixel wider than the DestImage bitmap.
I read out the bottom right corner's colour:
theColour := Template.Canvas.Point(maxx, maxy);
theColour is a Tcolor, and seems to get set fine. Template is another
TBitmap, and loads from the file.
Then I do:
For x:=0 to 54 do begin
For y:=0 to 22 do begin
If Template.Canvas.Point(x,y) <> theColour then
DestImage.Canvas.Point(x,y) := Template.Canvas.Point(x,y);
end;
end;
i.e. trying to step through each point, copying it if it is not that
bitmap's transparent colour.
Only nothing seems to change on the DestImage when it is saved out. I have
tried a DestImage.Canvas.FillRect(10,10,20,20); and that doesn't seem to
change it either.
Stepping through that method IS reached and executed and the bitmap IS
saved.
Any ideas? is there some property of the Pen, Brush or Canvas that could
upset this process?
Thanks
--
Michael Jervis:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Internet Developer Morse Hughes Rae
mjervis@hughesrae.co.uk
Hughes Rae: http://www.hughesrae.co.uk
Morse: http://www.morse.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<3871bc45.0@news.myratech.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f894d,761ad309370abca6,start X-Google-Attributes: gidf894d,public X-Google-Thread: 105ac8,761ad309370abca6,start X-Google-Attributes: gid105ac8,public X-Google-Thread: fd817,761ad309370abca6,start X-Google-Attributes: gidfd817,public X-Google-Thread: 10a296,761ad309370abca6,start X-Google-Attributes: gid10a296,public From: "Michael Jervis" <mjervis@hughesrae.co.uk> Subject: Canvas.Point Problems... Date: 2000/01/04 Message-ID: <3871bc45.0@news.myratech.net> X-Deja-AN: 568144575 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: alt.comp.borland-delphi,alt.comp.lang.borland-delphi,borland.public.delphi,borland.public.delphi.graphics X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211