Package bdsup2sub.tools

Examples of bdsup2sub.tools.QuantizeFilter


                trg[xt + ofsY] = ((ati << 24) | (rti << 16) | (gti << 8) | bti);
            }
        }
        // quantize image
        QuantizeFilter qf = new QuantizeFilter();
        final Bitmap bm = new Bitmap(sizeX, sizeY);
        int[] ct = qf.quantize(trg, bm.buffer, sizeX, sizeY, 255, dither, dither);
        int size = ct.length;
        if (size > 255) {
            size = 255;
            logger.warn("Quantizer failed.\n");
        }
View Full Code Here


     */
    public BitmapWithPalette scaleFilter(final int sizeX, final int sizeY, final Palette pal, final ResampleFilter f, final boolean dither) {
        final int[] trg = new FilterOp(f, sizeX, sizeY).filter(this, pal);

        // quantize image
        QuantizeFilter qf = new QuantizeFilter();
        final Bitmap bm = new Bitmap(sizeX, sizeY);
        int[] ct = qf.quantize(trg, bm.buffer, sizeX, sizeY, 255, dither, dither);
        int size = ct.length;
        if (size > 255) {
            size = 255;
            logger.warn("Quantizer failed.\n");
        }
View Full Code Here

     */
    public static byte[] createSupFrame(SubPicture pic, Bitmap bm, Palette pal) {
        // the last palette entry must be transparent
        if (pal.getSize() > 255 && pal.getAlpha(255) > 0) {
            // quantize image
            QuantizeFilter qf = new QuantizeFilter();
            Bitmap bmQ = new Bitmap(bm.getWidth(), bm.getHeight());
            int[] ct = qf.quantize(bm.toARGB(pal), bmQ.getInternalBuffer(), bm.getWidth(), bm.getHeight(), 255, false, false);
            int size = ct.length;
            if (size > 255) {
                size = 255;
                logger.trace("Palette had to be reduced from " + pal.getSize() + " to " + size + " entries.\n");
                logger.warn("Quantizer failed.\n");
View Full Code Here

            if (palette == null) {
                // grab int array (ARGB)
                int[] pixels = new int[w * h];
                img.getRGB(0, 0, w, h, pixels, 0, w);
                // quantize image
                QuantizeFilter qf = new QuantizeFilter();
                bitmap = new Bitmap(img.getWidth(), img.getHeight());
                int ct[] = qf.quantize(pixels, bitmap.getInternalBuffer(), w, h, 255, false, false);
                int size = ct.length;
                if (size > 255) {
                    logger.warn("Quantizer failed.\n");
                    size = 255;
                }
View Full Code Here

TOP

Related Classes of bdsup2sub.tools.QuantizeFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.