Java RGB Color Create makeLinear_sRGBCM(boolean premult)

Here you can find the source of makeLinear_sRGBCM(boolean premult)

Description

Method that returns either Linear_sRGB_Pre or Linear_sRGB_UnPre based on premult flag.

License

Apache License

Parameter

Parameter Description
premult True if the ColorModel should have premultiplied alpha.

Return

a ColorMdoel with Linear sRGB colorSpace and the alpha channel set in accordance with premult

Declaration

public static ColorModel makeLinear_sRGBCM(boolean premult) 

Method Source Code

//package com.java2s;
/*/*from   w  w w  .ja  v  a2 s  .  c o m*/
 * Copyright 2006-2014 ICEsoft Technologies Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS
 * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

import java.awt.color.ColorSpace;

import java.awt.image.*;

public class Main {
    /**
     * Standard prebuilt Linear_sRGB color model with premultiplied alpha.
     */
    public static final ColorModel Linear_sRGB_Pre = new DirectColorModel(
            ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), 32,
            0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, true,
            DataBuffer.TYPE_INT);
    /**
     * Standard prebuilt Linear_sRGB color model with unpremultiplied alpha.
     */
    public static final ColorModel Linear_sRGB_Unpre = new DirectColorModel(
            ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), 32,
            0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, false,
            DataBuffer.TYPE_INT);

    /**
     * Method that returns either Linear_sRGB_Pre or Linear_sRGB_UnPre
     * based on premult flag.
     *
     * @param premult True if the ColorModel should have premultiplied alpha.
     * @return a ColorMdoel with Linear sRGB colorSpace and
     *         the alpha channel set in accordance with
     *         <tt>premult</tt>
     */
    public static ColorModel makeLinear_sRGBCM(boolean premult) {

        return premult ? Linear_sRGB_Pre : Linear_sRGB_Unpre;
    }
}

Related

  1. fromHtmlRGB(String rgb)
  2. fromRGB(String tag)
  3. getRGB(Color color)
  4. getRGB(java.awt.Color color)
  5. makeIcon(int width, int height, int[] rgb)
  6. makeRgbImage(int[][] rbgImage)
  7. msAccesToRGBa(int code)
  8. newRGBImage(int[] rgb, int width, int height, boolean processAlpha)
  9. RGB(float R, float G, float B)