示例#1
0
 internal PackedColorModel(java.awt.color.ColorSpace space, int bits, int rmask, int gmask,
                           int bmask, long amask, bool isAlphaPremultiplied, int trans,
                           int transferType)
     : base(bits, createBits(rmask, gmask, bmask, amask), space,
            (amask == 0 ? false : true), isAlphaPremultiplied, trans,
            validateTransferType(transferType))
 {
     //!++ TODO implement
     throw new java.lang.UnsupportedOperationException("Not yet implemented");
 }
示例#2
0
        /*
         * Extracts scaling data from the color space
         * @param cs - color space
         */
        public void loadScalingData(java.awt.color.ColorSpace cs)
        {
            nColorChannels = cs.getNumComponents();

            channelMinValues     = new float[nColorChannels];
            channelMulipliers    = new float[nColorChannels];
            invChannelMulipliers = new float[nColorChannels];

            for (int i = 0; i < nColorChannels; i++)
            {
                channelMinValues[i] = cs.getMinValue(i);

                channelMulipliers[i] =
                    MAX_SHORT / (cs.getMaxValue(i) - channelMinValues[i]);

                invChannelMulipliers[i] =
                    (cs.getMaxValue(i) - channelMinValues[i]) / MAX_SHORT;
            }
        }
示例#3
0
        public ColorModel(int bits)
        {
            if (bits < 1)
            {
                // awt.271=The number of bits in bits is less than 1
                throw new java.lang.IllegalArgumentException("The number of bits in bits is less than 1"); //$NON-NLS-1$
            }

            pixel_bits = bits;
            transferType = getTransferType(bits);
            cs = java.awt.color.ColorSpace.getInstance(java.awt.color.ColorSpace.CS_sRGB);
            hasAlphaJ = true;
            isAlphaPremultipliedJ = false;
            transparency = TransparencyConstants.TRANSLUCENT;

            numColorComponents = 3;
            numComponents = 4;

            this.bits = null;
        }
示例#4
0
        public ColorModel(int bits)
        {
            if (bits < 1)
            {
                // awt.271=The number of bits in bits is less than 1
                throw new java.lang.IllegalArgumentException("The number of bits in bits is less than 1"); //$NON-NLS-1$
            }

            pixel_bits            = bits;
            transferType          = getTransferType(bits);
            cs                    = java.awt.color.ColorSpace.getInstance(java.awt.color.ColorSpace.CS_sRGB);
            hasAlphaJ             = true;
            isAlphaPremultipliedJ = false;
            transparency          = TransparencyConstants.TRANSLUCENT;

            numColorComponents = 3;
            numComponents      = 4;

            this.bits = null;
        }
示例#5
0
        protected ColorModel(int pixel_bits, int[] bits, java.awt.color.ColorSpace cspace,
            bool hasAlpha, bool isAlphaPremultiplied, int transparency,
            int transferType)
        {
            if (pixel_bits < 1)
            {
                // awt.26B=The number of bits in the pixel values is less than 1
                throw new java.lang.IllegalArgumentException("The number of bits in the pixel values is less than 1"); //$NON-NLS-1$
            }

            if (bits == null)
            {
                // awt.26C=bits is null
                throw new java.lang.NullPointerException("=bits is null"); //$NON-NLS-1$
            }

            int sum = 0;
            foreach (int element in bits)
            {
                if (element < 0)
                {
                    // awt.26D=The elements in bits is less than 0
                    throw new java.lang.IllegalArgumentException("The elements in bits is less than 0"); //$NON-NLS-1$
                }
                sum += element;
            }

            if (sum < 1)
            {
                // awt.26E=The sum of the number of bits in bits is less than 1
                throw new java.lang.NullPointerException("The sum of the number of bits in bits is less than 1"); //$NON-NLS-1$
            }

            if (cspace == null)
            {
                // awt.26F=The cspace is null
                throw new java.lang.IllegalArgumentException("The cspace is null"); //$NON-NLS-1$
            }

            if (transparency < TransparencyConstants.OPAQUE ||
                   transparency > TransparencyConstants.TRANSLUCENT)
            {
                // awt.270=The transparency is not a valid value
                throw new java.lang.IllegalArgumentException("The transparency is not a valid value"); //$NON-NLS-1$
            }

            this.pixel_bits = pixel_bits;
            //this.bits = bits.clone();
            this.bits = new int[bits.Length];
            java.lang.SystemJ.arraycopy(bits, 0, this.bits, 0, this.bits.Length);

            maxValues = new int[bits.Length];
            maxBitLength = 0;
            for (int i = 0; i < maxValues.Length; i++)
            {
                maxValues[i] = (1 << bits[i]) - 1;
                if (bits[i] > maxBitLength)
                {
                    maxBitLength = bits[i];
                }
            }

            cs = cspace;
            this.hasAlphaJ = hasAlpha;
            this.isAlphaPremultipliedJ = isAlphaPremultiplied;
            numColorComponents = cs.getNumComponents();

            if (hasAlpha)
            {
                numComponents = numColorComponents + 1;
            }
            else
            {
                numComponents = numColorComponents;
            }

            this.transparency = transparency;
            this.transferType = transferType;
        }
