示例#1
0
void BitmapUtilsT<PFsrc,PFdst>::OpacityBlit(uint8_t* dst_pixels, const uint8_t* src_pixels, int n, int opacity) {
	for (int i = 0; i < n; i++) {
		blend_pixel(dst_pixels, src_pixels, opacity);
		src_pixels += pf_src.bytes;
		dst_pixels += pf_dst.bytes;
	}
}
示例#2
0
void BitmapUtilsT<PFsrc,PFdst>::OpacityScaleBlit(uint8_t* dst_pixels, const uint8_t* src_pixels, int n, int x, int step, int opacity) {
	for (int i = 0; i < n; i++) {
		const uint8_t* p = src_pixels + (x >> FRAC_BITS) * pf_src.bytes;
		blend_pixel(dst_pixels, p, opacity);
		dst_pixels += pf_dst.bytes;
		x += step;
	}
}
示例#3
0
    //--------------------------------------------------------------------
    // The scanline rendering function itself.
    template<class Scanline> void render(const Scanline& sl)
    {
        unsigned num_spans = sl.num_spans();
        int y = sl.y();

        Scanline::const_iterator span = sl.begin();

        do
        {
            int len = span->len;
            int x;
            if(len > 0)
            {
                // pixel-by-pixel
                const Scanline::cover_type* covers = span->covers;
                x = span->x;
                do
                {
                    blend_pixel(x++, y, *covers++);
                }
                while(--len);
            }
            else
            {
                if(*span->covers == 255)
                {
                    // solid span. happens often
                    draw_solid_span(span->x, y, -len);
                }
                else
                {
                    // pixel-by-pixel again
                    x = span->x;
                    do
                    {
                        blend_pixel(x++, y, *span->covers);
                    }
                    while(++len);
                }
            }
            ++span;
        }
        while(--num_spans);
    }
示例#4
0
void image_base::composite(int xoffset, int yoffset, boost::shared_ptr<image_operations> img)
{
  std::vector<image_operation>::size_type i = img->operations.size();
  
  align(xoffset, yoffset, img->maxx, img->maxy);
  
  while (i--) {
    image_operation op = img->operations[i];
    blend_pixel(xoffset + op.x, yoffset + op.y, op.c);
  }
}
示例#5
0
void image_base::composite(int x, int y, image_operations_ptr opers)
{
  std::vector<image_operation>::size_type i = opers->operations.size();
  
  align(x, y, opers->max_x, opers->max_y);
  
  while (i--)
  {
    image_operation op = opers->operations[i];
    blend_pixel(x + op.x, y + op.y, op.c);
  }
}
示例#6
0
void BitmapUtilsT<PFsrc,PFdst>::OpacityTransformBlit(uint8_t* dst_pixels, const uint8_t* src_pixels, int src_pitch,
													 int x0, int x1, int y, const Rect& src_rect, const Matrix& inv,
													 int opacity) {
	const int sx0 = src_rect.x;
	const int sy0 = src_rect.y;
	const int sx1 = src_rect.x + src_rect.width;
	const int sy1 = src_rect.y + src_rect.height;

	for (int x = x0; x < x1; x++) {
		double fx, fy;
		inv.Transform(x + 0.5, y + 0.5, fx, fy);
		int xi = (int) floor(fx);
		int yi = (int) floor(fy);
		if (xi < sx0 || xi >= sx1 || yi < sy0 || yi >= sy1)
			;
		else
			blend_pixel(dst_pixels, &src_pixels[yi * src_pitch + xi * pf_src.bytes], opacity);
		dst_pixels += pf_dst.bytes;
	}
}
示例#7
0
void image_base::safe_blend_pixel(pos_t x, pos_t y, color &c)
{
  if (x >= w) return;
  if (y >= h) return;
  blend_pixel(x, y, c);
}