Java RGB Color Convert To rgb565ToRGB(short pixel, byte[] rgb)

Here you can find the source of rgb565ToRGB(short pixel, byte[] rgb)

Description

rgb To RGB

License

Open Source License

Declaration

public static void rgb565ToRGB(short pixel, byte[] rgb) 

Method Source Code

//package com.java2s;
/*//w w  w.j a  v a  2  s.c o m
  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 rgb565ToRGB(short pixel, byte[] rgb) {
        int r = (pixel >> 11) & 0x1f;
        int g = (pixel >> 5) & 0x3f;
        int b = (pixel) & 0x1f;
        rgb[0] = (byte) (r * 0xff / 0x1f);
        rgb[1] = (byte) (g * 0xff / 0x3f);
        rgb[2] = (byte) (b * 0xff / 0x1f);
    }
}

Related

  1. rgb2xyz(double[] RGB)
  2. rgb2xyz(double[] rgb, double[] xyz)
  3. RGB2YCbCr(int r, int g, int b, boolean useBT601)
  4. RGB2YCbCr(int[] rgb, float[][] Y, float[][] Cb, float[][] Cr, int imageWidth, int imageHeight)
  5. rgb2yuv(float r, float g, float b, float[] yuv)
  6. rgb8ToPixel(byte[] nrgb)
  7. rgb8ToRgbRBXG(byte[] rgb)
  8. rgbaToColor(int r, int g, int b, int a)
  9. rgbaToHex(String color)