begin FSourceBMP.Assign(Value); if Zoom <> 1 then begin FBMP.Assign(FSourceBMP); FBMP.Width := Trunc(FSourceBMP.Width * Zoom); FBMP.Height := Trunc(FSourceBMP.Height * Zoom); Stretch(FBMP.Width, FBMP.Height ,sfBox,1,FSourceBMP,FBMP); end else FBMP.Assign(FSourceBMP); FImageAssigned := True; end;
here is a snippet using a Zoom variable to stretch with Aspect ratio. Its basically the same as TCanvas.stretch, but faster and far higher quality. There are a few options (sfBox, Triangle) etc for how it samples the pixels.. different ones get better results for Text, photo.. etc.. On Tue, Jan 19, 2010 at 10:53 AM, Kyley Harris <ky...@harrissoftware.com>wrote: > Sure.. gimme 5 minutes > i can email you the source too.. its open > > On Tue, Jan 19, 2010 at 10:31 AM, Conor Boyd <conor.b...@trimble.co.nz>wrote: > >> Can you post your example? Or another example? >> >> C. >> >> ------------------------------ >> *From:* delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] >> *On Behalf Of *John Bird >> *Sent:* Tuesday, 19 January 2010 9:46 a.m. >> *To:* NZ Borland Developers Group - Delphi List >> *Subject:* [DUG] Resizing images >> >> Resizing images for Images, bitButtons and icons - I guess we all do >> this. >> >> I have used IrfanView and Photofiltre for resizing images, and >> noticed they tend to alter the edge pixels around an image - I guess it >> averages the pixel colours on a sharp edge if resizing smaller. This is a >> problem with images with a background surround - these pixels are not the >> transparent background colour any more and create a ragged edge noticeable >> when the image is on a darker background. >> >> How do others resize images properly? >> >> >> >> (Example is the Analogue clock with the image background some are using- >> over a dark background you may see there are a fewer light pixels around the >> edge that shouldn't be there) >> >> >> John >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: delphi@delphi.org.nz >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: >> unsubscribe >> > > > > -- > Kyley Harris > Harris Software > +64-21-671-821 > -- Kyley Harris Harris Software +64-21-671-821
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe