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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? img_jpg.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*//* This is a JPEG image file loading framework */#include <stdio.h>#include <string.h>#include <setjmp.h>#include "SDL_image.h"#ifdef LOAD_JPG#include <jpeglib.h>/* Define this for fast loading and not as good image quality *//*#define FAST_JPEG*//* Define this for quicker (but less perfect) JPEG identification */#define FAST_IS_JPEGstatic struct {	int loaded;	void *handle;	void (*jpeg_calc_output_dimensions) (j_decompress_ptr cinfo);	void (*jpeg_CreateDecompress) (j_decompress_ptr cinfo, int version, size_t structsize);	void (*jpeg_destroy_decompress) (j_decompress_ptr cinfo);	boolean (*jpeg_finish_decompress) (j_decompress_ptr cinfo);	int (*jpeg_read_header) (j_decompress_ptr cinfo, boolean require_image);	JDIMENSION (*jpeg_read_scanlines) (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines);	boolean (*jpeg_resync_to_restart) (j_decompress_ptr cinfo, int desired);	boolean (*jpeg_start_decompress) (j_decompress_ptr cinfo);	struct jpeg_error_mgr * (*jpeg_std_error) (struct jpeg_error_mgr * err);} lib;#ifdef LOAD_JPG_DYNAMICint IMG_InitJPG(){	if ( lib.loaded == 0 ) {		lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);		if ( lib.handle == NULL ) {			return -1;		}		lib.jpeg_calc_output_dimensions =			(void (*) (j_decompress_ptr))			SDL_LoadFunction(lib.handle, "jpeg_calc_output_dimensions");		if ( lib.jpeg_calc_output_dimensions == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_CreateDecompress = 			(void (*) (j_decompress_ptr, int, size_t))			SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress");		if ( lib.jpeg_CreateDecompress == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_destroy_decompress = 			(void (*) (j_decompress_ptr))			SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress");		if ( lib.jpeg_destroy_decompress == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_finish_decompress = 			(boolean (*) (j_decompress_ptr))			SDL_LoadFunction(lib.handle, "jpeg_finish_decompress");		if ( lib.jpeg_finish_decompress == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_read_header = 			(int (*) (j_decompress_ptr, boolean))			SDL_LoadFunction(lib.handle, "jpeg_read_header");		if ( lib.jpeg_read_header == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_read_scanlines = 			(JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION))			SDL_LoadFunction(lib.handle, "jpeg_read_scanlines");		if ( lib.jpeg_read_scanlines == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_resync_to_restart = 			(boolean (*) (j_decompress_ptr, int))			SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart");		if ( lib.jpeg_resync_to_restart == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_start_decompress = 			(boolean (*) (j_decompress_ptr))			SDL_LoadFunction(lib.handle, "jpeg_start_decompress");		if ( lib.jpeg_start_decompress == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}		lib.jpeg_std_error = 			(struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *))			SDL_LoadFunction(lib.handle, "jpeg_std_error");		if ( lib.jpeg_std_error == NULL ) {			SDL_UnloadObject(lib.handle);			return -1;		}	}	++lib.loaded;	return 0;}void IMG_QuitJPG(){	if ( lib.loaded == 0 ) {		return;	}	if ( lib.loaded == 1 ) {		SDL_UnloadObject(lib.handle);	}	--lib.loaded;}#elseint IMG_InitJPG(){	if ( lib.loaded == 0 ) {		lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;		lib.jpeg_CreateDecompress = jpeg_CreateDecompress;		lib.jpeg_destroy_decompress = jpeg_destroy_decompress;		lib.jpeg_finish_decompress = jpeg_finish_decompress;		lib.jpeg_read_header = jpeg_read_header;		lib.jpeg_read_scanlines = jpeg_read_scanlines;		lib.jpeg_resync_to_restart = jpeg_resync_to_restart;		lib.jpeg_start_decompress = jpeg_start_decompress;		lib.jpeg_std_error = jpeg_std_error;	}	++lib.loaded;	return 0;}void IMG_QuitJPG(){	if ( lib.loaded == 0 ) {		return;	}	if ( lib.loaded == 1 ) {	}	--lib.loaded;}#endif /* LOAD_JPG_DYNAMIC *//* See if an image is contained in a data source */int IMG_isJPG(SDL_RWops *src){	int start;	int is_JPG;	int in_scan;	Uint8 magic[4];	/* This detection code is by Steaphan Greene <stea@cs.binghamton.edu> */	/* Blame me, not Sam, if this doesn't work right. */	/* And don't forget to report the problem to the the sdl list too! */	if ( !src )		return 0;	start = SDL_RWtell(src);	is_JPG = 0;	in_scan = 0;	if ( SDL_RWread(src, magic, 2, 1) ) {		if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) {			is_JPG = 1;			while (is_JPG == 1) {				if(SDL_RWread(src, magic, 1, 2) != 2) {					is_JPG = 0;				} else if( (magic[0] != 0xFF) && (in_scan == 0) ) {					is_JPG = 0;				} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {					/* Extra padding in JPEG (legal) */					/* or this is data and we are scanning */					SDL_RWseek(src, -1, SEEK_CUR);				} else if(magic[1] == 0xD9) {					/* Got to end of good JPEG */					break;				} else if( (in_scan == 1) && (magic[1] == 0x00) ) {					/* This is an encoded 0xFF within the data */				} else if( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) {					/* These have nothing else */				} else if(SDL_RWread(src, magic+2, 1, 2) != 2) {					is_JPG = 0;				} else {					/* Yes, it's big-endian */					Uint32 start;					Uint32 size;					Uint32 end;					start = SDL_RWtell(src);					size = (magic[2] << 8) + magic[3];					end = SDL_RWseek(src, size-2, SEEK_CUR);					if ( end != start + size - 2 ) is_JPG = 0;					if ( magic[1] == 0xDA ) {						/* Now comes the actual JPEG meat */#ifdef	FAST_IS_JPEG						/* Ok, I'm convinced.  It is a JPEG. */						break;#else						/* I'm not convinced.  Prove it! */						in_scan = 1;#endif					}				}			}		}	}	SDL_RWseek(src, start, SEEK_SET);	return(is_JPG);}#define INPUT_BUFFER_SIZE	4096typedef struct {	struct jpeg_source_mgr pub;	SDL_RWops *ctx;	Uint8 buffer[INPUT_BUFFER_SIZE];} my_source_mgr;/* * Initialize source --- called by jpeg_read_header * before any data is actually read. */static void init_source (j_decompress_ptr cinfo){	/* We don't actually need to do anything */	return;}/* * Fill the input buffer --- called whenever buffer is emptied. */static int fill_input_buffer (j_decompress_ptr cinfo){	my_source_mgr * src = (my_source_mgr *) cinfo->src;	int nbytes;	nbytes = SDL_RWread(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);	if (nbytes <= 0) {		/* Insert a fake EOI marker */		src->buffer[0] = (Uint8) 0xFF;		src->buffer[1] = (Uint8) JPEG_EOI;		nbytes = 2;	}	src->pub.next_input_byte = src->buffer;	src->pub.bytes_in_buffer = nbytes;	return TRUE;}/* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). * * Writers of suspendable-input applications must note that skip_input_data * is not granted the right to give a suspension return.  If the skip extends * beyond the data currently in the buffer, the buffer can be marked empty so * that the next read will cause a fill_input_buffer call that can suspend. * Arranging for additional bytes to be discarded before reloading the input * buffer is the application writer's problem. */static void skip_input_data (j_decompress_ptr cinfo, long num_bytes){	my_source_mgr * src = (my_source_mgr *) cinfo->src;	/* Just a dumb implementation for now.	Could use fseek() except	 * it doesn't work on pipes.  Not clear that being smart is worth	 * any trouble anyway --- large skips are infrequent.	 */	if (num_bytes > 0) {		while (num_bytes > (long) src->pub.bytes_in_buffer) {			num_bytes -= (long) src->pub.bytes_in_buffer;			(void) src->pub.fill_input_buffer(cinfo);			/* note we assume that fill_input_buffer will never			 * return FALSE, so suspension need not be handled.			 */		}		src->pub.next_input_byte += (size_t) num_bytes;		src->pub.bytes_in_buffer -= (size_t) num_bytes;	}}/* * Terminate source --- called by jpeg_finish_decompress * after all data has been read. */static void term_source (j_decompress_ptr cinfo){	/* We don't actually need to do anything */	return;}/* * Prepare for input from a stdio stream. * The caller must have already opened the stream, and is responsible * for closing it after finishing decompression. */static void jpeg_SDL_RW_src (j_decompress_ptr cinfo, SDL_RWops *ctx){  my_source_mgr *src;  /* The source object and input buffer are made permanent so that a series   * of JPEG images can be read from the same file by calling jpeg_stdio_src   * only before the first one.  (If we discarded the buffer at the end of   * one image, we'd likely lose the start of the next one.)   * This makes it unsafe to use this manager and a different source   * manager serially with the same JPEG object.  Caveat programmer.   */  if (cinfo->src == NULL) {	/* first time for this JPEG object? */    cinfo->src = (struct jpeg_source_mgr *)      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,				  sizeof(my_source_mgr));    src = (my_source_mgr *) cinfo->src;  }  src = (my_source_mgr *) cinfo->src;  src->pub.init_source = init_source;  src->pub.fill_input_buffer = fill_input_buffer;  src->pub.skip_input_data = skip_input_data;  src->pub.resync_to_restart = lib.jpeg_resync_to_restart; /* use default method */  src->pub.term_source = term_source;  src->ctx = ctx;  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */  src->pub.next_input_byte = NULL; /* until buffer loaded */}struct my_error_mgr {	struct jpeg_error_mgr errmgr;	jmp_buf escape;};static void my_error_exit(j_common_ptr cinfo){	struct my_error_mgr *err = (struct my_error_mgr *)cinfo->err;	longjmp(err->escape, 1);}static void output_no_message(j_common_ptr cinfo){	/* do nothing */}/* Load a JPEG type image from an SDL datasource */SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src){	int start;	struct jpeg_decompress_struct cinfo;	JSAMPROW rowptr[1];	SDL_Surface *volatile surface = NULL;	struct my_error_mgr jerr;	if ( !src ) {		/* The error message has been set in SDL_RWFromFile */		return NULL;	}	start = SDL_RWtell(src);	if ( IMG_InitJPG() < 0 ) {		return NULL;	}	/* Create a decompression structure and load the JPEG header */	cinfo.err = lib.jpeg_std_error(&jerr.errmgr);	jerr.errmgr.error_exit = my_error_exit;	jerr.errmgr.output_message = output_no_message;	if(setjmp(jerr.escape)) {		/* If we get here, libjpeg found an error */		lib.jpeg_destroy_decompress(&cinfo);		if ( surface != NULL ) {			SDL_FreeSurface(surface);		}		SDL_RWseek(src, start, SEEK_SET);		IMG_QuitJPG();		IMG_SetError("JPEG loading error");		return NULL;	}	lib.jpeg_create_decompress(&cinfo);	jpeg_SDL_RW_src(&cinfo, src);	lib.jpeg_read_header(&cinfo, TRUE);	if(cinfo.num_components == 4) {		/* Set 32-bit Raw output */		cinfo.out_color_space = JCS_CMYK;		cinfo.quantize_colors = FALSE;		lib.jpeg_calc_output_dimensions(&cinfo);		/* Allocate an output surface to hold the image */		surface = SDL_AllocSurface(SDL_SWSURFACE,		        cinfo.output_width, cinfo.output_height, 32,#if SDL_BYTEORDER == SDL_LIL_ENDIAN		                   0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);#else		                   0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF);#endif	} else {		/* Set 24-bit RGB output */		cinfo.out_color_space = JCS_RGB;		cinfo.quantize_colors = FALSE;#ifdef FAST_JPEG		cinfo.scale_num   = 1;		cinfo.scale_denom = 1;		cinfo.dct_method = JDCT_FASTEST;		cinfo.do_fancy_upsampling = FALSE;#endif		lib.jpeg_calc_output_dimensions(&cinfo);		/* Allocate an output surface to hold the image */		surface = SDL_AllocSurface(SDL_SWSURFACE,		        cinfo.output_width, cinfo.output_height, 24,#if SDL_BYTEORDER == SDL_LIL_ENDIAN		                   0x0000FF, 0x00FF00, 0xFF0000,#else		                   0xFF0000, 0x00FF00, 0x0000FF,#endif		                   0);	}	if ( surface == NULL ) {		lib.jpeg_destroy_decompress(&cinfo);		SDL_RWseek(src, start, SEEK_SET);		IMG_QuitJPG();		IMG_SetError("Out of memory");		return NULL;	}	/* Decompress the image */	lib.jpeg_start_decompress(&cinfo);	while ( cinfo.output_scanline < cinfo.output_height ) {		rowptr[0] = (JSAMPROW)(Uint8 *)surface->pixels +		                    cinfo.output_scanline * surface->pitch;		lib.jpeg_read_scanlines(&cinfo, rowptr, (JDIMENSION) 1);	}	lib.jpeg_finish_decompress(&cinfo);	lib.jpeg_destroy_decompress(&cinfo);	IMG_QuitJPG();	return(surface);}#else/* See if an image is contained in a data source */int IMG_isJPG(SDL_RWops *src){	return(0);}/* Load a JPEG type image from an SDL datasource */SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src){	return(NULL);}#endif /* LOAD_JPG */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91亚洲精品一区二区乱码| 精品91自产拍在线观看一区| 麻豆精品新av中文字幕| 中文字幕av资源一区| 欧美美女bb生活片| www.亚洲精品| 久久精品国产久精国产爱| 亚洲天堂2014| 久久午夜电影网| 欧美亚洲综合在线| 成人av集中营| 狠狠色综合色综合网络| 亚洲成人av免费| 欧美日韩国产影片| 久久99国产精品免费| 在线电影院国产精品| 亚洲成av人片在线观看无码| 欧美精品tushy高清| 九九在线精品视频| 久久久久99精品国产片| 99视频在线精品| 五月综合激情网| 精品日韩欧美在线| 国产精品久久777777| 粗大黑人巨茎大战欧美成人| 久久国产福利国产秒拍| 日韩中文欧美在线| 亚洲福利一区二区| 久久天天做天天爱综合色| 色天天综合久久久久综合片| 亚洲主播在线观看| 26uuu精品一区二区| 91香蕉视频污在线| 午夜精品视频在线观看| 国产欧美一区二区三区在线看蜜臀| av日韩在线网站| 日韩av中文在线观看| 久久久一区二区三区捆绑**| 色8久久精品久久久久久蜜| 亚洲精品成人少妇| 久久久另类综合| 欧美一级黄色大片| 国产激情一区二区三区桃花岛亚洲| 亚洲天堂a在线| 久久久美女艺术照精彩视频福利播放| 日韩福利电影在线| 日韩一区二区三区电影 | 国产精品毛片久久久久久| 91豆麻精品91久久久久久| 欧美亚洲一区三区| 中文字幕va一区二区三区| 久久久久9999亚洲精品| 久久综合九色综合欧美就去吻| 精品欧美一区二区在线观看| 亚洲精品一区二区三区在线观看| 日韩三级视频在线看| 欧美成人在线直播| 久久久高清一区二区三区| 国产精品久久久久影院亚瑟| 久久久久久**毛片大全| 欧美精品自拍偷拍动漫精品| 91首页免费视频| 91丨porny丨最新| 日韩一级免费观看| 蜜桃精品视频在线| 亚洲在线视频一区| 天天综合网天天综合色| 麻豆91在线观看| 久久综合狠狠综合久久综合88 | 国产精品卡一卡二| 亚洲天堂福利av| 亚洲国产成人va在线观看天堂| 蜜桃av一区二区三区| 国产成人综合网| 欧美羞羞免费网站| 日韩欧美久久久| 国产精品网站在线| 亚洲线精品一区二区三区| 麻豆一区二区三| 成人黄色电影在线| 欧美顶级少妇做爰| 中文字幕av一区二区三区免费看| 亚洲韩国精品一区| 国产成人在线观看免费网站| 日本丰满少妇一区二区三区| 日韩美女在线视频| 日韩美女一区二区三区四区| 日韩亚洲电影在线| 国产伦精一区二区三区| 色婷婷久久综合| 亚洲成人av免费| 大陆成人av片| 日韩精品一区二区在线| 一区二区成人在线视频| 青青草91视频| 色94色欧美sute亚洲13| 精品国产一区a| 亚洲国产日韩精品| 色噜噜狠狠色综合中国| www欧美成人18+| 久久奇米777| 亚洲六月丁香色婷婷综合久久| 日本少妇一区二区| 91丨九色丨蝌蚪富婆spa| 国产女同互慰高潮91漫画| 51精品秘密在线观看| 欧美日韩一区二区三区视频 | 在线日韩av片| 亚洲精品福利视频网站| 丁香六月久久综合狠狠色| 国产色婷婷亚洲99精品小说| av中文字幕不卡| 国内精品国产三级国产a久久| |精品福利一区二区三区| 国产91精品露脸国语对白| 久久免费偷拍视频| 久草在线在线精品观看| 精品国产一区久久| 免费人成黄页网站在线一区二区| 97精品久久久午夜一区二区三区| 午夜精品久久久久| 久久精品一区二区三区不卡| 蜜桃av一区二区三区电影| 久久综合精品国产一区二区三区| 中文字幕一区二区三区不卡| 日韩精品专区在线影院重磅| 在线观看国产精品网站| 麻豆成人91精品二区三区| 一区二区在线看| 久久女同性恋中文字幕| 96av麻豆蜜桃一区二区| 亚洲天堂网中文字| 日韩精品一区二区三区在线播放| 三级欧美在线一区| 国产欧美日韩久久| 粉嫩aⅴ一区二区三区四区五区| 亚洲人成精品久久久久久| 91精品国模一区二区三区| 极品少妇一区二区| 天天色天天操综合| 久久亚洲综合av| 91久久国产最好的精华液| 麻豆免费精品视频| 国产精品第四页| 91精品久久久久久久99蜜桃| 国产在线视频不卡二| 国产视频一区二区三区在线观看| 成人性生交大片免费| k8久久久一区二区三区| 亚洲日本中文字幕区| 2023国产精品| 久久久精品2019中文字幕之3| 欧美一级一级性生活免费录像| 成人av动漫在线| 成人黄色国产精品网站大全在线免费观看 | 琪琪久久久久日韩精品| 中文字幕在线不卡| 99国内精品久久| 亚洲色图清纯唯美| 欧美在线观看视频一区二区三区| 一区二区三区在线视频免费| 欧美日韩视频一区二区| 热久久久久久久| 久久久91精品国产一区二区精品| 国产成人福利片| 亚洲天堂中文字幕| 88在线观看91蜜桃国自产| 青青草精品视频| 国产亚洲一区二区三区| 91视频.com| 五月天丁香久久| 久久网站热最新地址| 99久久精品国产一区二区三区| 亚洲高清一区二区三区| 精品国产一区二区三区av性色| 不卡影院免费观看| 婷婷六月综合亚洲| 国产亚洲精品超碰| 欧美午夜不卡视频| 国产精品自拍一区| 亚洲国产成人精品视频| 久久久亚洲精品石原莉奈| 91视频你懂的| 久久99精品视频| 亚洲精品乱码久久久久久| 欧美xfplay| 一本久久综合亚洲鲁鲁五月天 | 亚洲精品日韩一| 欧美不卡激情三级在线观看| 97精品电影院| 精品在线免费视频| 夜夜嗨av一区二区三区四季av| 精品国产一区二区三区av性色| 色美美综合视频| 国产传媒日韩欧美成人| 亚洲综合偷拍欧美一区色| 久久影院电视剧免费观看| 欧洲国产伦久久久久久久| 丰满少妇在线播放bd日韩电影| 日韩成人dvd|