Examples of ColorSpace


Examples of java.awt.color.ColorSpace

     *
     * @throws IOException If there is an error creating the color model.
     */
    public ColorModel createColorModel( int bpc ) throws IOException
    {
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        int[] nBits = {bpc};
        ColorModel colorModel = new ComponentColorModel(cs, nBits, false,false,
                Transparency.OPAQUE,DataBuffer.TYPE_BYTE);
        return colorModel;

View Full Code Here

Examples of java.awt.color.ColorSpace

            //for now we will just make rgb a special case.
            retval = new Color( components[0], components[1], components[2] );
        }
        else
        {
            ColorSpace cs = colorSpace.createColorSpace();
            retval = new Color( cs, components, 1f );
        }
        return retval;
    }
View Full Code Here

Examples of java.awt.color.ColorSpace

     * @param color The color to set.
     * @throws IOException If an IO error occurs while writing to the stream.
     */
    public void setStrokingColor( Color color ) throws IOException
    {
        ColorSpace colorSpace = color.getColorSpace();
        if( colorSpace.getType() == ColorSpace.TYPE_RGB )
        {
            setStrokingColor( color.getRed(), color.getGreen(), color.getBlue() );
        }
        else if( colorSpace.getType() == ColorSpace.TYPE_GRAY )
        {
            color.getColorComponents( colorComponents );
            setStrokingColor( colorComponents[0] );
        }
        else if( colorSpace.getType() == ColorSpace.TYPE_CMYK )
        {
            color.getColorComponents( colorComponents );
            setStrokingColor( colorComponents[0], colorComponents[2], colorComponents[2], colorComponents[3] );
        }
        else
View Full Code Here

Examples of java.awt.color.ColorSpace

     * @param color The color to set.
     * @throws IOException If an IO error occurs while writing to the stream.
     */
    public void setNonStrokingColor( Color color ) throws IOException
    {
        ColorSpace colorSpace = color.getColorSpace();
        if( colorSpace.getType() == ColorSpace.TYPE_RGB )
        {
            setNonStrokingColor( color.getRed(), color.getGreen(), color.getBlue() );
        }
        else if( colorSpace.getType() == ColorSpace.TYPE_GRAY )
        {
            color.getColorComponents( colorComponents );
            setNonStrokingColor( colorComponents[0] );
        }
        else if( colorSpace.getType() == ColorSpace.TYPE_CMYK )
        {
            color.getColorComponents( colorComponents );
            setNonStrokingColor( colorComponents[0], colorComponents[2], colorComponents[2], colorComponents[3] );
        }
        else
View Full Code Here

Examples of java.awt.color.ColorSpace

            return 0.0;
        }
    }

    public static double getGamma(GraphicsDevice screen) {
        ColorSpace cs = screen.getDefaultConfiguration().getColorModel().getColorSpace();
        if (cs.isCS_sRGB()) {
            return 2.2;
        } else {
            try {
                return ((ICC_ProfileRGB)((ICC_ColorSpace)cs).getProfile()).getGamma(0);
            } catch (Exception e) { }
View Full Code Here

Examples of java.awt.color.ColorSpace

    /**
     * Derialize the parameter ColorSpace object.
     */
    private static ColorSpace deserializeColorSpace(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
            ColorSpace cs = null;
            int colorSpaceType = in.readInt();
      if (colorSpaceType == COLORSPACE_OTHERS) {
    if (in.readBoolean()) {
        String name = (String)in.readObject();
        try {
View Full Code Here

Examples of java.awt.color.ColorSpace

    private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
        ColorModel colorModel = null;

        // Read serialized form from the stream.
        ColorSpace cs = null;

        // Switch on first int which is a flag indicating the class.
        switch((int)in.readInt()) {
        case COLORMODEL_NULL:
            colorModel = null;
View Full Code Here

Examples of java.awt.color.ColorSpace

            dataType > DataBuffer.TYPE_DOUBLE ||
            numBands < 1 || numBands > 4) {
            return null;
        }

        ColorSpace cs = numBands <= 2 ?
                        ColorSpace.getInstance(ColorSpace.CS_GRAY) :
                        ColorSpace.getInstance(ColorSpace.CS_sRGB);

        boolean useAlpha = (numBands == 2) || (numBands == 4);
        int transparency = useAlpha ?
View Full Code Here

Examples of java.awt.color.ColorSpace

    /**
     * Derialize the parameter ColorSpace object.
     */
    private static ColorSpace deserializeColorSpace(ObjectInputStream in)
        throws IOException {
            ColorSpace cs = null;
            int colorSpaceType = in.readInt();
            if(colorSpaceType == COLORSPACE_ICC) {
                cs = new ICC_ColorSpace(ICC_Profile.getInstance(in));
            } else if(colorSpaceType == COLORSPACE_PREDEFINED) {
                cs = ColorSpace.getInstance(in.readInt());
View Full Code Here

Examples of java.awt.color.ColorSpace

      * @param out The <code>ObjectInputStream</code>.
      */
    private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
        // Read serialized form from the stream.
        ColorSpace cs = null;

        // Switch on first int which is a flag indicating the class.
        switch((int)in.readInt()) {
        case COLORMODEL_NULL:
            colorModel = null;
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.