pike.git / src / modules / Image / layers.c

version» Context lines:

pike.git/src/modules/Image/layers.c:1:   /*   **! module Image   **! note - **! $Id: layers.c,v 1.45 2000/07/28 07:12:44 hubbe Exp $ + **! $Id: layers.c,v 1.46 2000/08/05 11:07:31 grubba Exp $   **! class Layer   **! see also: layers   **!      **!   **!   **! <add_appendix name="layers" title="Image.Layer modes">   **! <dl compact>   **! <dt><i>The variables in the expression:</i>   **! <dt>L<dd><i>The active layer</i>
pike.git/src/modules/Image/layers.c:208:   **! }   **!   **! </execute>   **! </add_appendix>   */      #include "global.h"      #include <math.h> /* floor */    - RCSID("$Id: layers.c,v 1.45 2000/07/28 07:12:44 hubbe Exp $"); + RCSID("$Id: layers.c,v 1.46 2000/08/05 11:07:31 grubba Exp $");      #include "image_machine.h"      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "array.h"
pike.git/src/modules/Image/layers.c:529:    ((COLORTYPE)(COLORMAX*(C2F(aL)+(1.0-C2F(aL))*C2F(aS))))   #define COMBINE_ALPHA_SUM_V(aS,aL,V) \    COMBINE_ALPHA_SUM(aS,(aL)*(V))      #else /* unknown COMBINE_METHOD */   #error unknown COMBINE_METHOD   #endif /* COMBINE_METHOD_FLOAT */      #endif    - #define COMBINE(P,A) CCUT(((int)(P))*(A)) + #define COMBINE(P,A) CCUT((DOUBLE_TO_INT(P))*(A))   #define COMBINE_A(P,A) ((COLORTYPE)((P)*(A)))   #define COMBINE_V(P,V,A) CCUT((V)*(P)*(A))    - #define F2C(Z) ((COLORTYPE)(COLORMAX*(Z))) + #define F2C(Z) ((COLORTYPE)DOUBLE_TO_INT(COLORMAX*(Z)))      #define ALPHA_ADD(S,L,D,SA,LA,DA,C) \    if (!(LA)->C) (D)->C=(S)->C,(DA)->C=(SA)->C; \    else if (!(SA)->C) (D)->C=(L)->C,(DA)->C=(LA)->C; \    else if ((LA)->C==COLORMAX) (D)->C=(L)->C,(DA)->C=(LA)->C; \    else \    (D)->C=COMBINE_ALPHA((S)->C,(L)->C,(SA)->C,(LA)->C), \    (DA)->C=COMBINE_ALPHA_SUM((SA)->C,(LA)->C);      #define ALPHA_ADD_V_NOLA(L,S,D,SA,DA,V,C) \
pike.git/src/modules/Image/layers.c:629:    colorp->r=colorp->g=colorp->b=F2C(v);    return;    }      #define i floor(h)   #define f (h-i)   #define p F2C(v * (1 - s))   #define q F2C(v * (1 - (s * f)))   #define t F2C(v * (1 - (s * (1 -f))))   #define V F2C(v) -  switch((int)i) +  switch(DOUBLE_TO_INT(i))    {    case 6:    case 0: colorp->r = V; colorp->g = t; colorp->b = p; break;    case 7:    case 1: colorp->r = q; colorp->g = V; colorp->b = p; break;    case 2: colorp->r = p; colorp->g = V; colorp->b = t; break;    case 3: colorp->r = p; colorp->g = q; colorp->b = V; break;    case 4: colorp->r = t; colorp->g = p; colorp->b = V; break;    case 5: colorp->r = V; colorp->g = p; colorp->b = q; break;    default: fatal("unhandled case\n");
pike.git/src/modules/Image/layers.c:1374:    l++; s++; la++; sa++; da++; d++;    }    return;    }   }      /* operators from template */      #define LM_FUNC lm_add   #define L_TRUNC(X) MINIMUM(255,(X)) - #define L_OPER(A,B) ((A)+(int)(B)) + #define L_OPER(A,B) ((A)+DOUBLE_TO_INT(B))   #define L_MMX_OPER(A,MMXR) paddusb_m2r(A,MMXR)   #include "layer_oper.h"   #undef L_MMX_OPER   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_subtract   #define L_TRUNC(X) MAXIMUM(0,(X)) - #define L_OPER(A,B) ((A)-(int)(B)) + #define L_OPER(A,B) ((A)-DOUBLE_TO_INT(B))   #define L_MMX_OPER(A,MMXR) psubusb_m2r(A,MMXR)   #include "layer_oper.h"   #undef L_MMX_OPER   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_multiply   #define L_TRUNC(X) (X) - #define L_OPER(A,B) CCUT((A)*(int)(B)) + #define L_OPER(A,B) CCUT((A)*DOUBLE_TO_INT(B))   #include "layer_oper.h"   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_divide   #define L_TRUNC(X) MINIMUM(255,(X)) - #define L_OPER(A,B) ((A)/C2F(1+(int)(B))) + #define L_OPER(A,B) ((A)/C2F(1+DOUBLE_TO_INT(B)))   #include "layer_oper.h"   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_modulo   #define L_TRUNC(X) ((COLORTYPE)(X))   #define L_OPER(A,B) ((A)%((B)?(B):1))   #include "layer_oper.h"   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define L_USE_SA      #define LM_FUNC lm_invsubtract   #define L_TRUNC(X) MAXIMUM(0,(X)) - #define L_OPER(A,B) ((B)-(int)(A)) + #define L_OPER(A,B) ((B)-DOUBLE_TO_INT(A))   #include "layer_oper.h"   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_invdivide   #define L_TRUNC(X) MINIMUM(255,(X)) - #define L_OPER(A,B) ((B)/C2F(1+(int)(A))) + #define L_OPER(A,B) ((B)/C2F(1+DOUBLE_TO_INT(A)))   #include "layer_oper.h"   #undef LM_FUNC   #undef L_TRUNC   #undef L_OPER      #define LM_FUNC lm_invmodulo   #define L_TRUNC(X) ((COLORTYPE)(X))   #define L_OPER(A,B) ((B)%((A)?(A):1))   #include "layer_oper.h"   #undef LM_FUNC