public static int rgbFromCmyk ( float [ ] cmyk ) { float cyan = cmyk [ 0 ] ; float magenta = cmyk [ 1 ] ; float yellow = cmyk [ 2 ] ; float black = cmyk [ 3 ] ; int red = ( int ) ( ( 1.0f - Math . min ( 1.0f , cyan * ( 1.0f - black ) + black ) ) * 255 ) ; int green = ( int ) ( ( 1.0f - Math . min ( 1.0f , magenta * ( 1.0f - black ) + black ) ) * 255 ) ; int blue = ( int ) ( ( 1.0f - Math . min ( 1.0f , yellow * ( 1.0f - black ) + black ) ) * 255 ) ; return ( ( 0xff & red ) << 16 ) + ( ( 0xff & green ) << 8 ) + ( 0xff & blue ) ; }
Convert CYMK color to RGB color . This method doesn t check if cmyk is not null or have 4 elements in array .