pike.git
/
src
/
modules
/
Image
/
colors.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/Image/colors.c:1156:
} image_make_hsv_color(3); } static void image_color_mult(INT32 args) { FLOAT_TYPE x=0.0; get_all_args("`*",args,"%f",&x); pop_n_elems(args);
-
_image_make_rgb_color(
DOUBLE_TO_INT
(THIS->rgb.r*x),
-
DOUBLE_TO_INT
(THIS->rgb.g*x),
-
DOUBLE_TO_INT
(THIS->rgb.b*x));
+
_image_make_rgb_color((
int)(
THIS->rgb.r*x),
+
(
int)(
THIS->rgb.g*x),
+
(
int)(
THIS->rgb.b*x));
} int image_color_svalue(struct svalue *v,rgb_group *rgb) { if (TYPEOF(*v) == T_OBJECT) { struct color_struct *cs=get_storage(v->u.object,image_color_program); if (cs) {
pike.git/src/modules/Image/colors.c:1325:
sp[-1].u.array->size==3) { FLOAT_TYPE h,s,v; stack_swap(); pop_stack(); sp--; dmalloc_touch_svalue(sp); push_array_items(sp->u.array); get_all_args("create",3,"%f%f%f",&h,&s,&v); pop_n_elems(3);
-
push_int(
DOUBLE_TO_INT
(h/360.0*256.0));
-
push_int(
DOUBLE_TO_INT
(s/100.0*255.4));
-
push_int(
DOUBLE_TO_INT
(v/100.0*255.4));
+
push_int((
int)(
h/360.0*256.0));
+
push_int((
int)(
s/100.0*255.4));
+
push_int((
int)(
v/100.0*255.4));
image_make_hsv_color(3); return; } pop_stack(); } if (sp[-1].u.string->len>=4 && sp[-1].u.string->str[0]=='%') { /* @c,m,y,k; 0..100 */ stack_dup();
pike.git/src/modules/Image/colors.c:1586:
if (vi<0) vi=0; else if (vi>COLORMAX) vi=COLORMAX; h = (hi/((double)COLORMAX))*(360.0/60.0); s = si/((double)COLORMAX); v = vi/((double)COLORMAX); } else { get_all_args("hsv",args,"%f%f%f",&h,&s,&v); pop_n_elems(args);
-
if (h<0) h = 360 + h - ((
DOUBLE_TO_INT
(
h
)/360)*360);
-
if (h>360.0) h -= ((
DOUBLE_TO_INT
(
h
)/360)*360);
+
if (h<0) h = 360 + h - (((
int)
h/360)*360);
+
if (h>360.0) h -= (((
int)
h/360)*360);
h/=60; } if(s==0.0) { r = g = b = v; } else { #define i floor(h) #define f (h-i) #define p ((FLOAT_TYPE)(v * (1 - s))) #define q ((FLOAT_TYPE)(v * (1 - (s * f)))) #define t ((FLOAT_TYPE)(v * (1 - (s * (1 -f)))))
-
switch(
DOUBLE_TO_INT
(i)
)
+
switch((
int)
i)
{ case 6: /* 360 degrees. Same as 0.. */ case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; case 5: r = v; g = p; b = q; break; default: Pike_error("internal error (hue=%d <= hsv[%"PRINTPIKEFLOAT"f," "%"PRINTPIKEFLOAT"f,%"PRINTPIKEFLOAT"f])\n",
-
DOUBLE_TO_INT
(
i
), h, s, v);
+
(
int)
i, h, s, v);
} } #undef i #undef f #undef p #undef q #undef t _image_make_rgbf_color(r,g,b); }