Examples of Palette


Examples of bdsup2sub.bitmap.Palette

     */
    private Palette decodePalette(final SubPictureHD pic) throws CoreException {
        int ofs = pic.getPaletteOffset();
        int alphaOfs = pic.getAlphaOffset();

        Palette palette = new Palette(256);
        try {
            for (int i=0; i < palette.getSize(); i++) {
                // each palette entry consists of 3 bytes
                int y = buffer.getByte(ofs++);
                int cr,cb;
                if (configuration.isSwapCrCb()) {
                    cb = buffer.getByte(ofs++);
                    cr = buffer.getByte(ofs++);
                } else {
                    cr = buffer.getByte(ofs++);
                    cb = buffer.getByte(ofs++);
                }
                // each alpha entry consists of 1 byte
                int alpha = 0xff - buffer.getByte(alphaOfs++);
                if (alpha < configuration.getAlphaCrop()) { // to not mess with scaling algorithms, make transparent color black
                    palette.setRGB(i, 0, 0, 0);
                } else {
                    palette.setYCbCr(i, y, cb, cr);
                }
                palette.setAlpha(i, alpha);
            }
            return palette;
        } catch (FileBufferException ex) {
            throw new CoreException (ex.getMessage());
        }
View Full Code Here

Examples of ca.grimoire.jnoise.palettes.Palette

    }

    double average = total / (height * width);
    double gamma = (average - min) / (max - average);

    Palette palette = new CorrectedMonochrome (min, max, gamma);

    for (int row = 0; row < height; ++row) {
      for (int col = 0; col < width; ++col) {
        Color color = palette.getColor (samples[row][col]);
        g.setColor (color);
        g.drawLine (col, row, col, row); // putpixel
      }
    }

View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

  private void process(Paletted8Image in, RGB48Image out)
  {
    final int WIDTH = in.getWidth();
    final int HEIGHT = in.getHeight();
    final Palette PAL = in.getPalette();
    for (int y = 0; y < HEIGHT; y++)
    {
      for (int x = 0; x < WIDTH; x++)
      {
        int value = in.getSample(0, x, y);
        int red = PAL.getSample(RGBIndex.INDEX_RED, value);
        int green = PAL.getSample(RGBIndex.INDEX_GREEN, value);
        int blue = PAL.getSample(RGBIndex.INDEX_BLUE, value);
        out.putSample(RGBIndex.INDEX_RED, x, y, red | red << 8);
        out.putSample(RGBIndex.INDEX_GREEN, x, y, green | green << 8);
        out.putSample(RGBIndex.INDEX_BLUE, x, y, blue | blue << 8);
      }
      setProgress(y, HEIGHT);
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

    if (numPixels > 256)
    {
      // too many pixels
      return null;
    }
    Palette result = new Palette(numPixels, 255);
    int index = 0;
    for (int y = 0; y < image.getHeight(); y++)
    {
      for (int x = 0; x < image.getWidth(); x++)
      {
        result.put(index++, image.getSample(INDEX_RED, x, y),
          image.getSample(INDEX_GREEN, x, y),
          image.getSample(INDEX_BLUE, x, y));
      }
    }
    return result;
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

        throw new WrongParameterException("Specified output image must be of type Gray8Image for input image of type Paletted8Image.");
      }
      out = (Gray8Image)image;
      ensureImagesHaveSameResolution();
    }
    Palette palette = in.getPalette();
    int[] lut = new int[palette.getNumEntries()];
    for (int i = 0; i < lut.length; i++)
    {
      int red = palette.getSample(RGBIndex.INDEX_RED, i);
      int green = palette.getSample(RGBIndex.INDEX_GREEN, i);
      int blue = palette.getSample(RGBIndex.INDEX_BLUE, i);
      lut[i] = (int)(red * redWeight + green * greenWeight + blue * blueWeight);
    }
    final int WIDTH = in.getWidth();
    final int HEIGHT = in.getHeight();
    for (int y = 0; y < HEIGHT; y++)
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

  {
    if (out == null)
    {
      out = (Paletted8Image)in.createCompatibleImage(in.getWidth(), in.getHeight());
    }
    Palette palette = out.getPalette();
    int numSamples = palette.getMaxValue() + 1;
    final int[] LUT = createLookupTable(numSamples, contrast);
    for (int c = 0; c < 3; c++)
    {
      for (int i = 0; i < palette.getNumEntries(); i++)
      {
        palette.putSample(c, i, LUT[palette.getSample(c, i)]);
      }
    }
    for (int y = 0; y < in.getHeight(); y++)
    {
      for (int x = 0; x < in.getWidth(); x++)
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

    }
  }

  private void process(Paletted8Image in, Paletted8Image out)
  {
    Palette inPal = in.getPalette();
    Palette outPal = out.getPalette();
    int[] orig = new int[3];
    int[] adjusted = new int[3];
    final int MAX = inPal.getMaxValue();
    final int WIDTH = in.getWidth();
    final int HEIGHT = in.getHeight();
    for (int i = 0; i < inPal.getNumEntries(); i++)
    {
      orig[INDEX_RED] = inPal.getSample(INDEX_RED, i);
      orig[INDEX_GREEN] = inPal.getSample(INDEX_GREEN, i);
      orig[INDEX_BLUE] = inPal.getSample(INDEX_BLUE, i);
      adjust(orig, adjusted, MAX);
      outPal.putSample(INDEX_RED, i, adjusted[INDEX_RED]);
      outPal.putSample(INDEX_GREEN, i, adjusted[INDEX_GREEN]);
      outPal.putSample(INDEX_BLUE, i, adjusted[INDEX_BLUE]);
    }
    for (int y = 0; y < HEIGHT; y++)
    {
      for (int x = 0; x < WIDTH; x++)
      {
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

    outputImage = out;
  }

  private void createBilevelFromPaletted(Paletted8Image in)
  {
    Palette palette = in.getPalette();
    MemoryBilevelImage out = new MemoryBilevelImage(in.getWidth(), in.getHeight());
    out.clear(BilevelImage.BLACK);
    for (int y = 0; y < in.getHeight(); y++)
    {
      for (int x = 0; x < in.getWidth(); x++)
      {
        if (palette.getSample(RGBIndex.INDEX_RED, in.getSample(0, x, y)) != 0)
        {
          out.putWhite(x, y);
        }
      }
      setProgress(y, in.getHeight());
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

  }

  // assumes that in fact has a palette with gray colors only
  private void createGray8FromPaletted8(Paletted8Image in, Gray8Image out)
  {
    Palette palette = in.getPalette();
    for (int y = 0; y < in.getHeight(); y++)
    {
      for (int x = 0; x < in.getWidth(); x++)
      {
        out.putSample(0, x, y, palette.getSample(0, in.getSample(0, x, y)));
      }
      setProgress(y, in.getHeight());
    }
    outputImage = out;
  }
View Full Code Here

Examples of net.sourceforge.jiu.data.Palette

    if (out == null)
    {
      out = (Paletted8Image)in.createCompatibleImage(in.getWidth(), in.getHeight());
      setOutputImage(out);
    }
    Palette palette = out.getPalette();
    int numSamples = palette.getMaxValue() + 1;
    final int[] LUT = createLookupTable(numSamples);
    for (int c = 0; c < 3; c++)
    {
      for (int i = 0; i < palette.getNumEntries(); i++)
      {
        palette.putSample(c, i, LUT[palette.getSample(c, i)]);
      }
    }
    for (int y = 0; y < in.getHeight(); y++)
    {
      for (int x = 0; x < in.getWidth(); x++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.