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

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

?? img_bmp.c

?? It is extension program for SDL to display images other than bmp, but all the other formats.
?? C
字號(hào):
/*    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 BMP image file loading framework */#include <stdio.h>#include <string.h>#include "SDL_image.h"#ifdef LOAD_BMP/* See if an image is contained in a data source */int IMG_isBMP(SDL_RWops *src){	int start;	int is_BMP;	char magic[2];	if ( !src )		return 0;	start = SDL_RWtell(src);	is_BMP = 0;	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {		if ( strncmp(magic, "BM", 2) == 0 ) {			is_BMP = 1;		}	}	SDL_RWseek(src, start, SEEK_SET);	return(is_BMP);}#include "SDL_error.h"#include "SDL_video.h"#include "SDL_endian.h"/* Compression encodings for BMP files */#ifndef BI_RGB#define BI_RGB		0#define BI_RLE8		1#define BI_RLE4		2#define BI_BITFIELDS	3#endifstatic int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8){	/*	| Sets the surface pixels from src.  A bmp image is upside down.	*/	int pitch = surface->pitch;	int height = surface->h;	Uint8 *start = (Uint8 *)surface->pixels;	Uint8 *end = start + (height*pitch);	Uint8 *bits = end-pitch, *spot;	int ofs = 0;	Uint8 ch;	Uint8 needsPad;#define COPY_PIXEL(x)	spot = &bits[ofs++]; if(spot >= start && spot < end) *spot = (x)	for (;;) {		if ( !SDL_RWread(src, &ch, 1, 1) ) return 1;		/*		| encoded mode starts with a run length, and then a byte		| with two colour indexes to alternate between for the run		*/		if ( ch ) {			Uint8 pixel;			if ( !SDL_RWread(src, &pixel, 1, 1) ) return 1;			if ( isRle8 ) {                 /* 256-color bitmap, compressed */				do {					COPY_PIXEL(pixel);				} while (--ch);			} else {                         /* 16-color bitmap, compressed */				Uint8 pixel0 = pixel >> 4;				Uint8 pixel1 = pixel & 0x0F;				for (;;) {					COPY_PIXEL(pixel0);	/* even count, high nibble */					if (!--ch) break;					COPY_PIXEL(pixel1);	/* odd count, low nibble */					if (!--ch) break;				}			}		} else {			/*			| A leading zero is an escape; it may signal the end of the bitmap,			| a cursor move, or some absolute data.			| zero tag may be absolute mode or an escape			*/			if ( !SDL_RWread(src, &ch, 1, 1) ) return 1;			switch (ch) {			case 0:                         /* end of line */				ofs = 0;				bits -= pitch;               /* go to previous */				break;			case 1:                         /* end of bitmap */				return 0;                    /* success! */			case 2:                         /* delta */				if ( !SDL_RWread(src, &ch, 1, 1) ) return 1;				ofs += ch;				if ( !SDL_RWread(src, &ch, 1, 1) ) return 1;				bits -= (ch * pitch);				break;			default:                        /* no compression */				if (isRle8) {					needsPad = ( ch & 1 );					do {						Uint8 pixel;						if ( !SDL_RWread(src, &pixel, 1, 1) ) return 1;						COPY_PIXEL(pixel);					} while (--ch);				} else {					needsPad = ( ((ch+1)>>1) & 1 ); /* (ch+1)>>1: bytes size */					for (;;) {						Uint8 pixel;						if ( !SDL_RWread(src, &pixel, 1, 1) ) return 1;						COPY_PIXEL(pixel >> 4);						if (!--ch) break;						COPY_PIXEL(pixel & 0x0F);						if (!--ch) break;					}				}				/* pad at even boundary */				if ( needsPad && !SDL_RWread(src, &ch, 1, 1) ) return 1;				break;			}		}	}}static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc){	int was_error;	long fp_offset;	int bmpPitch;	int i, pad;	SDL_Surface *surface;	Uint32 Rmask;	Uint32 Gmask;	Uint32 Bmask;	Uint32 Amask;	SDL_Palette *palette;	Uint8 *bits;	int ExpandBMP;	/* The Win32 BMP file header (14 bytes) */	char   magic[2];	Uint32 bfSize;	Uint16 bfReserved1;	Uint16 bfReserved2;	Uint32 bfOffBits;	/* The Win32 BITMAPINFOHEADER struct (40 bytes) */	Uint32 biSize;	Sint32 biWidth;	Sint32 biHeight;	Uint16 biPlanes;	Uint16 biBitCount;	Uint32 biCompression;	Uint32 biSizeImage;	Sint32 biXPelsPerMeter;	Sint32 biYPelsPerMeter;	Uint32 biClrUsed;	Uint32 biClrImportant;	/* Make sure we are passed a valid data source */	surface = NULL;	was_error = 0;	if ( src == NULL ) {		was_error = 1;		goto done;	}	/* Read in the BMP file header */	fp_offset = SDL_RWtell(src);	SDL_ClearError();	if ( SDL_RWread(src, magic, 1, 2) != 2 ) {		SDL_Error(SDL_EFREAD);		was_error = 1;		goto done;	}	if ( strncmp(magic, "BM", 2) != 0 ) {		SDL_SetError("File is not a Windows BMP file");		was_error = 1;		goto done;	}	bfSize		= SDL_ReadLE32(src);	bfReserved1	= SDL_ReadLE16(src);	bfReserved2	= SDL_ReadLE16(src);	bfOffBits	= SDL_ReadLE32(src);	/* Read the Win32 BITMAPINFOHEADER */	biSize		= SDL_ReadLE32(src);	if ( biSize == 12 ) {		biWidth		= (Uint32)SDL_ReadLE16(src);		biHeight	= (Uint32)SDL_ReadLE16(src);		biPlanes	= SDL_ReadLE16(src);		biBitCount	= SDL_ReadLE16(src);		biCompression	= BI_RGB;		biSizeImage	= 0;		biXPelsPerMeter	= 0;		biYPelsPerMeter	= 0;		biClrUsed	= 0;		biClrImportant	= 0;	} else {		biWidth		= SDL_ReadLE32(src);		biHeight	= SDL_ReadLE32(src);		biPlanes	= SDL_ReadLE16(src);		biBitCount	= SDL_ReadLE16(src);		biCompression	= SDL_ReadLE32(src);		biSizeImage	= SDL_ReadLE32(src);		biXPelsPerMeter	= SDL_ReadLE32(src);		biYPelsPerMeter	= SDL_ReadLE32(src);		biClrUsed	= SDL_ReadLE32(src);		biClrImportant	= SDL_ReadLE32(src);	}	/* Check for read error */	if ( strcmp(SDL_GetError(), "") != 0 ) {		was_error = 1;		goto done;	}	/* Expand 1 and 4 bit bitmaps to 8 bits per pixel */	switch (biBitCount) {		case 1:		case 4:			ExpandBMP = biBitCount;			biBitCount = 8;			break;		default:			ExpandBMP = 0;			break;	}	/* RLE4 and RLE8 BMP compression is supported */	Rmask = Gmask = Bmask = Amask = 0;	switch (biCompression) {		case BI_RGB:			/* If there are no masks, use the defaults */			if ( bfOffBits == (14+biSize) ) {				/* Default values for the BMP format */				switch (biBitCount) {					case 15:					case 16:						Rmask = 0x7C00;						Gmask = 0x03E0;						Bmask = 0x001F;						break;					case 24:#if SDL_BYTEORDER == SDL_BIG_ENDIAN					        Rmask = 0x000000FF;					        Gmask = 0x0000FF00;					        Bmask = 0x00FF0000;#else						Rmask = 0x00FF0000;						Gmask = 0x0000FF00;						Bmask = 0x000000FF;#endif						break;					case 32:						Amask = 0xFF000000;						Rmask = 0x00FF0000;						Gmask = 0x0000FF00;						Bmask = 0x000000FF;						break;					default:						break;				}				break;			}			/* Fall through -- read the RGB masks */		default:			switch (biBitCount) {				case 15:				case 16:				case 32:					Rmask = SDL_ReadLE32(src);					Gmask = SDL_ReadLE32(src);					Bmask = SDL_ReadLE32(src);					Amask = SDL_ReadLE32(src);					break;				default:					break;			}			break;	}	/* Create a compatible surface, note that the colors are RGB ordered */	surface = SDL_CreateRGBSurface(SDL_SWSURFACE,			biWidth, biHeight, biBitCount, Rmask, Gmask, Bmask, Amask);	if ( surface == NULL ) {		was_error = 1;		goto done;	}	/* Load the palette, if any */	palette = (surface->format)->palette;	if ( palette ) {		if ( SDL_RWseek(src, fp_offset+14+biSize, SEEK_SET) < 0 ) {			SDL_Error(SDL_EFSEEK);			was_error = 1;			goto done;		}		/*		| guich: always use 1<<bpp b/c some bitmaps can bring wrong information		| for colorsUsed		*/		/* if ( biClrUsed == 0 ) {  */		biClrUsed = 1 << biBitCount;		/* } */		if ( biSize == 12 ) {			for ( i = 0; i < (int)biClrUsed; ++i ) {				SDL_RWread(src, &palette->colors[i].b, 1, 1);				SDL_RWread(src, &palette->colors[i].g, 1, 1);				SDL_RWread(src, &palette->colors[i].r, 1, 1);				palette->colors[i].unused = 0;			}			} else {			for ( i = 0; i < (int)biClrUsed; ++i ) {				SDL_RWread(src, &palette->colors[i].b, 1, 1);				SDL_RWread(src, &palette->colors[i].g, 1, 1);				SDL_RWread(src, &palette->colors[i].r, 1, 1);				SDL_RWread(src, &palette->colors[i].unused, 1, 1);			}			}		palette->ncolors = biClrUsed;	}	/* Read the surface pixels.  Note that the bmp image is upside down */	if ( SDL_RWseek(src, fp_offset+bfOffBits, SEEK_SET) < 0 ) {		SDL_Error(SDL_EFSEEK);		was_error = 1;		goto done;	}	if ((biCompression == BI_RLE4) || (biCompression == BI_RLE8)) {		was_error = readRlePixels(surface, src, biCompression == BI_RLE8);		if (was_error) SDL_SetError("Error reading from BMP");		goto done;	}	bits = (Uint8 *)surface->pixels+(surface->h*surface->pitch);	switch (ExpandBMP) {		case 1:			bmpPitch = (biWidth + 7) >> 3;			pad  = (((bmpPitch)%4) ? (4-((bmpPitch)%4)) : 0);			break;		case 4:			bmpPitch = (biWidth + 1) >> 1;			pad  = (((bmpPitch)%4) ? (4-((bmpPitch)%4)) : 0);			break;		default:			pad  = ((surface->pitch%4) ?					(4-(surface->pitch%4)) : 0);			break;	}	while ( bits > (Uint8 *)surface->pixels ) {		bits -= surface->pitch;		switch (ExpandBMP) {			case 1:			case 4: {			Uint8 pixel = 0;			int   shift = (8-ExpandBMP);			for ( i=0; i<surface->w; ++i ) {				if ( i%(8/ExpandBMP) == 0 ) {					if ( !SDL_RWread(src, &pixel, 1, 1) ) {						SDL_SetError(					"Error reading from BMP");						was_error = 1;						goto done;					}				}				*(bits+i) = (pixel>>shift);				pixel <<= ExpandBMP;			} }			break;			default:			if ( SDL_RWread(src, bits, 1, surface->pitch)							 != surface->pitch ) {				SDL_Error(SDL_EFREAD);				was_error = 1;				goto done;			}#if SDL_BYTEORDER == SDL_BIG_ENDIAN			/* Byte-swap the pixels if needed. Note that the 24bpp			   case has already been taken care of above. */			switch(biBitCount) {				case 15:				case 16: {				        Uint16 *pix = (Uint16 *)bits;					for(i = 0; i < surface->w; i++)					        pix[i] = SDL_Swap16(pix[i]);					break;				}				case 32: {				        Uint32 *pix = (Uint32 *)bits;					for(i = 0; i < surface->w; i++)					        pix[i] = SDL_Swap32(pix[i]);					break;				}			}#endif			break;		}		/* Skip padding bytes, ugh */		if ( pad ) {			Uint8 padbyte;			for ( i=0; i<pad; ++i ) {				SDL_RWread(src, &padbyte, 1, 1);			}		}	}done:	if ( was_error ) {		if ( src ) {			SDL_RWseek(src, fp_offset, SEEK_SET);		}		if ( surface ) {			SDL_FreeSurface(surface);		}		surface = NULL;	}	if ( freesrc && src ) {		SDL_RWclose(src);	}	return(surface);}/* Load a BMP type image from an SDL datasource */SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src){	return(LoadBMP_RW(src, 0));}#else/* See if an image is contained in a data source */int IMG_isBMP(SDL_RWops *src){	return(0);}/* Load a BMP type image from an SDL datasource */SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src){	return(NULL);}#endif /* LOAD_BMP */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一色屋精品亚洲香蕉网站| 久久九九影视网| 精品中文字幕一区二区| 久久久不卡网国产精品一区| 精品一区二区免费在线观看| 成人欧美一区二区三区白人| 8x8x8国产精品| 成人av免费在线播放| 图片区小说区国产精品视频| 国产日产欧美一区二区视频| 欧美日韩国产在线观看| 国产精一区二区三区| 亚洲国产一区视频| 欧美放荡的少妇| 大陆成人av片| 日本91福利区| 玉足女爽爽91| 久久婷婷色综合| 欧美精品色综合| 91在线云播放| 国产一区二区免费视频| 亚洲一二三四久久| 国产精品女主播在线观看| 日韩精品一区在线观看| 欧美三级电影在线看| zzijzzij亚洲日本少妇熟睡| 九九国产精品视频| 爽好多水快深点欧美视频| 最新不卡av在线| 久久久影视传媒| 欧美精品九九99久久| 色综合天天综合在线视频| 国产91精品一区二区麻豆网站| 视频一区欧美日韩| 日本一区二区在线不卡| 日韩限制级电影在线观看| 欧美撒尿777hd撒尿| 一本高清dvd不卡在线观看 | 国产欧美久久久精品影院| 日韩欧美在线网站| 欧美一区二区在线看| 欧美亚洲高清一区| 日本久久一区二区三区| 国产寡妇亲子伦一区二区| 激情国产一区二区| 裸体一区二区三区| 日韩国产高清在线| 无码av免费一区二区三区试看| 亚洲一区二区三区中文字幕在线| 亚洲色欲色欲www在线观看| 国产精品蜜臀在线观看| 久久久久久久久久电影| 久久综合久久鬼色| 久久影视一区二区| 久久人人爽人人爽| 精品日韩99亚洲| 日韩精品一区二区三区四区视频| 日韩一区二区三免费高清| 色综合久久综合网| 在线视频你懂得一区| 欧美在线free| 欧美日韩成人综合在线一区二区| 色婷婷亚洲一区二区三区| 色偷偷88欧美精品久久久| 成人妖精视频yjsp地址| 91免费精品国自产拍在线不卡| 色综合欧美在线| 欧美网站大全在线观看| 欧美另类久久久品| 日韩一二在线观看| 精品国产99国产精品| 国产亚洲精品久| 欧美激情一区三区| **性色生活片久久毛片| 一区二区高清在线| 亚洲第一激情av| 国产一区二区0| 在线观看视频一区| 久久免费电影网| 亚洲国产一区二区三区青草影视| 激情深爱一区二区| 欧美专区日韩专区| 久久久www成人免费毛片麻豆| 亚洲夂夂婷婷色拍ww47| 久久69国产一区二区蜜臀| 91在线免费视频观看| 日韩免费高清视频| 亚洲永久免费av| 国产高清在线精品| 欧美一级片在线| 亚洲婷婷在线视频| 久久91精品久久久久久秒播| 色欧美88888久久久久久影院| 欧美精品一区二区久久婷婷| 一二三四社区欧美黄| 国产乱码字幕精品高清av | 91浏览器打开| 久久综合狠狠综合久久激情| 一个色在线综合| 成人激情免费网站| 精品国产第一区二区三区观看体验| 亚洲精品乱码久久久久| 国产剧情av麻豆香蕉精品| 欧美疯狂做受xxxx富婆| 亚洲精品免费一二三区| 国产91丝袜在线播放| 日韩写真欧美这视频| 五月天激情综合网| 不卡电影免费在线播放一区| 精品久久久久香蕉网| 性欧美疯狂xxxxbbbb| 99精品视频在线免费观看| 国产欧美日韩卡一| 精品一区二区久久久| 欧美夫妻性生活| 性欧美大战久久久久久久久| 91福利国产成人精品照片| 国产精品久久久久aaaa| 国产一区免费电影| 精品理论电影在线观看| 美女一区二区三区| 日韩一区二区三区在线视频| 日韩综合小视频| 在线成人av网站| 亚洲国产欧美在线| 欧美日韩国产首页| 午夜成人免费电影| 欧美精品成人一区二区三区四区| 亚洲电影激情视频网站| 欧美私模裸体表演在线观看| 亚洲影院在线观看| 在线观看一区日韩| 亚洲3atv精品一区二区三区| 欧美日韩亚洲综合在线| 亚洲国产精品久久人人爱蜜臀| 色综合久久99| 亚洲欧洲制服丝袜| 在线欧美一区二区| 午夜国产精品一区| 日韩一区二区三| 国内一区二区视频| 国产欧美精品国产国产专区| 顶级嫩模精品视频在线看| 国产精品久久二区二区| 91麻豆免费看| 亚洲va国产天堂va久久en| 91麻豆精品国产91久久久久久久久| 日韩二区三区在线观看| 精品国产99国产精品| 成人亚洲精品久久久久软件| 亚洲欧美视频在线观看| 欧美日韩国产区一| 黄色小说综合网站| 国产精品久久久久一区| 欧美亚洲免费在线一区| 奇米一区二区三区av| 精品少妇一区二区| 成人91在线观看| 亚洲成人三级小说| 2020国产精品久久精品美国| 国产91在线看| 亚洲国产美国国产综合一区二区| 欧美一区二区视频在线观看2022| 国产毛片精品视频| 亚洲精品中文在线观看| 91精品国产综合久久精品性色| 韩国女主播一区| 亚洲女同ⅹxx女同tv| 9191久久久久久久久久久| 国产精品亚洲专一区二区三区| 亚洲人成在线观看一区二区| 91精品国产aⅴ一区二区| 国产91丝袜在线播放九色| 亚洲黄网站在线观看| 精品人在线二区三区| 国产成a人亚洲| 午夜影视日本亚洲欧洲精品| 久久久精品免费观看| 欧美视频一区在线| 国精产品一区一区三区mba视频| 一区二区在线观看不卡| 精品国精品国产| 欧美色综合网站| 国产成人精品免费网站| 亚洲v日本v欧美v久久精品| 国产欧美精品一区| 制服丝袜av成人在线看| 99精品国产一区二区三区不卡| 蜜桃视频一区二区三区| 一区二区三区精品| 国产欧美日韩麻豆91| 日韩欧美国产小视频| 色婷婷av一区二区| 丰满少妇久久久久久久| 蜜臀av一区二区在线免费观看| 亚洲精品福利视频网站| 中文字幕免费不卡在线| 精品国产一区二区精华| 欧美男男青年gay1069videost| av欧美精品.com|