Java Pixel Convert To pixelToRGB(int pixel, int[] prgb)

Here you can find the source of pixelToRGB(int pixel, int[] prgb)

Description

pixel To RGB

License

Open Source License

Declaration

public static void pixelToRGB(int pixel, int[] prgb) 

Method Source Code

//package com.java2s;
/*//from  w  w w  .j  ava  2  s. com
  ColorMapUtils.java
    
  (c) 2011-2013 Edward Swartz
    
  All rights reserved. This program and the accompanying materials
  are made available under the terms of the Eclipse Public License v1.0
  which accompanies this distribution, and is available at
  http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    public static void pixelToRGB(int pixel, int[] prgb) {
        prgb[0] = (pixel & 0xff0000) >> 16;
        prgb[1] = (pixel & 0xff00) >> 8;
        prgb[2] = pixel & 0xff;
    }

    public static void pixelToRGB(int pixel, byte[] rgb) {
        rgb[0] = (byte) ((pixel & 0xff0000) >> 16);
        rgb[1] = (byte) ((pixel & 0xff00) >> 8);
        rgb[2] = (byte) (pixel & 0xff);
    }
}

Related

  1. pixelsToInches(int sizeInPixels, int dpi)
  2. pixelsToPoint(int pixels, int dpi)
  3. PixelsToPoints(float value, int dpi)
  4. pixelsToYears(double dim, int chartWidth, int firstChartYear, int lastChartYear)
  5. pixelToEmu(int pixels, int dpi)
  6. pixelXYToTileXY(int pixelX, int pixelY)