Re: Resizing an image
2007-05-31 23:29:21 GMT
Hi Michael,
I am still confused.
I cannot figure out how to get the FPImage drawn. I thought perhaps the TImage.canvas.draw() function would do it - the code completion shows a draw(int, int, FPCustomImage) method, but when I compile it the compiler says it it expects a TGraphic. Sure enough, the TCanvas has one that expects TGraphic, and FPCanvas has one with FPCustomImage, but it is not marked as overloaded, so I think the compiler assumes it is not available.
I tried to find a way to get a TGraphic object from a FPCustomImage, but no success.
Thanks again for the help.
Charl
Ah, that would probably explain why I can't find it.![]()
Yeah, I want to keep a cache of images in memory while keeping open the possibility of actually saving the cache. Thanks for the help!
CharlOn 5/31/07, Michael Van Canneyt <michael <at> freepascal.org > wrote:
On Thu, 31 May 2007, Charl van Jaarsveldt wrote:
> Thanks for the pointers. I can't find the extinterpolation unit though.
in the FPC source tree:
packages/fcl-image/src/extinterpolation.pp
(it may not be present if you're working with the the 2.0.4 release)
>
> I think I am getting an idea of how to do what I want. The only thing that
> eludes me is how to get the FPImage into the TImage control? The class
> hierarchy seems rather confusing there.
If you just want to draw it, simply draw on the TImage canvas, that should work.
But TImage itself has resizing capabilities, the imgview demo shows how
to do this. The disadvantage is that you can't save the resized image,
as far as I know.
Michael.
>
> Thanks
> Charl
>
> PS Please excuse my ignorance, this is the first time I am working with
> images!
>
> On 5/31/07, Michael Van Canneyt <michael <at> freepascal.org> wrote:
> >
> >
> >
> > On Thu, 31 May 2007, Charl van Jaarsveldt wrote:
> >
> > > Hi,
> > >
> > > What is the best way to resize an image? I am thinking of something
> > Java's
> > > Image class has that will return a scaled image, and you can decide
> > whether
> > > it should be a good quality or a fast one. I don't necessarily want to
> > write
> > > it to a file, just in memory. (I want to cache images in the memory and
> > so
> > > would like to have them much smaller than they are.)
> >
> > There are several resizing alogirthms present in FPC. see the
> > extinterpolation unit.
> > how it happens is: create a canvas, and draw the image on the canvas with
> > the correct
> > interpolation.
> >
> > If you want to create a new image in memory, create an TFPImageCanvas with
> > the desired
> > size, and draw the original canvas with the correct interpolation routine.
> >
> > Michael.
> >
> > _________________________________________________________________
> > To unsubscribe: mail lazarus-request <at> miraclec.com with
> > "unsubscribe" as the Subject
> > archives at http://www.lazarus.freepascal.org/mailarchives
> >
>
>
>
> --
> "I love deadlines. I especially love the whooshing sound they make as they
> fly by." - Douglas Adams
>
_________________________________________________________________
To unsubscribe: mail lazarus-request <at> miraclec.com with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
--
"I love deadlines. I especially love the whooshing sound they make as they fly by." - Douglas Adams
--
"I love deadlines. I especially love the whooshing sound they make as they fly by." - Douglas Adams
RSS Feed