⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 img.c

📁 CS架构的多平台的GUI系统
💻 C
字号:
/***************************************************************************    begin                : Thu Jan 30 2003    copyright            : (C) 2003 - 2005 by Alper Akcan    email                : distchx@yahoo.com ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU Lesser General Public License as        * *   published by the Free Software Foundation; either version 2.1 of the  * *   License, or (at your option) any later version.                       * *                                                                         * ***************************************************************************/#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include "xynth_.h"static int i = 0;static void img_print (s_window_t *window, s_image_t *img){	char *vbuf;	s_surface_t s;	vbuf = (char *) s_calloc(1, sizeof(char) * img->w * img->h * window->surface->bytesperpixel);	s_getsurfacevirtual(&s, img->w, img->h, window->surface->bitsperpixel, vbuf);	s_getbox(window->surface, img->x, img->y, img->w, img->h, vbuf);	s_putboxrgba(&s, 0, 0,img->w, img->h, img->rgba);	s_putbox(window->surface, img->x, img->y, img->w, img->h, vbuf);        s_free(vbuf);}static void img_timer_cb (s_window_t *window, s_timer_t *timer){	s_image_t *tmp;	s_image_t *img;	s_thread_mutex_lock(window->timers->mut);	img = (s_image_t *) timer->user_data;	s_thread_mutex_unlock(window->timers->mut);	if (s_list_eol(img->layers, i)) {		i = 0;	}	tmp = s_list_get(img->layers, i);		img_print(window, tmp);	s_timer_timeval(window, timer, tmp->delay);	i++;}int main (int argc, char *argv[]){	s_image_t *img;	s_timer_t *timer;	s_window_t *window;	s_client_init(&window);	s_window_new(window, WINDOW_MAIN, NULL);        s_window_set_title(window, "Demo - %s ", argv[0]);        s_image_init(&img);        s_image_img(argv[1], img);        s_window_set_coor(window, NO_FORM, 100, 100, 400, 200);		if (img->layers->nb_elt != 0) {		s_timer_init(&timer);		timer->user_data = (void *) img;		timer->timeval = 1;		timer->cb = img_timer_cb;		s_timer_add(window, timer);	} else {		img_print(window, img);	}		s_window_show(window);        s_client_main(window);        s_image_uninit(img);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -