示例#1
0
文件: sprite.cpp 项目: EasyRPG/Player
void Sprite::BlitScreen() {
	if (!bitmap || (opacity_top_effect <= 0 && opacity_bottom_effect <= 0))
		return;

	Rect rect = src_rect_effect.GetSubRect(src_rect);

	BitmapRef draw_bitmap = Refresh(rect);

	bitmap_changed = false;
	needs_refresh = false;

	if (draw_bitmap) {
		BlitScreenIntern(*draw_bitmap, rect, bush_effect);
	}
}
示例#2
0
void BitmapScreen::BlitScreenTiled(Rect const& src_rect, Rect const& dst_rect, int ox, int oy) {
	if (bitmap == NULL || (opacity_top_effect <= 0 && opacity_bottom_effect <= 0))
		return;

	Rect rect = src_rect_effect.GetSubRect(src_rect);
	int bush_y = 0;

	bool need_scale = false;
	BitmapRef draw_bitmap = Refresh(rect, need_scale, bush_y);

	bitmap_changed = false;
	needs_refresh = false;

	int width = rect.width;
	int height = rect.height;

	if (need_scale) {
		width  = (int)(width  * zoom_x_effect);
		height = (int)(height * zoom_y_effect);
	}

	if (ox > 0)
		ox -= width * ((ox + width - 1) / width);
	else if (ox < 0)
		ox += width * (ox / width);

	if (oy > 0)
		oy -= height * ((oy + height - 1) / height);
	else if (oy < 0)
		oy += height * (oy / height);

	int x0 = dst_rect.x + ox;
	int y0 = dst_rect.y + oy;
	int x1 = dst_rect.x + dst_rect.width;
	int y1 = dst_rect.y + dst_rect.height;
	for (int y = y0; y < y1; y += height) {
		for (int x = x0; x < x1; x += width) {
			Rect blit_rect = rect;
			if (y + blit_rect.height > y1)
				blit_rect.height = y1 - y;
			if (x + blit_rect.width > x1)
				blit_rect.width = x1 - x;
			BlitScreenIntern(*draw_bitmap, x, y, blit_rect, need_scale, 0);
		}
	}
}
示例#3
0
void BitmapScreen::BlitScreen(int x, int y, Rect const& src_rect) {
	if (bitmap == NULL || (opacity_top_effect <= 0 && opacity_bottom_effect <= 0))
		return;

	Rect rect = src_rect_effect.GetSubRect(src_rect);

	Rect bush_rect = src_rect_effect;
	bush_rect.height -= bush_effect;
	bush_rect = bush_rect.GetSubRect(src_rect);
	int bush_y = (rect.y + rect.height) - (bush_rect.y + bush_rect.height);

	bool need_scale = false;
	BitmapRef draw_bitmap = Refresh(rect, need_scale, bush_y);

	bitmap_changed = false;
	needs_refresh = false;

	if(draw_bitmap) {
		BlitScreenIntern(*draw_bitmap, x, y, rect, need_scale, bush_y);
	}
}