亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? img_xpm.c

?? It is extension program for SDL to display images other than bmp, but all the other formats.
?? C
字號:
/*    SDL_image:  An example image loading library for use with SDL    Copyright (C) 1997-2006 Sam Lantinga    This library 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.    This library 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 this library; if not, write to the Free Software    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA    Sam Lantinga    slouken@libsdl.org*//* * XPM (X PixMap) image loader: * * Supports the XPMv3 format, EXCEPT: * - hotspot coordinates are ignored * - only colour ('c') colour symbols are used * - rgb.txt is not used (for portability), so only RGB colours *   are recognized (#rrggbb etc) - only a few basic colour names are *   handled * * The result is an 8bpp indexed surface if possible, otherwise 32bpp. * The colourkey is correctly set if transparency is used. *  * Besides the standard API, also provides * *     SDL_Surface *IMG_ReadXPMFromArray(char **xpm) * * that reads the image data from an XPM file included in the C source. * * TODO: include rgb.txt here. The full table (from solaris 2.6) only * requires about 13K in binary form. */#include <stdlib.h>#include <stdio.h>#include <string.h>#include <ctype.h>#include "SDL_image.h"#ifdef LOAD_XPM/* See if an image is contained in a data source */int IMG_isXPM(SDL_RWops *src){	int start;	int is_XPM;	char magic[9];	if ( !src )		return 0;	start = SDL_RWtell(src);	is_XPM = 0;	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {		if ( memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {			is_XPM = 1;		}	}	SDL_RWseek(src, start, SEEK_SET);	return(is_XPM);}/* Hash table to look up colors from pixel strings */#define STARTING_HASH_SIZE 256struct hash_entry {	char *key;	Uint32 color;	struct hash_entry *next;};struct color_hash {	struct hash_entry **table;	struct hash_entry *entries; /* array of all entries */	struct hash_entry *next_free;	int size;	int maxnum;};static int hash_key(const char *key, int cpp, int size){	int hash;	hash = 0;	while ( cpp-- > 0 ) {		hash = hash * 33 + *key++;	}	return hash & (size - 1);}static struct color_hash *create_colorhash(int maxnum){	int bytes, s;	struct color_hash *hash;	/* we know how many entries we need, so we can allocate	   everything here */	hash = malloc(sizeof *hash);	if(!hash)		return NULL;	/* use power-of-2 sized hash table for decoding speed */	for(s = STARTING_HASH_SIZE; s < maxnum; s <<= 1)		;	hash->size = s;	hash->maxnum = maxnum;	bytes = hash->size * sizeof(struct hash_entry **);	hash->entries = NULL;	/* in case malloc fails */	hash->table = malloc(bytes);	if(!hash->table)		return NULL;	memset(hash->table, 0, bytes);	hash->entries = malloc(maxnum * sizeof(struct hash_entry));	if(!hash->entries)		return NULL;	hash->next_free = hash->entries;	return hash;}static int add_colorhash(struct color_hash *hash,                         char *key, int cpp, Uint32 color){	int index = hash_key(key, cpp, hash->size);	struct hash_entry *e = hash->next_free++;	e->color = color;	e->key = key;	e->next = hash->table[index];	hash->table[index] = e;	return 1;}/* fast lookup that works if cpp == 1 */#define QUICK_COLORHASH(hash, key) ((hash)->table[*(Uint8 *)(key)]->color)static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp){	struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];	while(entry) {		if(memcmp(key, entry->key, cpp) == 0)			return entry->color;		entry = entry->next;	}	return 0;		/* garbage in - garbage out */}static void free_colorhash(struct color_hash *hash){	if(hash && hash->table) {		free(hash->table);		free(hash->entries);		free(hash);	}}/* portable case-insensitive string comparison */static int string_equal(const char *a, const char *b, int n){	while(*a && *b && n) {		if(toupper((unsigned char)*a) != toupper((unsigned char)*b))			return 0;		a++;		b++;		n--;	}	return *a == *b;}#define ARRAYSIZE(a) (int)(sizeof(a) / sizeof((a)[0]))/* * convert colour spec to RGB (in 0xrrggbb format). * return 1 if successful. */static int color_to_rgb(char *spec, int speclen, Uint32 *rgb){	/* poor man's rgb.txt */	static struct { char *name; Uint32 rgb; } known[] = {		{"none",  0xffffffff},		{"black", 0x00000000},		{"white", 0x00ffffff},		{"red",   0x00ff0000},		{"green", 0x0000ff00},		{"blue",  0x000000ff}	};	if(spec[0] == '#') {		char buf[7];		switch(speclen) {		case 4:			buf[0] = buf[1] = spec[1];			buf[2] = buf[3] = spec[2];			buf[4] = buf[5] = spec[3];			break;		case 7:			memcpy(buf, spec + 1, 6);			break;		case 13:			buf[0] = spec[1];			buf[1] = spec[2];			buf[2] = spec[5];			buf[3] = spec[6];			buf[4] = spec[9];			buf[5] = spec[10];			break;		}		buf[6] = '\0';		*rgb = strtol(buf, NULL, 16);		return 1;	} else {		int i;		for(i = 0; i < ARRAYSIZE(known); i++)			if(string_equal(known[i].name, spec, speclen)) {				*rgb = known[i].rgb;				return 1;			}		return 0;	}}#ifndef MAX#define MAX(a, b) ((a) > (b) ? (a) : (b))#endifstatic char *linebuf;static int buflen;static char *error;/* * Read next line from the source. * If len > 0, it's assumed to be at least len chars (for efficiency). * Return NULL and set error upon EOF or parse error. */static char *get_next_line(char ***lines, SDL_RWops *src, int len){	if(lines) {		return *(*lines)++;	} else {		char c;		int n;		do {			if(SDL_RWread(src, &c, 1, 1) <= 0) {				error = "Premature end of data";				return NULL;			}		} while(c != '"');		if(len) {			len += 4;	/* "\",\n\0" */			if(len > buflen){				buflen = len;				linebuf = realloc(linebuf, buflen);				if(!linebuf) {					error = "Out of memory";					return NULL;				}			}			if(SDL_RWread(src, linebuf, len - 1, 1) <= 0) {				error = "Premature end of data";				return NULL;			}			n = len - 2;		} else {			n = 0;			do {				if(n >= buflen - 1) {					if(buflen == 0)						buflen = 16;					buflen *= 2;					linebuf = realloc(linebuf, buflen);					if(!linebuf) {						error = "Out of memory";						return NULL;					}				}				if(SDL_RWread(src, linebuf + n, 1, 1) <= 0) {					error = "Premature end of data";					return NULL;				}			} while(linebuf[n++] != '"');			n--;		}		linebuf[n] = '\0';		return linebuf;	}}#define SKIPSPACE(p)				\do {						\	while(isspace((unsigned char)*(p)))	\	      ++(p);				\} while(0)#define SKIPNONSPACE(p)					\do {							\	while(!isspace((unsigned char)*(p)) && *p)	\	      ++(p);					\} while(0)/* read XPM from either array or RWops */static SDL_Surface *load_xpm(char **xpm, SDL_RWops *src){	int start = 0;	SDL_Surface *image = NULL;	int index;	int x, y;	int w, h, ncolors, cpp;	int indexed;	Uint8 *dst;	struct color_hash *colors = NULL;	SDL_Color *im_colors = NULL;	char *keystrings = NULL, *nextkey;	char *line;	char ***xpmlines = NULL;	int pixels_len;	error = NULL;	linebuf = NULL;	buflen = 0;	if ( src ) 		start = SDL_RWtell(src);	if(xpm)		xpmlines = &xpm;	line = get_next_line(xpmlines, src, 0);	if(!line)		goto done;	/*	 * The header string of an XPMv3 image has the format	 *	 * <width> <height> <ncolors> <cpp> [ <hotspot_x> <hotspot_y> ]	 *	 * where the hotspot coords are intended for mouse cursors.	 * Right now we don't use the hotspots but it should be handled	 * one day.	 */	if(sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4	   || w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) {		error = "Invalid format description";		goto done;	}	keystrings = malloc(ncolors * cpp);	if(!keystrings) {		error = "Out of memory";		goto done;	}	nextkey = keystrings;	/* Create the new surface */	if(ncolors <= 256) {		indexed = 1;		image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,					     0, 0, 0, 0);		im_colors = image->format->palette->colors;		image->format->palette->ncolors = ncolors;	} else {		indexed = 0;		image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,					     0xff0000, 0x00ff00, 0x0000ff, 0);	}	if(!image) {		/* Hmm, some SDL error (out of memory?) */		goto done;	}	/* Read the colors */	colors = create_colorhash(ncolors);	if (!colors) {		error = "Out of memory";		goto done;	}	for(index = 0; index < ncolors; ++index ) {		char *p;		line = get_next_line(xpmlines, src, 0);		if(!line)			goto done;		p = line + cpp + 1;		/* parse a colour definition */		for(;;) {			char nametype;			char *colname;			Uint32 rgb, pixel;			SKIPSPACE(p);			if(!*p) {				error = "colour parse error";				goto done;			}			nametype = *p;			SKIPNONSPACE(p);			SKIPSPACE(p);			colname = p;			SKIPNONSPACE(p);			if(nametype == 's')				continue;      /* skip symbolic colour names */			if(!color_to_rgb(colname, p - colname, &rgb))				continue;			memcpy(nextkey, line, cpp);			if(indexed) {				SDL_Color *c = im_colors + index;				c->r = (Uint8)(rgb >> 16);				c->g = (Uint8)(rgb >> 8);				c->b = (Uint8)(rgb);				pixel = index;			} else				pixel = rgb;			add_colorhash(colors, nextkey, cpp, pixel);			nextkey += cpp;			if(rgb == 0xffffffff)				SDL_SetColorKey(image, SDL_SRCCOLORKEY, pixel);			break;		}	}	/* Read the pixels */	pixels_len = w * cpp;	dst = image->pixels;	for(y = 0; y < h; y++) {		line = get_next_line(xpmlines, src, pixels_len);		if(indexed) {			/* optimization for some common cases */			if(cpp == 1)				for(x = 0; x < w; x++)					dst[x] = (Uint8)QUICK_COLORHASH(colors,								 line + x);			else				for(x = 0; x < w; x++)					dst[x] = (Uint8)get_colorhash(colors,							       line + x * cpp,							       cpp);		} else {			for (x = 0; x < w; x++)				((Uint32*)dst)[x] = get_colorhash(colors,								line + x * cpp,								  cpp);		}		dst += image->pitch;	}done:	if(error) {		if ( src )			SDL_RWseek(src, start, SEEK_SET);		if ( image ) {			SDL_FreeSurface(image);			image = NULL;		}		IMG_SetError(error);	}	free(keystrings);	free_colorhash(colors);	free(linebuf);	return(image);}/* Load a XPM type image from an RWops datasource */SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src){	if ( !src ) {		/* The error message has been set in SDL_RWFromFile */		return NULL;	}	return load_xpm(NULL, src);}SDL_Surface *IMG_ReadXPMFromArray(char **xpm){	return load_xpm(xpm, NULL);}#else  /* not LOAD_XPM *//* See if an image is contained in a data source */int IMG_isXPM(SDL_RWops *src){	return(0);}/* Load a XPM type image from an SDL datasource */SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src){	return(NULL);}SDL_Surface *IMG_ReadXPMFromArray(char **xpm){    return NULL;}#endif /* not LOAD_XPM */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美高清dvd碟片| 不卡av免费在线观看| 午夜久久久久久久久| 亚洲中国最大av网站| 亚洲一区av在线| 男人的天堂久久精品| 精品一区二区三区免费观看 | 97se亚洲国产综合自在线| 91丨国产丨九色丨pron| 欧美精品在欧美一区二区少妇| 国产成人亚洲精品青草天美| va亚洲va日韩不卡在线观看| 男人的天堂亚洲一区| 精品国产污污免费网站入口 | 色综合天天综合色综合av| av欧美精品.com| 欧美美女网站色| 久久亚洲捆绑美女| 亚洲最新在线观看| 极品美女销魂一区二区三区免费| 不卡av电影在线播放| 欧美一级生活片| 亚洲欧美偷拍三级| 国产又黄又大久久| 在线一区二区三区四区| 国产性做久久久久久| 首页亚洲欧美制服丝腿| 不卡一区二区三区四区| 日韩三级在线观看| 亚洲国产视频直播| 欧美一区二区美女| 国产精品毛片a∨一区二区三区| 捆绑调教美女网站视频一区| 91国产成人在线| 亚洲sss视频在线视频| 欧美xxxxxxxx| 欧美日韩电影在线| 99热这里都是精品| 国产乱码精品一品二品| 日韩电影一区二区三区四区| 国产欧美日韩亚州综合| 欧美另类高清zo欧美| 色欧美88888久久久久久影院| 九九视频精品免费| 日韩电影在线观看网站| 一级精品视频在线观看宜春院 | 亚洲综合免费观看高清完整版| 精品国产凹凸成av人网站| 欧美男生操女生| 欧美一区国产二区| 精品视频一区二区三区免费| 欧美优质美女网站| 色999日韩国产欧美一区二区| 丰满少妇久久久久久久| 国产剧情在线观看一区二区| 黄色小说综合网站| 国内不卡的二区三区中文字幕| 久久女同性恋中文字幕| 制服丝袜在线91| 欧美大片在线观看一区| 欧美v国产在线一区二区三区| 日韩一级在线观看| 久久久久久久久久久久久久久99 | 91极品美女在线| 欧美在线|欧美| 日韩欧美国产成人一区二区| 久久精品人人爽人人爽| 亚洲国产成人自拍| 亚洲一二三四区不卡| 日韩一区欧美二区| 国产福利精品导航| av一区二区三区四区| 欧美蜜桃一区二区三区| 久久日韩精品一区二区五区| 国产精品美女久久久久久久| 亚洲自拍偷拍综合| 狠狠狠色丁香婷婷综合激情 | 精品国产髙清在线看国产毛片| 亚洲精品一区二区三区99| 亚洲人妖av一区二区| 欧美性猛交xxxx乱大交退制版| 99久久精品99国产精品| 日韩一卡二卡三卡| 亚洲激情欧美激情| 国产精品亚洲专一区二区三区 | 成人免费观看av| 欧美一区二区三区在线观看视频| 国产精品视频一二| 精品在线亚洲视频| 欧美欧美午夜aⅴ在线观看| 中文在线资源观看网站视频免费不卡| 一区二区三区日韩精品| 国产成人一级电影| 国产欧美久久久精品影院| 日韩电影网1区2区| 欧美日韩在线播放| 亚洲第一主播视频| 欧美日韩另类一区| 亚洲免费视频中文字幕| www.亚洲在线| 亚洲最新在线观看| 蜜桃免费网站一区二区三区| 99久久久久免费精品国产| 国产视频一区二区在线观看| 91天堂素人约啪| 免费av成人在线| 久久网站热最新地址| eeuss鲁一区二区三区| 亚洲老妇xxxxxx| 91精品福利在线一区二区三区 | 亚洲三级免费电影| 欧美大胆人体bbbb| 色菇凉天天综合网| 成人av网站在线| 国产精品自拍在线| 久草在线在线精品观看| 午夜精品123| 亚洲gay无套男同| 亚洲免费在线观看视频| 中文字幕免费一区| 久久久国产精品午夜一区ai换脸| 91精品国产综合久久福利软件| 欧美一卡2卡3卡4卡| 欧美日韩五月天| 欧美久久久一区| 91精品麻豆日日躁夜夜躁| 91日韩在线专区| 在线影院国内精品| 欧美性生活影院| 欧美日韩国产一区二区三区地区| 欧美中文字幕一二三区视频| 成人av小说网| 不卡一卡二卡三乱码免费网站| 99精品黄色片免费大全| 成人国产精品免费观看| 91美女福利视频| 91精选在线观看| 日韩一区二区在线免费观看| 精品粉嫩超白一线天av| 国产精品美女一区二区在线观看| 最新高清无码专区| 爽好久久久欧美精品| 国产最新精品精品你懂的| 成人免费电影视频| 欧美日韩一区中文字幕| 2020国产精品自拍| 亚洲精品videosex极品| 亚洲综合视频在线| 男女激情视频一区| 懂色av一区二区三区蜜臀| 成人久久18免费网站麻豆 | 久久福利视频一区二区| 丰满少妇久久久久久久| 欧美亚洲国产一区二区三区va| 欧美岛国在线观看| 中文字幕在线不卡一区二区三区| 一区二区三区国产| 国产精品一区在线| 欧美日韩在线精品一区二区三区激情| 精品国产一区久久| 亚洲国产sm捆绑调教视频 | 亚洲欧美一区二区视频| 亚洲va天堂va国产va久| 青青青伊人色综合久久| av资源网一区| 2021中文字幕一区亚洲| 水蜜桃久久夜色精品一区的特点| 国产在线精品一区在线观看麻豆| 欧美网站一区二区| 精品国产一区a| 日本 国产 欧美色综合| 色素色在线综合| 国产欧美一区二区精品婷婷 | 中日韩免费视频中文字幕| 久久精品国产精品亚洲精品| 欧美日韩免费观看一区二区三区| 最新不卡av在线| aaa亚洲精品| 天天色天天爱天天射综合| 成人妖精视频yjsp地址| 日韩精品中文字幕一区| 亚洲成人高清在线| 欧美专区亚洲专区| 亚洲图片你懂的| 色综合一区二区三区| 中文字幕欧美一| 欧美综合欧美视频| 亚洲色图欧洲色图婷婷| 在线一区二区三区| 免费欧美高清视频| 中文字幕字幕中文在线中不卡视频| 欧美在线你懂得| 国产精一品亚洲二区在线视频| 亚洲国产精华液网站w | 国内久久精品视频| 亚洲人成伊人成综合网小说| 欧美日韩日日夜夜| 激情另类小说区图片区视频区| 欧美成人bangbros| jlzzjlzz亚洲女人18|