示例#6
0
 public static bool is_sRGB_CS(java.awt.color.ColorSpace cs)
 {
     return(cs == sRGB_CS);
 }
示例#7
0
 public static bool is_LINEAR_GRAY_CS(java.awt.color.ColorSpace cs)
 {
     return(cs == LINEAR_GRAY_CS);
 }
示例#8
0
        protected ColorModel(int pixel_bits, int[] bits, java.awt.color.ColorSpace cspace,
                             bool hasAlpha, bool isAlphaPremultiplied, int transparency,
                             int transferType)
        {
            if (pixel_bits < 1)
            {
                // awt.26B=The number of bits in the pixel values is less than 1
                throw new java.lang.IllegalArgumentException("The number of bits in the pixel values is less than 1"); //$NON-NLS-1$
            }

            if (bits == null)
            {
                // awt.26C=bits is null
                throw new java.lang.NullPointerException("=bits is null"); //$NON-NLS-1$
            }

            int sum = 0;

            foreach (int element in bits)
            {
                if (element < 0)
                {
                    // awt.26D=The elements in bits is less than 0
                    throw new java.lang.IllegalArgumentException("The elements in bits is less than 0"); //$NON-NLS-1$
                }
                sum += element;
            }

            if (sum < 1)
            {
                // awt.26E=The sum of the number of bits in bits is less than 1
                throw new java.lang.NullPointerException("The sum of the number of bits in bits is less than 1"); //$NON-NLS-1$
            }

            if (cspace == null)
            {
                // awt.26F=The cspace is null
                throw new java.lang.IllegalArgumentException("The cspace is null"); //$NON-NLS-1$
            }

            if (transparency < TransparencyConstants.OPAQUE ||
                transparency > TransparencyConstants.TRANSLUCENT)
            {
                // awt.270=The transparency is not a valid value
                throw new java.lang.IllegalArgumentException("The transparency is not a valid value"); //$NON-NLS-1$
            }

            this.pixel_bits = pixel_bits;
            //this.bits = bits.clone();
            this.bits = new int[bits.Length];
            java.lang.SystemJ.arraycopy(bits, 0, this.bits, 0, this.bits.Length);

            maxValues    = new int[bits.Length];
            maxBitLength = 0;
            for (int i = 0; i < maxValues.Length; i++)
            {
                maxValues[i] = (1 << bits[i]) - 1;
                if (bits[i] > maxBitLength)
                {
                    maxBitLength = bits[i];
                }
            }

            cs                         = cspace;
            this.hasAlphaJ             = hasAlpha;
            this.isAlphaPremultipliedJ = isAlphaPremultiplied;
            numColorComponents         = cs.getNumComponents();

            if (hasAlpha)
            {
                numComponents = numColorComponents + 1;
            }
            else
            {
                numComponents = numColorComponents;
            }

            this.transparency = transparency;
            this.transferType = transferType;
        }