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

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

?? rdtarga.c

?? 一款最完整的工業組態軟源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * rdtarga.c
 *
 * Copyright (C) 1991-1996, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to read input images in Targa format.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed Targa format).
 *
 * Based on code contributed by Lee Daniel Crocker.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

#ifdef TARGA_SUPPORTED


/* Macros to deal with unsigned chars as efficiently as compiler allows */

#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char U_CHAR;
#define UCH(x)	((int) (x))
#else /* !HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char U_CHAR;
#define UCH(x)	((int) (x))
#else
typedef char U_CHAR;
#define UCH(x)	((int) (x) & 0xFF)
#endif
#endif /* HAVE_UNSIGNED_CHAR */


#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))


/* Private version of data source object */

typedef struct _tga_source_struct * tga_source_ptr;

typedef struct _tga_source_struct {
  struct cjpeg_source_struct pub; /* public fields */

  j_compress_ptr cinfo;		/* back link saves passing separate parm */

  JSAMPARRAY colormap;		/* Targa colormap (converted to my format) */

  jvirt_sarray_ptr whole_image;	/* Needed if funny input row order */
  JDIMENSION current_row;	/* Current logical row number to read */

  /* Pointer to routine to extract next Targa pixel from input file */
  JMETHOD(void, read_pixel, (tga_source_ptr sinfo));

  /* Result of read_pixel is delivered here: */
  U_CHAR tga_pixel[4];

  int pixel_size;		/* Bytes per Targa pixel (1 to 4) */

  /* State info for reading RLE-coded pixels; both counts must be init to 0 */
  int block_count;		/* # of pixels remaining in RLE block */
  int dup_pixel_count;		/* # of times to duplicate previous pixel */

  /* This saves the correct pixel-row-expansion method for preload_image */
  JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
				       cjpeg_source_ptr sinfo));
} tga_source_struct;


/* For expanding 5-bit pixel values to 8-bit with best rounding */

static const UINT8 c5to8bits[32] = {
    0,   8,  16,  25,  33,  41,  49,  58,
   66,  74,  82,  90,  99, 107, 115, 123,
  132, 140, 148, 156, 165, 173, 181, 189,
  197, 206, 214, 222, 230, 239, 247, 255
};



LOCAL(int)
read_byte (tga_source_ptr sinfo)
/* Read next byte from Targa file */
{
  register FILE *infile = sinfo->pub.input_file;
  register int c;

  if ((c = getc(infile)) == EOF)
    ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
  return c;
}


LOCAL(void)
read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize)
/* Read the colormap from a Targa file */
{
  int i;

  /* Presently only handles 24-bit BGR format */
  if (mapentrysize != 24)
    ERREXIT(sinfo->cinfo, JERR_TGA_BADCMAP);

  for (i = 0; i < cmaplen; i++) {
    sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo);
    sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo);
    sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo);
  }
}


/*
 * read_pixel methods: get a single pixel from Targa file into tga_pixel[]
 */

METHODDEF(void)
read_non_rle_pixel (tga_source_ptr sinfo)
/* Read one Targa pixel from the input file; no RLE expansion */
{
  register FILE *infile = sinfo->pub.input_file;
  register int i;

  for (i = 0; i < sinfo->pixel_size; i++) {
    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
  }
}


METHODDEF(void)
read_rle_pixel (tga_source_ptr sinfo)
/* Read one Targa pixel from the input file, expanding RLE data as needed */
{
  register FILE *infile = sinfo->pub.input_file;
  register int i;

  /* Duplicate previously read pixel? */
  if (sinfo->dup_pixel_count > 0) {
    sinfo->dup_pixel_count--;
    return;
  }

  /* Time to read RLE block header? */
  if (--sinfo->block_count < 0) { /* decrement pixels remaining in block */
    i = read_byte(sinfo);
    if (i & 0x80) {		/* Start of duplicate-pixel block? */
      sinfo->dup_pixel_count = i & 0x7F; /* number of dups after this one */
      sinfo->block_count = 0;	/* then read new block header */
    } else {
      sinfo->block_count = i & 0x7F; /* number of pixels after this one */
    }
  }

  /* Read next pixel */
  for (i = 0; i < sinfo->pixel_size; i++) {
    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
  }
}


