158 int c = a * b + 0x80;
159 return ( ( c >> 8 ) + c ) >> 8;
175 return INT_MULT( a - b, alpha ) + b;
210 s = ( ( max - min ) * 255 ) / (double)max;
217 int delta = max - min;
219 h = ( g - b ) / (
double)delta;
221 h = 2 + ( b - r ) / (
double)delta;
223 h = 4 + ( r - g ) / (
double)delta;
245 if ( saturation == 0 ) {
251 double h = hue * 6. / 255.;
252 double s = saturation / 255.;
253 double v = value / 255.;
255 double f = h - (int)h;
256 double p = v * ( 1. - s );
257 double q = v * ( 1. - ( s * f ) );
258 double t = v * ( 1. - ( s * ( 1. - f ) ) );
265 hue = (
uchar)( v * 255 );
266 saturation = (
uchar)( t * 255 );
267 value = (
uchar)( p * 255 );
270 hue = (
uchar)( q * 255 );
271 saturation = (
uchar)( v * 255 );
272 value = (
uchar)( p * 255 );
275 hue = (
uchar)( p * 255 );
276 saturation = (
uchar)( v * 255 );
277 value = (
uchar)( t * 255 );
280 hue = (
uchar)( p * 255 );
281 saturation = (
uchar)( q * 255 );
282 value = (
uchar)( v * 255 );
285 hue = (
uchar)( t * 255 );
286 saturation = (
uchar)( p * 255 );
287 value = (
uchar)( v * 255 );
290 hue = (
uchar)( v * 255 );
291 saturation = (
uchar)( p * 255 );
292 value = (
uchar)( q * 255 );
321 double l = ( max + min ) / 2.;
329 int delta = max - min;
332 s = 255 * (double)delta / (
double)( max + min );
334 s = 255 * (double)delta / (
double)( 511 - max - min );
337 h = ( g - b ) / (
double)delta;
339 h = 2 + ( b - r ) / (
double)delta;
341 h = 4 + ( r - g ) / (
double)delta;
363static int HLSVALUE (
double n1,
double n2,
double hue )
373 value = n1 + ( n2 - n1 ) * ( hue / 42.5 );
374 else if ( hue < 127.5 )
376 else if ( hue < 170 )
377 value = n1 + ( n2 - n1 ) * ( ( 170 - hue ) / 42.5 );
381 return (
int)( value * 255 );
393 double l = lightness;
394 double s = saturation;
398 lightness = (
uchar)l;
399 saturation = (
uchar)l;
405 m2 = ( l * ( 255 + s ) ) / 65025.;
407 m2 = ( l + s - ( l * s ) / 255. ) / 255.;
409 m1 = ( l / 127.5 ) - m2;
413 saturation =
HLSVALUE( m1, m2, h - 85 );
LayerModeEffects
Effect to apply when layers are merged together.
static void HSVTORGB(uchar &hue, uchar &saturation, uchar &value)
const int RANDOM_SEED
Seed for dissolve random number table.
static void RGBTOHLS(uchar &red, uchar &green, uchar &blue)
const uint TILE_HEIGHT
Height of a tile in the XCF file.
const double EPSILON
Roundup in alpha blending.
int INT_MULT(int a, int b)
GimpImageType
Type of individual layers in an XCF file.
static int HLSVALUE(double n1, double n2, double hue)
static void RGBTOHSV(uchar &red, uchar &green, uchar &blue)
static void HLSTORGB(uchar &hue, uchar &lightness, uchar &saturation)
GimpImageBaseType
Basic GIMP image type.
PropType
Properties which can be stored in an XCF file.
@ PROP_PRESERVE_TRANSPARENCY
@ PROP_FLOATING_SELECTION
const uchar OPAQUE_OPACITY
Opaque value for 8-bit alpha component.
const uint TILE_WIDTH
Width of a tile in the XCF file.
int INT_BLEND(int a, int b, int alpha)
const int RANDOM_TABLE_SIZE
Size of dissolve random number table.
CompressionType
Compression type used in layer tiles.