Пример #1
0
void xsCanvasContext::drawImage(xsImage* image,float x, float y, float width, float height)
{
	xsGraphics *gc = xsGetSystemGc();
	float originW,  originH;
	xsGetImageDimension(image, &originW, &originH);
	xsDrawImage(gc, image, x, y, width, height);
	xsFlushScreen(x, y, x + width, y + height);
}
Пример #2
0
void xsCanvasContext::drawImage(xsImage* image,float x, float y)
{
	xsGraphics *gc = xsGetSystemGc();
	float originW,  originH;
	xsGetImageDimension(image, &originW, &originH);
	xsDrawImage(gc, image, x, y, 0, 0);
	xsRect clientRect;
	xsFlushScreen(x, y, originW, originH);
}
Пример #3
0
void xsCanvasContext::drawImage(xsImage* image,float sx, float sy, float swidth, float sheight, float x, float y, float width, float height)
{
	xsGraphics *gc = xsGetSystemGc();
	xsRect clipRect;
	clipRect.left = x;
	clipRect.top = y;
	clipRect.right = x + width;
	clipRect.bottom = y + height;
	xsSetClipRect(gc, &clipRect);
	float originW,  originH;
	xsGetImageDimension(image, &originW, &originH);
	xsDrawImage(gc, image, x - sx, y - sy, originW * width/swidth, originH*height/sheight);
	xsResetClipRect(gc);
	xsFlushScreen(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
}
Пример #4
0
int DemoApp::onTimeout()
{
	xsGraphics *gc = xsGetSystemGc();

	// clear
	xsColor color = {255, 255, 255, 255};
	xsSetColor(gc, color);
	xsFillRectangle(gc, x, y, BOX_SIZE, BOX_SIZE);//, xsArgbToColor(0xFFFFFFFF));

	// draw new box
	x += rateX;
	y += rateY;

	if (x < 0 || x + BOX_SIZE > width)
		rateX = -rateX;
	if (y < 0 || y + BOX_SIZE > height)
		rateY = -rateY;

	xsDrawImage(gc, img, x, y, 0, 0);
	
	xsFlushScreen(0, 0, width - 1, height - 1);

	return 0;
}