From: <si...@sv...> - 2006-05-10 23:07:15
|
Author: simboss Date: 2006-05-10 16:07:12 -0700 (Wed, 10 May 2006) New Revision: 19445 Modified: geotools/branches/coverages_branch/trunk/gt/plugin/ImageMosaic/src/org= /geotools/gce/ImageMosaic/ImageMosaicReader.java Log: -improvements on input alpha management Modified: geotools/branches/coverages_branch/trunk/gt/plugin/ImageMosaic/= src/org/geotools/gce/ImageMosaic/ImageMosaicReader.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- geotools/branches/coverages_branch/trunk/gt/plugin/ImageMosaic/src/or= g/geotools/gce/ImageMosaic/ImageMosaicReader.java 2006-05-10 23:00:58 UTC= (rev 19444) +++ geotools/branches/coverages_branch/trunk/gt/plugin/ImageMosaic/src/or= g/geotools/gce/ImageMosaic/ImageMosaicReader.java 2006-05-10 23:07:12 UTC= (rev 19445) @@ -25,6 +25,9 @@ import javax.media.jai.operator.BandSelectDescriptor; import javax.media.jai.operator.MosaicDescriptor; import javax.media.jai.operator.MultiplyConstDescriptor; +import javax.media.jai.widget.ScrollingImagePanel; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; =20 import org.geotools.coverage.FactoryFinder; import org.geotools.coverage.grid.GeneralGridGeometry; @@ -102,6 +105,7 @@ *=20 */ public ImageMosaicReader(Object source, Format creator) throws IOExcept= ion { + this.source =3D source; if (creator =3D=3D null || !(creator instanceof ImageMosaicFormat)) { // //////////////////////////////////////////////////////////////////= /// @@ -499,8 +503,11 @@ final ColorModel model =3D loadedImage.getColorModel(); alphaIn =3D model.hasAlpha(); if (alphaIn)// todo good for RGBA but what about ARGB and - // others??? + // others??? + { alphaIndex =3D new int[] { model.getNumComponents() - 1 }; + alpha =3D false;// we do not need final alpha + } =20 } =20 @@ -528,9 +535,12 @@ pbjMosaic.setParameter("sourceROI", rois); =20 } else if (alphaIn) { -// pbjMosaic.setParameter("mosaicType", -// MosaicDescriptor.MOSAIC_TYPE_BLEND); + pbjMosaic.setParameter("mosaicType", + MosaicDescriptor.MOSAIC_TYPE_BLEND); pbjMosaic.setParameter("sourceAlpha", alphaChannels); + // pbjMosaic.setParameter("sourceThreshold", + // new double[][] { { 0 } }); + // pbjMosaic.setParameter("sourceROI", rois); } =20 return prepareMosaic(location, requestedEnvelope, @@ -793,13 +803,17 @@ // ///////////////////////////////////////////////////////////////////= // if (!alphaIn && singleImageROI) { rois[i] =3D ImageUtilities.roiExt(loadedImage, - singleImageROIThreshold, false); - rois[i] =3D rois[i].transform(AffineTransform.getTranslateInstance( - xTrans, yTrans)); + singleImageROIThreshold, false).transform( + AffineTransform.getTranslateInstance(xTrans, yTrans)); =20 } else if (alphaIn) { alphaChannels[i] =3D BandSelectDescriptor.create(loadedImage, alphaIndex, new RenderingHints(JAI.KEY_TILE_CACHE, null)); + // rois[i] =3D ImageUtilities.roiExt(alphaChannels[i], 50, false) + // .transform( + // AffineTransform + // .getTranslateInstance(xTrans, yTrans)); + pbjTranslate =3D new ParameterBlockJAI("Translate"); // translation pbjTranslate.addSource(alphaChannels[i]); @@ -807,6 +821,16 @@ pbjTranslate.setParameter("yTrans", new Float(yTrans)); alphaChannels[i] =3D JAI.create("Translate", pbjTranslate, new RenderingHints(JAI.KEY_TILE_CACHE, null)); + // =09 + final JFrame frame =3D new JFrame(Integer.toString(i)); + frame.getContentPane().add( + new ScrollingImagePanel(alphaChannels[i], 800, 600)); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + frame.pack(); + frame.show(); + } + }); =20 } =20 |