/*
 * Read one row of pixels.
 *
 * We provide several different versions depending on input file format.
 */


METHODDEF(JDIMENSION)
get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 8-bit grayscale pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 8-bit colormap indexes */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register int t;
  register JSAMPROW ptr;
  register JDIMENSION col;
  register JSAMPARRAY colormap = source->colormap;

  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    t = UCH(source->tga_pixel[0]);
    *ptr++ = colormap[0][t];
    *ptr++ = colormap[1][t];
    *ptr++ = colormap[2][t];
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 16-bit pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register int t;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    t = UCH(source->tga_pixel[0]);
    t += UCH(source->tga_pixel[1]) << 8;
    /* We expand 5 bit data to 8 bit sample width.
     * The format of the 16-bit (LSB first) input word is
     *     xRRRRRGGGGGBBBBB
     */
    ptr[2] = (JSAMPLE) c5to8bits[t & 0x1F];
    t >>= 5;
    ptr[1] = (JSAMPLE) c5to8bits[t & 0x1F];
    t >>= 5;
    ptr[0] = (JSAMPLE) c5to8bits[t & 0x1F];
    ptr += 3;
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 24-bit pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[2]); /* change BGR to RGB order */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]);
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产a级| 青青草国产成人av片免费| 亚洲国产一区二区a毛片| 美腿丝袜亚洲综合| 色狠狠一区二区三区香蕉| 日韩美女一区二区三区| 亚洲伊人色欲综合网| 国产99久久久国产精品潘金网站| 欧美优质美女网站| 亚洲国产成人在线| 韩国精品主播一区二区在线观看 | 国产精品一区二区久久不卡| 色猫猫国产区一区二在线视频| 欧美大片在线观看| 亚洲成人激情社区| 91农村精品一区二区在线| 精品国产1区二区| 亚洲第一在线综合网站| 日本丰满少妇一区二区三区| 国产欧美久久久精品影院| 久久成人18免费观看| 91精品国产手机| 午夜欧美视频在线观看| 在线观看日韩一区| 亚洲人成小说网站色在线| 国产成a人亚洲精| 国产亚洲欧洲一区高清在线观看| 蜜臀精品久久久久久蜜臀| 欧美日韩一区中文字幕| 亚洲va欧美va天堂v国产综合| 91成人网在线| 亚洲精品日产精品乱码不卡| 成人app下载| 国产精品久久99| 99精品热视频| 亚洲一区av在线| 欧美性猛片xxxx免费看久爱| 一区二区三区四区中文字幕| 色婷婷久久久亚洲一区二区三区| 亚洲免费观看高清完整版在线观看 | 国产精品卡一卡二卡三| 成人黄色国产精品网站大全在线免费观看| 欧美不卡一区二区三区| 精品一区二区免费| 久久久美女艺术照精彩视频福利播放| 国产一区三区三区| 国产精品入口麻豆原神| 99re成人在线| 亚洲国产精品欧美一二99| 欧美日韩国产高清一区二区 | 一区二区三区中文在线| 在线观看91视频| 日本中文字幕一区二区有限公司| 91麻豆精品国产91久久久更新时间| 日本va欧美va欧美va精品| 精品少妇一区二区三区 | 日本韩国视频一区二区| 亚欧色一区w666天堂| 欧美成人性战久久| 成人黄色一级视频| 亚洲国产精品一区二区久久恐怖片| 91精品国产综合久久精品 | 久久综合久久鬼色| 波多野结衣视频一区| 亚洲一区二区美女| 久久亚洲二区三区| 色婷婷av一区二区三区之一色屋| 亚洲国产精品久久一线不卡| 337p粉嫩大胆噜噜噜噜噜91av | 国产在线视频精品一区| 国产精品不卡在线观看| 在线电影欧美成精品| 国产69精品久久久久777| 一区二区三区 在线观看视频| 欧美一卡2卡3卡4卡| 91免费看片在线观看| 亚洲一二三四区| 亚洲精品一区二区三区影院| 99国产精品久久久久久久久久 | 日韩精品中文字幕在线不卡尤物| 丁香天五香天堂综合| 婷婷六月综合网| 国产精品国产自产拍高清av王其| 欧美四级电影在线观看| 国产成人精品影视| 日韩电影在线看| ●精品国产综合乱码久久久久 | 美腿丝袜一区二区三区| 亚洲你懂的在线视频| 久久奇米777| 555www色欧美视频| 日本韩国欧美一区二区三区| 高清不卡一区二区| 精东粉嫩av免费一区二区三区 | 国产精品久久久久久久久搜平片| 欧美一级午夜免费电影| 欧美日韩色综合| 色av成人天堂桃色av| 99在线精品视频| 粉嫩一区二区三区性色av| 精品在线免费观看| 日韩国产欧美在线观看| 夜夜亚洲天天久久| 亚洲色图色小说| 国产欧美一区视频| 久久精品视频一区二区| 欧美大片日本大片免费观看| 5566中文字幕一区二区电影 | 一本一道波多野结衣一区二区| 国产剧情av麻豆香蕉精品| 青青草原综合久久大伊人精品| 一区二区三国产精华液| 亚洲一区在线视频观看| 亚洲欧洲精品成人久久奇米网| 中文字幕欧美国产| 亚洲国产精品精华液2区45| 国产无一区二区| 国产精品―色哟哟| 成人欧美一区二区三区黑人麻豆 | 国产精品动漫网站| 国产精品乱子久久久久| 国产精品福利一区二区三区| 中文字幕一区在线观看| 亚洲国产精品影院| 亚洲成人av一区| 日韩在线一区二区三区| 捆绑紧缚一区二区三区视频| 激情文学综合插| 成人妖精视频yjsp地址| 99久久精品费精品国产一区二区| 91蜜桃传媒精品久久久一区二区| 色噜噜夜夜夜综合网| 欧美一a一片一级一片| 7777精品伊人久久久大香线蕉的| 欧美一级片免费看| 久久久国产精品麻豆| 亚洲欧洲av在线| 午夜精品久久久久久久久久久| 琪琪久久久久日韩精品| 国产精品一区二区黑丝| 91视频一区二区| 91精品国产综合久久久蜜臀粉嫩| 欧美成人一区二区三区在线观看| 国产精品无码永久免费888| 国产精品免费aⅴ片在线观看| 亚洲日本免费电影| 另类中文字幕网| 不卡在线观看av| 亚洲成人激情社区| 欧美日韩一区小说| 午夜一区二区三区视频| 国产精品久久看| 亚洲免费色视频| 天天爽夜夜爽夜夜爽精品视频| 午夜国产精品影院在线观看| 欧美色手机在线观看| 69堂精品视频| 久久久欧美精品sm网站| 亚洲天堂精品在线观看| 日本美女一区二区三区| 99久久久久久| 精品日韩成人av| 亚洲电影在线免费观看| 国产成人在线电影| 欧美日韩精品一区二区在线播放| 久久久久亚洲蜜桃| 亚洲国产视频一区| 成人动漫一区二区| 欧美xxxx老人做受| 亚洲国产日韩a在线播放| 国产91富婆露脸刺激对白| 91精品蜜臀在线一区尤物| 亚洲欧美另类小说视频| 国产一区二区免费看| 欧美精品日日鲁夜夜添| 综合av第一页| 国产成人在线视频网站| 日韩一区二区高清| 亚洲福利视频导航| 99久久婷婷国产综合精品 | 在线影院国内精品| 国产欧美精品一区二区三区四区| 免费成人av在线播放| 欧美在线不卡视频| 综合欧美亚洲日本| 成人永久aaa| 国产性色一区二区| 极品美女销魂一区二区三区免费| 欧美精品自拍偷拍动漫精品| 一区二区三区在线免费| 99精品在线观看视频| 国产精品午夜久久| 国产精品99久久不卡二区| 日韩欧美一级特黄在线播放| 日韩精品1区2区3区| 欧美精品色一区二区三区| 视频一区中文字幕国产| 欧美日韩国产一二三| 午夜电影网亚洲视频| 91精品国产综合久久久久久|