On Fri, Nov 29, 2013 at 12:06 PM, Simon Hartley <[email protected]>wrote:

> When playing with the code I created a 4 bit grayscale image.
>
> The reason I use ushort is because it results in better quality images
> than if I use byte (I had issues with lines not drawing smoothly).
>
>
>
> BufferedImage bi =  ImageTypeSpecifier
>
>                                                 .createGrayscale(4,
> DataBuffer.TYPE_USHORT, false)
>
>
> .createBufferedImage(width, height);
>
>
>
> The ScanlineProviderFactory didn’t like this because of the use of USHORT
> in combination with an IndexColorModel.
>
> One thing I needed to do to get it to work is create a constructor on
> RasterShortSingleBandProvider which takes a bit depth (4 in this case).
>

Weird setup indeed. Yes, what you propose should work.
More in general, this PNG encoder should probably have a fallback mode, if
we cannot create a scanline provider,
it should fall back on the JDK one I guess, to make sure it does not break
when plugging custom raster sources
like yours.


>
>
> Looking at the code, can the final <*else if*> ever work?
>
> The previous <*else if> *checks if the ColorModel is an instance of
> IndexColorModel and then the next <*else if>*,
> knowing that it isn’t an IndexColorModel, casts the ColorModel to
> IndexColorModel.
>

No, you're right, it does not. Weird, I guess none of the official PNG
color models ever get there

Cheers
Andrea

-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to