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

version» Context lines:

pike.git/src/modules/Image/blit.c:1: - /* $Id: blit.c,v 1.45 2000/08/10 09:51:53 per Exp $ */ + /* $Id: blit.c,v 1.46 2000/08/11 18:46:35 grubba Exp $ */   #include "global.h"      /*   **! module Image   **! note - **! $Id: blit.c,v 1.45 2000/08/10 09:51:53 per Exp $ + **! $Id: blit.c,v 1.46 2000/08/11 18:46:35 grubba Exp $   **! class Image   */      #include <math.h>   #include <ctype.h>      #include "stralloc.h"   #include "global.h"   #include "pike_macros.h"   #include "object.h"
pike.git/src/modules/Image/blit.c:410:    rgb_group *source = img->img;    struct image *this = THIS;    int xs = this->xsize, ix, mx=img->xsize, my=img->ysize, x;    int ys = this->ysize, iy, y;       THREADS_ALLOW();    for (iy=0; iy<my; iy++)    for (ix=0; ix<mx; ix++)    {    x = ix + x1; y = iy + y1; -  if(x>=0 && y>=0 && x<xs && y<ys) +  if(x>=0 && y>=0 && x<xs && y<ys) {    if(this->alpha)    set_rgb_group_alpha(this->img[x+y*xs],*(source),this->alpha);    else    this->img[x+y*xs]=*(source); -  +  }    source++;    }    THREADS_DISALLOW();    }    pop_n_elems(args);    ref_push_object(THISOBJ);   }      /*   **! method object paste_mask(object image,object mask)
pike.git/src/modules/Image/blit.c:503:       q=1.0/255;       THREADS_ALLOW();    for (y=MAXIMUM(0,-y1); y<y2; y++)    {    for (x=MAXIMUM(0,-x1); x<x2; x++)    {    if (m->r==255) d->r=s->r;    else if (m->r==0) {} -  else d->r=(unsigned char)(((d->r*(255-m->r))+(s->r*m->r))*q); +  else d->r = DOUBLE_TO_COLORTYPE(((d->r*(255-m->r))+(s->r*m->r))*q);    if (m->g==255) d->g=s->g;    else if (m->g==0) {} -  else d->g=(unsigned char)(((d->g*(255-m->g))+(s->g*m->g))*q); +  else d->g = DOUBLE_TO_COLORTYPE(((d->g*(255-m->g))+(s->g*m->g))*q);    if (m->b==255) d->b=s->b;    else if (m->b==0) {} -  else d->b=(unsigned char)(((d->b*(255-m->b))+(s->b*m->b))*q); +  else d->b = DOUBLE_TO_COLORTYPE(((d->b*(255-m->b))+(s->b*m->b))*q);    s++; m++; d++;    }    s+=smod; m+=mmod; d+=dmod;    }    THREADS_DISALLOW();   CHRONO("image_paste_mask end");       pop_n_elems(args);    ref_push_object(THISOBJ);   }
pike.git/src/modules/Image/blit.c:605:       rgb=THIS->rgb;       THREADS_ALLOW();    for (y=MAXIMUM(0,-y1); y<y2; y++)    {    for (x=MAXIMUM(0,-x1); x<x2; x++)    {    if (m->r==255) d->r=rgb.r;    else if (m->r==0) ; -  else d->r=(unsigned char)(((d->r*(255-m->r))+(rgb.r*m->r))*q); +  else d->r = DOUBLE_TO_COLORTYPE(((d->r*(255-m->r))+(rgb.r*m->r))*q);    if (m->g==255) d->g=rgb.g;    else if (m->g==0) ; -  else d->g=(unsigned char)(((d->g*(255-m->g))+(rgb.g*m->g))*q); +  else d->g = DOUBLE_TO_COLORTYPE(((d->g*(255-m->g))+(rgb.g*m->g))*q);    if (m->b==255) d->b=rgb.b;    else if (m->b==0) ; -  else d->b=(unsigned char)(((d->b*(255-m->b))+(rgb.b*m->b))*q); +  else d->b = DOUBLE_TO_COLORTYPE(((d->b*(255-m->b))+(rgb.b*m->b))*q);    m++; d++;    }    m+=mmod; d+=dmod;    }    THREADS_DISALLOW();   CHRONO("image_paste_alpha_color end");       pop_n_elems(args);    ref_push_object(THISOBJ);   }