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

📄 libfbx-polygon.c

📁 libfxb是linux下只写操作framebuffer的一个轻量级的库。
💻 C
字号:
/* *  libfbx-polygon.c -- Polygon Drawing *  (C)opyright 2000-2001 U4X Labs * *  Written by: Mike Bourgeous <nitrogen@u4x.org> *              Mon Jan 15 17:57:08 MST 2001 *               *  $Id: libfbx-polygon.c,v 1.6 2001/02/04 20:29:56 lethal Exp $ * *	Implementation of a number of polygon drawing routines. * *  See ChangeLog for modifications, CREDITS for credits. * *  All source herein is copyright U4X Labs and its original author.  *  Any code modifications or additions are (C)opyright the original  *  author and U4X Labs respectively. * *  libfbx 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. * *  libfbx is distributed in the hope that it will be useful, but  *  WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  *  GNU Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with libfbx; if not, write to the Free Software  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *  USA */#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <math.h>#include <libfbx/libfbx.h>#include <libfbx/libfbx-drivers.h>/* * Function:	fb_fill_rect() * Arguments:	top-left corner of rectangle, bottom-left corner of * 		rectangle, RGB values of color, surface to draw to. * Returns:	None * Description:	Draws a filled in rectangle with the specified * 		attributes on the specified surface. */void fb_fill_rect(int x1, int y1, 		  int x2, int y2, 		  int r, int g, int b, 		  fb_surface *surface){        int line;	if (surface->driver != NULL && surface->driver->ops->has_fill_rect) {		surface->driver->ops->fill_rect(x1, y1, x2, y2, r, g, b, surface);		return;	}		for (line = y1; line < y2; line++)                fb_line(x1, line, x2, line, r, g, b, surface);}/* * Function:	fb_rect() * Arguments:	top-left corner of rectangle, bottom-right corner * 		of rectangle, RGB color, surface. * Returns:	None * Description:	Draws a rectangular outline with the specified * 		coordinates. */void fb_rect(int x1, int y1,	     int x2, int y2,	     int r, int g, int b,	     fb_surface *surface){	fb_line(x1, y1, x1, y2, r, g, b, surface);	fb_line(x1, y2, x2, y2, r, g, b, surface);	fb_line(x2, y2, x2, y1, r, g, b, surface);	fb_line(x2, y1, x1, y1, r, g, b, surface);}

⌨️ 快捷键说明

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