pike.git
/
src
/
modules
/
Image
/
colors.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/Image/colors.c:500:
Pike_error("internal error, max==0.0\n"); delta = max-min; if(r==max) h = (g-b)/delta; else if(g==max) h = 2+(b-r)/delta; else /*if(b==max)*/ h = 4+(r-g)/delta; h *= 60; /* now in degrees. */ if(h<0) h+=360;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)h)
)
;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)s)
)
;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)v)
)
;
+
push_float((FLOAT_TYPE)h);
+
push_float((FLOAT_TYPE)s);
+
push_float((FLOAT_TYPE)v);
f_aggregate(3); } static void image_color_hsv(INT32 args) { double h,s,v; image_color_hsvf(args); h=sp[-1].u.array->item[0].u.float_number; s=sp[-1].u.array->item[1].u.float_number; v=sp[-1].u.array->item[2].u.float_number;
pike.git/src/modules/Image/colors.c:537:
r=COLORL_TO_FLOAT(THIS->rgbl.r); g=COLORL_TO_FLOAT(THIS->rgbl.g); b=COLORL_TO_FLOAT(THIS->rgbl.b); k=1.0-MAX3(r,g,b); c=1.0-r-k; m=1.0-g-k; y=1.0-b-k;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)(c*100.0))
)
;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)(m*100.0))
)
;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)(y*100.0))
)
;
-
push_float(
DO_NOT_WARN
(
(
FLOAT_TYPE)(k*100.0))
)
;
+
push_float((FLOAT_TYPE)(c*100.0));
+
push_float((FLOAT_TYPE)(m*100.0));
+
push_float((FLOAT_TYPE)(y*100.0));
+
push_float((FLOAT_TYPE)(k*100.0));
f_aggregate(4); } /* **! method object grey() **! method object grey(int red,int green,int blue) **! Gives a new color, containing a grey color, **! which is calculated by the <ref>greylevel</ref> method. **! returns a new <ref>Image.Color.Color</ref> object **! see also: greylevel
pike.git/src/modules/Image/colors.c:1068:
*/ static void image_color_light(INT32 args) { pop_n_elems(args); image_color_hsvf(0); sp--; dmalloc_touch_svalue(sp); push_array_items(sp->u.array); /* frees */
-
sp[-1].u.float_number +=
DO_NOT_WARN
(
(
FLOAT_TYPE)0.2
)
;
+
sp[-1].u.float_number += (FLOAT_TYPE)0.2;
if (((double)sp[-1].u.float_number) >= 1.0)
-
sp[-2].u.float_number -=
DO_NOT_WARN
(
(
FLOAT_TYPE)(sp[-1].u.float_number -
-
1.0)
)
;
+
sp[-2].u.float_number -= (FLOAT_TYPE)(sp[-1].u.float_number - 1.0);
image_make_hsv_color(3); } static void image_color_dark(INT32 args) { pop_n_elems(args); image_color_hsvf(0); sp--; dmalloc_touch_svalue(sp);
pike.git/src/modules/Image/colors.c:1124:
{ pop_n_elems(args); image_color_hsvf(0); sp--; dmalloc_touch_svalue(sp); push_array_items(sp->u.array); /* frees */ if (sp[-2].u.float_number==0.0) {
-
sp[-1].u.float_number -=
DO_NOT_WARN
(
(
FLOAT_TYPE)0.2
)
;
+
sp[-1].u.float_number -= (FLOAT_TYPE)0.2;
} else {
-
sp[-2].u.float_number -=
DO_NOT_WARN
(
(
FLOAT_TYPE)0.2
)
;
-
sp[-1].u.float_number -=
DO_NOT_WARN
(
(
FLOAT_TYPE)0.2
)
;
+
sp[-2].u.float_number -= (FLOAT_TYPE)0.2;
+
sp[-1].u.float_number -= (FLOAT_TYPE)0.2;
} image_make_hsv_color(3); } static void image_color_bright(INT32 args) { pop_n_elems(args); image_color_hsvf(0); sp--; dmalloc_touch_svalue(sp);
pike.git/src/modules/Image/colors.c:1361:
push_array_items(sp->u.array); image_make_cmyk_color(4); return; } pop_stack(); } for (n=0; (size_t)n<sizeof(callables)/sizeof(callables[0]); n++) if (sp[-1].u.string->len>(ptrdiff_t)strlen(callables[n]) && memcmp(sp[-1].u.string->str,callables[n],strlen(callables[n]))==0) {
-
push_int(
DO_NOT_WARN
(
(
INT32)strlen(callables[n]))
)
;
+
push_int((INT32)strlen(callables[n]));
push_int(1000000); f_index(3); image_get_color(1); if (TYPEOF(sp[-1]) != T_OBJECT) return; /* no way */ safe_apply(sp[-1].u.object,callables[n],0); stack_swap(); pop_stack(); return; } if (sp[-1].u.string->len>=4 &&
pike.git/src/modules/Image/colors.c:1385:
stack_dup(); push_static_text("gr%*[ea]y%f\n"); f_sscanf(2); if (TYPEOF(sp[-1]) == T_ARRAY && sp[-1].u.array->size==1) { double f; f = sp[-1].u.array->item[0].u.float_number; pop_stack(); pop_stack();
-
push_int(
DO_NOT_WARN
(
(
int)(255*f/100)
)
);
+
push_int( (int)(255*f/100) );
/* grey100 is white, grey0 is black */ stack_dup(); stack_dup(); image_make_rgb_color(3); return; } pop_stack(); } }