本文整理汇总了C++中DGifGetLine函数的典型用法代码示例。如果您正苦于以下问题:C++ DGifGetLine函数的具体用法?C++ DGifGetLine怎么用?C++ DGifGetLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DGifGetLine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gif_read
static void
gif_read(unsigned char *dst, unsigned int line, void *data)
{
struct gif_state *h = (struct gif_state *) data;
GifColorType *cmap;
int x;
if (h->gif->Image.Interlace) {
if (line % 2) {
DGifGetLine(h->gif, h->row, h->w);
} else {
memcpy(h->row, h->il + h->w * line, h->w);
}
} else {
DGifGetLine(h->gif, h->row, h->w);
}
cmap = h->gif->Image.ColorMap ?
h->gif->Image.ColorMap->Colors : h->gif->SColorMap->Colors;
for (x = 0; x < h->w; x++) {
dst[0] = cmap[h->row[x]].Red;
dst[1] = cmap[h->row[x]].Green;
dst[2] = cmap[h->row[x]].Blue;
dst += 3;
}
}
示例2: GIFReadFrame
int GIFReadFrame(GifFileType* const gif, int transparent_index,
GIFFrameRect* const gif_rect, WebPPicture* const picture) {
WebPPicture sub_image;
const GifImageDesc* const image_desc = &gif->Image;
uint32_t* dst = NULL;
uint8_t* tmp = NULL;
int ok = 0;
GIFFrameRect rect = {
image_desc->Left, image_desc->Top, image_desc->Width, image_desc->Height
};
*gif_rect = rect;
// Use a view for the sub-picture:
if (!WebPPictureView(picture, rect.x_offset, rect.y_offset,
rect.width, rect.height, &sub_image)) {
fprintf(stderr, "Sub-image %dx%d at position %d,%d is invalid!\n",
rect.width, rect.height, rect.x_offset, rect.y_offset);
return 0;
}
dst = sub_image.argb;
tmp = (uint8_t*)malloc(rect.width * sizeof(*tmp));
if (tmp == NULL) goto End;
if (image_desc->Interlace) { // Interlaced image.
// We need 4 passes, with the following offsets and jumps.
const int interlace_offsets[] = { 0, 4, 2, 1 };
const int interlace_jumps[] = { 8, 8, 4, 2 };
int pass;
for (pass = 0; pass < 4; ++pass) {
int y;
for (y = interlace_offsets[pass]; y < rect.height;
y += interlace_jumps[pass]) {
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
Remap(gif, tmp, rect.width, transparent_index,
dst + y * sub_image.argb_stride);
}
}
} else { // Non-interlaced image.
int y;
for (y = 0; y < rect.height; ++y) {
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
Remap(gif, tmp, rect.width, transparent_index,
dst + y * sub_image.argb_stride);
}
}
ok = 1;
End:
if (!ok) picture->error_code = sub_image.error_code;
WebPPictureFree(&sub_image);
free(tmp);
return ok;
}
示例3: ReadSubImage
static int ReadSubImage(GifFileType* gif, WebPPicture* pic, WebPPicture* view) {
const GifImageDesc image_desc = gif->Image;
const int offset_x = image_desc.Left;
const int offset_y = image_desc.Top;
const int sub_w = image_desc.Width;
const int sub_h = image_desc.Height;
uint32_t* dst = NULL;
uint8_t* tmp = NULL;
int ok = 0;
// Use a view for the sub-picture:
if (!WebPPictureView(pic, offset_x, offset_y, sub_w, sub_h, view)) {
fprintf(stderr, "Sub-image %dx%d at position %d,%d is invalid!\n",
sub_w, sub_h, offset_x, offset_y);
goto End;
}
dst = view->argb;
tmp = (uint8_t*)malloc(sub_w * sizeof(*tmp));
if (tmp == NULL) goto End;
if (image_desc.Interlace) { // Interlaced image.
// We need 4 passes, with the following offsets and jumps.
const int interlace_offsets[] = { 0, 4, 2, 1 };
const int interlace_jumps[] = { 8, 8, 4, 2 };
int pass;
for (pass = 0; pass < 4; ++pass) {
int y;
for (y = interlace_offsets[pass]; y < sub_h; y += interlace_jumps[pass]) {
if (DGifGetLine(gif, tmp, sub_w) == GIF_ERROR) goto End;
Remap(tmp, gif, dst + y * view->argb_stride, sub_w);
}
}
} else { // Non-interlaced image.
int y;
for (y = 0; y < sub_h; ++y) {
if (DGifGetLine(gif, tmp, sub_w) == GIF_ERROR) goto End;
Remap(tmp, gif, dst + y * view->argb_stride, sub_w);
}
}
// re-align the view with even offset (and adjust dimensions if needed).
WebPPictureView(pic, offset_x & ~1, offset_y & ~1,
sub_w + (offset_x & 1), sub_h + (offset_y & 1), view);
ok = 1;
End:
free(tmp);
return ok;
}
示例4: ReadFrame
// Read the GIF image frame.
static int ReadFrame(GifFileType* const gif, WebPFrameRect* const gif_rect,
WebPPicture* const sub_image, WebPPicture* const curr) {
const GifImageDesc image_desc = gif->Image;
uint32_t* dst = NULL;
uint8_t* tmp = NULL;
int ok = 0;
WebPFrameRect rect = {
image_desc.Left, image_desc.Top, image_desc.Width, image_desc.Height
};
*gif_rect = rect;
// Use a view for the sub-picture:
if (!WebPPictureView(curr, rect.x_offset, rect.y_offset,
rect.width, rect.height, sub_image)) {
fprintf(stderr, "Sub-image %dx%d at position %d,%d is invalid!\n",
rect.width, rect.height, rect.x_offset, rect.y_offset);
goto End;
}
dst = sub_image->argb;
tmp = (uint8_t*)malloc(rect.width * sizeof(*tmp));
if (tmp == NULL) goto End;
if (image_desc.Interlace) { // Interlaced image.
// We need 4 passes, with the following offsets and jumps.
const int interlace_offsets[] = { 0, 4, 2, 1 };
const int interlace_jumps[] = { 8, 8, 4, 2 };
int pass;
for (pass = 0; pass < 4; ++pass) {
int y;
for (y = interlace_offsets[pass]; y < rect.height;
y += interlace_jumps[pass]) {
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
Remap(tmp, gif, dst + y * sub_image->argb_stride, rect.width);
}
}
} else { // Non-interlaced image.
int y;
for (y = 0; y < rect.height; ++y) {
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
Remap(tmp, gif, dst + y * sub_image->argb_stride, rect.width);
}
}
ok = 1;
End:
free(tmp);
return ok;
}
示例5: DGifGetLineByte
int DGifGetLineByte(GifFileType *GifFile, GifPixelType *Line, int LineLen)
{
GifPixelType LineBuf[240];
CopyLine(LineBuf, Line, LineLen);
int result = DGifGetLine(GifFile, LineBuf, LineLen);
CopyLine(Line, LineBuf, LineLen);
return result;
}
示例6: LoadImage
/******************************************************************************
* Routine to read Image out. The image can be Interlaced or None interlaced.
* The memory required to hold the image is allocate by the routine itself.
* The image is always loaded sequencially into the buffer.
* Return GIF_OK if succesful, GIF_ERROR otherwise.
******************************************************************************/
static int LoadImage(GifFileType *GifFile, GifRowType **ImageBufferPtr)
{
int Size, i;
GifRowType *ImageBuffer;
/* The following comment was written under DOS on a 286: */
/* Allocate the image as vector of column of rows. We can't allocate the */
/* whole screen at once, as this broken minded CPU can allocate up to */
/* 64k at a time and our image can be bigger than that: */
if ((ImageBuffer = (GifRowType *)
malloc(GifFile->Image.Height * sizeof(GifRowType))) == NULL)
GIF_EXIT("Failed to allocate memory required, aborted.");
Size = GifFile->Image.Width * sizeof(GifPixelType);/* One row size in bytes.*/
for (i = 0; i < GifFile->Image.Height; i++) {
/* Allocate the rows: */
if ((ImageBuffer[i] = (GifRowType) malloc(Size)) == NULL)
GIF_EXIT("Failed to allocate memory required, aborted.");
}
*ImageBufferPtr = ImageBuffer;
GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]: ",
PROGRAM_NAME, ++ImageNum, GifFile->Image.Left, GifFile->Image.Top,
GifFile->Image.Width, GifFile->Image.Height);
if (GifFile->Image.Interlace) {
int j, Count;
/* Need to perform 4 passes on the images: */
for (Count = i = 0; i < 4; i++)
for (j = InterlacedOffset[i]; j < GifFile->Image.Height;
j += InterlacedJumps[i]) {
GifQprintf("\b\b\b\b%-4d", Count++);
if (DGifGetLine(GifFile, ImageBuffer[j], GifFile->Image.Width)
== GIF_ERROR) return GIF_ERROR;
}
}
else {
for (i = 0; i < GifFile->Image.Height; i++) {
GifQprintf("\b\b\b\b%-4d", i);
if (DGifGetLine(GifFile, ImageBuffer[i], GifFile->Image.Width)
== GIF_ERROR) return GIF_ERROR;
}
}
return GIF_OK;
}
示例7: CPLAssert
CPLErr BIGGifRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
int nBlockYOff,
void * pImage )
{
BIGGIFDataset *poGDS = (BIGGIFDataset *) poDS;
CPLAssert( nBlockXOff == 0 );
if( panInterlaceMap != NULL )
nBlockYOff = panInterlaceMap[nBlockYOff];
/* -------------------------------------------------------------------- */
/* Do we already have this line in the work dataset? */
/* -------------------------------------------------------------------- */
if( poGDS->poWorkDS != NULL && nBlockYOff <= poGDS->nLastLineRead )
{
return poGDS->poWorkDS->
RasterIO( GF_Read, 0, nBlockYOff, nBlockXSize, 1,
pImage, nBlockXSize, 1, GDT_Byte,
1, NULL, 0, 0, 0, NULL );
}
/* -------------------------------------------------------------------- */
/* Do we need to restart from the start of the image? */
/* -------------------------------------------------------------------- */
if( nBlockYOff <= poGDS->nLastLineRead )
{
if( poGDS->ReOpen() == CE_Failure )
return CE_Failure;
}
/* -------------------------------------------------------------------- */
/* Read till we get our target line. */
/* -------------------------------------------------------------------- */
CPLErr eErr = CE_None;
while( poGDS->nLastLineRead < nBlockYOff && eErr == CE_None )
{
if( DGifGetLine( poGDS->hGifFile, (GifPixelType*)pImage,
nBlockXSize ) == GIF_ERROR )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Failure decoding scanline of GIF file." );
return CE_Failure;
}
poGDS->nLastLineRead++;
if( poGDS->poWorkDS != NULL )
{
eErr = poGDS->poWorkDS->RasterIO( GF_Write,
0, poGDS->nLastLineRead, nBlockXSize, 1,
pImage, nBlockXSize, 1, GDT_Byte,
1, NULL, 0, 0, 0, NULL );
}
}
return eErr;
}
示例8: gif_skipimage
static void
gif_skipimage(struct gif_state *h)
{
unsigned char *line;
int i;
if (FbiStuff::fim_filereading_debug())
FIM_FBI_PRINTF("gif: skipping image record ...\n");
DGifGetImageDesc(h->gif);
line = fim_malloc(h->gif->SWidth);
for (i = 0; i < h->gif->SHeight; i++)
DGifGetLine(h->gif, line, h->gif->SWidth);
fim_free(line);
}
示例9: LOGE
bool GifTranscoder::readImage(GifFileType* gifIn, GifByteType* rasterBits) {
if (gifIn->Image.Interlace) {
int interlacedOffset[] = { 0, 4, 2, 1 };
int interlacedJumps[] = { 8, 8, 4, 2 };
// Need to perform 4 passes on the image
for (int i = 0; i < 4; i++) {
for (int j = interlacedOffset[i]; j < gifIn->Image.Height; j += interlacedJumps[i]) {
if (DGifGetLine(gifIn,
rasterBits + j * gifIn->Image.Width,
gifIn->Image.Width) == GIF_ERROR) {
LOGE("Could not read interlaced raster data");
return false;
}
}
}
} else {
if (DGifGetLine(gifIn, rasterBits, gifIn->Image.Width * gifIn->Image.Height) == GIF_ERROR) {
LOGE("Could not read raster data");
return false;
}
}
return true;
}
示例10: load_image
image* load_image (char* file, image_format fmt) {
image* img = NULL;
if (fmt == imgIRMID) {
FILE* fp;
fp = fopen (file, "r");
image simage;
fread (&simage, sizeof(image), 1, fp);
img = (image*) malloc (simage.size);
fseek (fp, 0, SEEK_SET);
fread (img, simage.size, 1, fp);
fclose (fp);
} else if (fmt == imgGIF) {
GifFileType* GifFileIn = DGifOpenFileName (file);
int size = GifFileIn->SWidth * GifFileIn->SHeight * sizeof (rtbyte) + sizeof (image) - sizeof (rtbyte);
img = (image*) malloc (size);
img->size = size;
img->dimx = GifFileIn->SWidth;
img->dimy = GifFileIn->SHeight;
img->dimc = 1;
img->dimz = 1;
img->dimt = 1;
img->xyz = img->xy = img->dimx * img->dimy;
img->len = img->xy * sizeof (rdword);
img->clr = clrmGrey;
GifRecordType record;
GifRowType pixels = (GifRowType) new GifPixelType[img->xy];
do {
DGifGetRecordType(GifFileIn, &record);
if (record != IMAGE_DESC_RECORD_TYPE)
continue;
DGifGetImageDesc (GifFileIn);
for (int row = 0; row < img->dimy; ++row)
DGifGetLine (GifFileIn, pixels + row * img->dimx, img->dimx);
} while (record != TERMINATE_RECORD_TYPE);
for (uint n = 0; n < img->xy; ++n)
data(img)[n] = (rtbyte)pixels[n];
DGifCloseFile (GifFileIn);
}
return (img);
}
示例11: dGifGetLine
value dGifGetLine( value hdl )
{
CAMLparam1(hdl);
CAMLlocal1(buf);
GifFileType *GifFile = (GifFileType*) hdl;
if( oversized( GifFile->Image.Width, sizeof(GifPixelType) ) ){
failwith_oversized("gif");
}
buf = alloc_string( GifFile->Image.Width * sizeof(GifPixelType) );
if( DGifGetLine(GifFile, String_val(buf), GifFile->Image.Width )
== GIF_ERROR ){
// PrintGifError ();
failwith("DGifGetLine");
}
CAMLreturn(buf);
}
示例12: output_gif_pixels
static int output_gif_pixels(struct gps_map *map, GifFileType *gf, int x, int y,
int width, int height, int row_stride, unsigned char *out)
{
ColorMapObject *cm;
unsigned char *scan_line;
int r, col, line, cm_size;
cm = gf->Image.ColorMap ? gf->Image.ColorMap : gf->SColorMap;
cm_size = cm->ColorCount;
r = -1;
scan_line = malloc(map->width);
for (line = 0; line < y + height; line++) {
if (DGifGetLine(gf, scan_line, map->width) == GIF_ERROR) {
PrintGifError();
goto fail;
}
if (line < y)
continue;
for (col = 0; col < x + width; col++) {
GifColorType *color;
if (col < x)
continue;
if (scan_line[col] > cm_size)
scan_line[col] = 0;
color = &cm->Colors[scan_line[col]];
*out++ = color->Red;
*out++ = color->Green;
*out++ = color->Blue;
}
out += row_stride - width * 3;
}
r = 0;
fail:
free(scan_line);
return r;
}
示例13: main
//.........这里部分代码省略.........
QuitGifError(GifFileIn, GifFileOut);
/* Scan the content of the GIF file and load the image(s) in: */
do {
if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
/* Put the image descriptor to out file: */
l = (int) (GifFileIn->Image.Left * XScale + 0.5);
w = (int) (GifFileIn->Image.Width * XScale + 0.5);
t = (int) (GifFileIn->Image.Top * YScale + 0.5);
h = (int) (GifFileIn->Image.Height * YScale + 0.5);
if (l < 0) l = 0;
if (t < 0) t = 0;
if (l + w > XSize) w = XSize - l;
if (t + h > YSize) h = YSize - t;
if (EGifPutImageDesc(GifFileOut, l, t, w, h,
GifFileIn->Image.Interlace,
GifFileIn->Image.ColorMap) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
if (GifFileIn->Image.Interlace) {
GIF_EXIT("Cannt resize interlaced images - use GifInter first.");
}
else {
GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]: ",
PROGRAM_NAME, ++ImageNum,
GifFileOut->Image.Left, GifFileOut->Image.Top,
GifFileOut->Image.Width, GifFileOut->Image.Height);
for (i = GifFileIn->Image.Height, y = 0.0, last_iy = -1;
i-- > 0;
y += YScale) {
if (DGifGetLine(GifFileIn, LineIn,
GifFileIn->Image.Width) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
iy = (int) y;
if (last_iy < iy && last_iy < YSize) {
ResizeLine(LineIn, LineOut,
GifFileIn->Image.Width, GifFileOut->Image.Width);
for (;
last_iy < iy && last_iy < GifFileOut->Image.Height - 1;
last_iy++) {
GifQprintf("\b\b\b\b%-4d", last_iy + 1);
if (EGifPutLine(GifFileOut, LineOut,
GifFileOut->Image.Width) ==
GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
}
}
}
/* If scale is not dividable - dump last lines: */
while (++last_iy < GifFileOut->Image.Height) {
GifQprintf("\b\b\b\b%-4d", last_iy);
if (EGifPutLine(GifFileOut, LineOut,
GifFileOut->Image.Width) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
}
}
break;
case EXTENSION_RECORD_TYPE:
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFileIn, &ExtCode, &Extension) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
if (EGifPutExtension(GifFileOut, ExtCode, Extension[0],
Extension) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
/* No support to more than one extension blocks, so discard: */
while (Extension != NULL) {
if (DGifGetExtensionNext(GifFileIn, &Extension) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
}
break;
case TERMINATE_RECORD_TYPE:
break;
default: /* Should be traps by DGifGetRecordType. */
break;
}
}
while (RecordType != TERMINATE_RECORD_TYPE);
if (DGifCloseFile(GifFileIn) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
if (EGifCloseFile(GifFileOut) == GIF_ERROR)
QuitGifError(GifFileIn, GifFileOut);
free(LineOut);
free(LineIn);
return 0;
}
示例14: main
//.........这里部分代码省略.........
memcpy(ScreenBuffer[i], ScreenBuffer[0], Size);
}
/* Scan the content of the GIF file and load the image(s) in: */
do {
if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
PrintGifError();
break;
}
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(GifFile) == GIF_ERROR) {
PrintGifError();
exit(-1);
}
Row = GifFile -> ITop; /* Image Position relative to Screen. */
Col = GifFile -> ILeft;
Width = GifFile -> IWidth;
Height = GifFile -> IHeight;
GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]: ",
PROGRAM_NAME, ++ImageNum, Col, Row, Width, Height);
if (GifFile -> ILeft + GifFile -> IWidth > GifFile -> SWidth ||
GifFile -> ITop + GifFile -> IHeight > GifFile -> SHeight) {
fprintf(stderr, "Image %d is not confined to screen dimension, aborted.\n");
exit(-2);
}
if (GifFile -> IInterlace) {
/* Need to perform 4 passes on the images: */
for (Count = i = 0; i < 4; i++)
for (j = Row + InterlacedOffset[i]; j < Row + Height;
j += InterlacedJumps[i]) {
GifQprintf("\b\b\b\b%-4d", Count++);
if (DGifGetLine(GifFile,
&ScreenBuffer[MIN(j, MaximumScreenHeight)][Col],
Width) == GIF_ERROR) {
PrintGifError();
exit(-1);
}
}
}
else {
for (i = 0; i < Height; i++, Row++) {
GifQprintf("\b\b\b\b%-4d", i);
if (DGifGetLine(GifFile, &ScreenBuffer[MIN(Row, MaximumScreenHeight)][Col],
Width) == GIF_ERROR) {
PrintGifError();
MaximumScreenHeight = MIN(i - 1, MaximumScreenHeight);
}
}
}
break;
case EXTENSION_RECORD_TYPE:
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) {
PrintGifError();
exit(-1);
}
while (Extension != NULL) {
if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) {
PrintGifError();
exit(-1);
}
}
break;
case TERMINATE_RECORD_TYPE:
示例15: main
int main(int argc, char **argv) {
//
// local vars
//
GifFileType *GIFfile;
GifRecordType GIFtype;
GifByteType *GIFextension;
GifPixelType *GIFline;
uint32_t w[8],**lower_array,**upper_array;
int x,y,z,i,j,k,n,p,imin,imax;
int image_width,image_height,image_count,color_resolution,GIFcode,ret;
float threshold,voxel_size;
char comment[256],rules[255][20];
struct fab_vars v;
init_vars(&v);
//
// command line args
//
if (!((argc == 3) || (argc == 4) || (argc == 5) || (argc == 6))) {
printf("command line: gif_stl in.gif out.stl [threshold [size [points [angle]]]]\n");
printf(" in.gif = input GIF section file\n");
printf(" out.stl = output STL file\n");
printf(" threshold: surface intensity threshold (0 = min, 1 = max, default 0.5))\n");
printf(" size = voxel size (mm, default from file))\n");
printf(" points = points to interpolate per point (default 0)\n");
printf(" to be implemented: angle = minimum relative face angle to decimate vertices (default 0)\n");
exit(-1);
}
p = 0;
threshold = 0.5;
voxel_size = -1;
image_width = -1;
image_height = -1;
image_count = -1;
if (argc >= 4)
sscanf(argv[3],"%f",&threshold);
if (argc >= 5)
sscanf(argv[4],"%f",&voxel_size);
if (argc >= 6)
sscanf(argv[5],"%d",&p);
//
// initialize the rule table
//
init_rules(rules);
//
// scan the file
//
printf("read %s\n",argv[1]);
color_resolution = -1;
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_stl: oops -- can not open %s\n",argv[1]);
exit(-1);
}
GIFline = malloc(MAX_LINE*sizeof(GifPixelType));
imin = 256;
imax = 0;
do {
DGifGetRecordType(GIFfile,&GIFtype);
switch (GIFtype) {
case IMAGE_DESC_RECORD_TYPE:
DGifGetImageDesc(GIFfile);
image_width = GIFfile->SWidth;
image_height = GIFfile->SHeight;
image_count = GIFfile->ImageCount;
color_resolution = GIFfile->SColorResolution;
for (y = 0; y < GIFfile->SHeight; ++y) {
ret = DGifGetLine(GIFfile,GIFline,GIFfile->SWidth);
if (ret != GIF_OK) {
printf("gif_stl: oops -- error reading line\n");
exit(-1);
}
for (x = 0; x < GIFfile->SWidth; ++x) {
if (GIFline[x] < imin) imin = GIFline[x];
if (GIFline[x] > imax) imax = GIFline[x];
}
}
break;
case EXTENSION_RECORD_TYPE:
DGifGetExtension(GIFfile,&GIFcode,&GIFextension);
if (GIFcode == COMMENT_EXT_FUNC_CODE) {
n = GIFextension[0];
for (i = 1; i <= n; ++i)
comment[i-1] = GIFextension[i];
comment[n] = 0;
if (voxel_size == -1)
sscanf(comment,"mm per pixel: %f;",&voxel_size);
}
while (GIFextension != NULL)
DGifGetExtensionNext(GIFfile,&GIFextension);
break;
case SCREEN_DESC_RECORD_TYPE:
DGifGetScreenDesc(GIFfile);
break;
case TERMINATE_RECORD_TYPE:
break;
//.........这里部分代码省略.........