Article View: alt.comp.borland-delphi
Article #647Re: Canvas.PIXLES Problems...
From: Michael Jervis
Date: Tue, 04 Jan 2000 00:00
Date: Tue, 04 Jan 2000 00:00
83 lines
3553 bytes
3553 bytes
Meant Pixels. Code is same except it's Pixels[x,y] not point(x,y). Sorry -- Michael Jervis: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ mike@skinmaster.co.uk http://www.skinmaster.co.uk Michael Jervis <mjervis@hughesrae.co.uk> wrote in message news:3871bc45.0@news.myratech.net... > 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:
<84them$4nt$1@gxsn.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3871bc45.0@news.myratech.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a296,761ad309370abca6 X-Google-Attributes: gid10a296,public X-Google-Thread: 105ac8,761ad309370abca6 X-Google-Attributes: gid105ac8,public X-Google-Thread: f894d,761ad309370abca6 X-Google-Attributes: gidf894d,public X-Google-Thread: fd817,761ad309370abca6 X-Google-Attributes: gidfd817,public From: "Michael Jervis" <mjervis@freenetname.co.uk> Subject: Re: Canvas.PIXLES Problems... Date: 2000/01/04 Message-ID: <84them$4nt$1@gxsn.com> X-Deja-AN: 568268190 References: <3871bc45.0@news.myratech.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@gxsn.com X-Trace: 947013910 1NNUCNF1GE940C393C gxsn.com Organization: GXSN X-MSMail-Priority: Normal Newsgroups: alt.comp.borland-delphi,alt.comp.lang.borland-delphi,borland.public.delphi,borland.public.delphi.graphics