示例#1
0
int
GGI_svga_setdisplayframe(ggi_visual *vis, int num)
{
	if (num < 0 || num >= LIBGGI_MODE(vis)->frames) {
		return GGI_ENOSPACE;
	}
	vis->d_frame_num = num;
	
	return(ggiSetOrigin(vis, vis->origin_x, vis->origin_y));
}
示例#2
0
文件: pageflip.c 项目: antrik/libggi
static void animate(ggi_visual_t vis, ggi_mode * mode, int j)
{
	int f, w, h;
	ggi_pixel *buf;
	ggi_color c1, c2;

	c1.r = ((sin((double) j / 100) + 1) * 32768);
	c1.g = ((sin(2.094394 + (double) j / 100) + 1) * 32768);
	c1.b = ((sin(4.188789 + (double) j / 100) + 1) * 32768);
	c1.a = 0;

	c2.r = ((sin(3.141592 + (double) j / 100) + 1) * 32768);
	c2.g = ((sin(5.235986 + (double) j / 100) + 1) * 32768);
	c2.b = ((sin(7.330381 + (double) j / 100) + 1) * 32768);
	c2.a = 0;

	ggiSetGCForeground(vis, ggiMapColor(vis, &c1));
	ggiSetGCBackground(vis, ggiMapColor(vis, &c2));

	w = mode->virt.x / mode->frames;
	h = mode->virt.y / 5;

	buf = malloc(w * h * GT_SIZE(mode->graphtype));
	if (buf == NULL)
		return;

	ggiSetOrigin(vis, j % (mode->virt.x - mode->visible.x + 1),
		     j % (mode->virt.y - mode->visible.y + 1));

	for (f = 0; f < mode->frames; f++) {
		int x, y, yspan;

		x = f * w;
		yspan = mode->virt.y - h;
		y = (j + (yspan * 2 * (f / mode->frames))) % (2 * yspan);
		y += yspan * 2 * f / mode->frames;
		y %= yspan * 2;
		if (y >= yspan)
			y = yspan * 2 - y;
		x += (int)(sin(3.14159264 * 4 * y / yspan) + 1) * (w * 1 / 10);
		ggiSetWriteFrame(vis, f);
		ggiSetReadFrame(vis, (f + 1) % mode->frames);
		animate_one_frame(vis, x, y, w * 4 / 5, h, buf,
				  (x + w * (mode->frames - 1) + w / 2) %
				  mode->virt.x);
	}

	free(buf);
}
示例#3
0
文件: draw.c 项目: antrik/libggi
int GGI_palemu_setorigin(struct ggi_visual *vis, int x, int y)
{
	ggi_palemu_priv *priv = PALEMU_PRIV(vis);

	int err;
	
	if ((err = ggiSetOrigin(priv->parent, x, y)) != 0) {
		return err;
	}

	vis->origin_x = x;
	vis->origin_y = y;
	
	return 0;
}
示例#4
0
static void perf_SETORIGIN(TeleUser *u, TeleCmdSetOriginData *d)
{
	/* !!! validate */

	ggiSetOrigin(vis, d->x, d->y);
}