当前位置: 首页>>代码示例>>C++>>正文


C++ Surface::Clear方法代码示例

本文整理汇总了C++中Surface::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Surface::Clear方法的具体用法?C++ Surface::Clear怎么用?C++ Surface::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Surface的用法示例。


在下文中一共展示了Surface::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EffectsBlit

void Surface::EffectsBlit(int x, int y, Bitmap* src, Rect src_rect,
						   int top_opacity, int bottom_opacity, int opacity_split,
						   const Tone& tone,
						   double zoom_x, double zoom_y, double angle,
						   int waver_depth, double waver_phase) {
	bool rotate = angle != 0.0;
	bool scale = zoom_x != 1.0 || zoom_y != 1.0;
	bool waver = waver_depth != 0;
	bool tone_change = tone != Tone();
	bool opacity =
		(opacity_split <= 0) ? (top_opacity < 255) :
		(opacity_split >= src_rect.height) ? (bottom_opacity < 255) :
		(top_opacity < 255 || bottom_opacity < 255);
	opacity = top_opacity < 255 || bottom_opacity < 255;

	Surface* draw = (Surface*) NULL;

	if (tone_change) {
		if (!rotate && !scale && !opacity && !waver) {
			ToneBlit(x, y, src, src_rect, tone);
			return;
		}

		bool transparent = src->GetTransparent();
		draw = CreateSurface(src_rect.width, src_rect.height, transparent);
		if (transparent)
			draw->Clear();
		draw->ToneBlit(0, 0, src, src_rect, tone);
		src = draw;
		src_rect.x = 0;
		src_rect.y = 0;
	}

	if (rotate) {
		Matrix fwd = Matrix::Setup(angle, zoom_x, zoom_y, src_rect.x, src_rect.y, x, y);
		EffectsBlit(fwd, src, src_rect, top_opacity, bottom_opacity, opacity_split);
	}
	else if (scale)
		EffectsBlit(x, y, src, src_rect,
					top_opacity, bottom_opacity, opacity_split,
					zoom_x, zoom_y,
					waver_depth, waver_phase);
	else
		EffectsBlit(x, y, src, src_rect,
					top_opacity, bottom_opacity, opacity_split,
					waver_depth, waver_phase);

	if (draw != NULL)
		delete draw;
}
开发者ID:take-cheeze,项目名称:EasyRPG,代码行数:50,代码来源:effects.cpp


注:本文中的Surface::Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。