[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: Image getScaledInstance() vs AreaAveragingScaleFil
From: |
Robert Schuster |
Subject: |
Re: [cp-patches] FYI: Image getScaledInstance() vs AreaAveragingScaleFilter |
Date: |
Mon, 07 Nov 2005 07:51:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.12) Gecko/20051005 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Mark.
> @@ -178,20 +180,25 @@
> */
> public Image getScaledInstance(int width, int height, int flags)
> {
> + ImageFilter filter;
> switch (flags)
> {
> case SCALE_DEFAULT:
> case SCALE_FAST:
> case SCALE_REPLICATE:
> - ImageProducer producer =
> - new FilteredImageSource(this.getSource(),
> - new ReplicateScaleFilter(width, height));
> - return Toolkit.getDefaultToolkit().createImage(producer);
> - case SCALE_SMOOTH:
> + filter = new ReplicateScaleFilter(width, height);
> + break;
> case SCALE_AREA_AVERAGING:
> + filter = new AreaAveragingScaleFilter(width, height);
> + break;
> + case SCALE_SMOOTH:
> + throw new Error("SCALE_SMOOTH: not implemented");
What kind of filter class would be responsible for this and should'nt this be
marked with a big bad "FIXME" (and a PR)?
> default:
> - throw new Error("not implemented");
> + throw new Error("Unknown flag or not implemented: " + flags);
> }
> +
> + ImageProducer producer = new FilteredImageSource(getSource(), filter);
> + return Toolkit.getDefaultToolkit().createImage(producer);
> }
>
> /**
cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFDbvleG9cfwmwwEtoRAjsYAJ4wqzZSMdX+qfUzqOPs2vEF7ha9egCfasRh
uYcE9OpLcc1WKe0TMI+44MI=
=UxWR
-----END PGP SIGNATURE-----