当前位置: 首页>>代码示例>>C++>>正文


C++ JFWRITE函数代码示例

本文整理汇总了C++中JFWRITE函数的典型用法代码示例。如果您正苦于以下问题:C++ JFWRITE函数的具体用法?C++ JFWRITE怎么用?C++ JFWRITE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了JFWRITE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write_os2_header

write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
/* Write an OS2-style BMP file header, including colormap if needed */
{
  char bmpfileheader[14];
  char bmpcoreheader[12];
  INT32 headersize, bfSize;
  int bits_per_pixel, cmap_entries;

  /* Compute colormap size and total file size */
  if (cinfo->out_color_space == JCS_RGB) {
    if (cinfo->quantize_colors) {
      /* Colormapped RGB */
      bits_per_pixel = 8;
      cmap_entries = 256;
    } else {
      /* Unquantized, full color RGB */
      bits_per_pixel = 24;
      cmap_entries = 0;
    }
  } else {
    /* Grayscale output.  We need to fake a 256-entry colormap. */
    bits_per_pixel = 8;
    cmap_entries = 256;
  }
  /* File size */
  headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */
  bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
  
  /* Set unused fields of header to 0 */
  MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
  MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader));

  /* Fill the file header */
  bmpfileheader[0] = 0x42;	/* first 2 bytes are ASCII 'B', 'M' */
  bmpfileheader[1] = 0x4D;
  PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */
  /* we leave bfReserved1 & bfReserved2 = 0 */
  PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */

  /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */
  PUT_2B(bmpcoreheader, 0, 12);	/* bcSize */
  PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */
  PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */
  PUT_2B(bmpcoreheader, 8, 1);	/* bcPlanes - must be 1 */
  PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */

  if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
    ERREXIT(cinfo, JERR_FILE_WRITE);
  if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12)
    ERREXIT(cinfo, JERR_FILE_WRITE);

	

  if (cmap_entries > 0)
    write_colormap(cinfo, dest, cmap_entries, 3);
}
开发者ID:jguerrero,项目名称:libomxil-bellagio,代码行数:56,代码来源:wrbmp.c

示例2: write_os2_header

write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
{
  char bmpfileheader[14];
  char bmpcoreheader[12];
  INT32 headersize, bfSize;
  int bits_per_pixel, cmap_entries;

  
  if (cinfo->out_color_space == JCS_RGB) {
    if (cinfo->quantize_colors) {
      
      bits_per_pixel = 8;
      cmap_entries = 256;
    } else {
      
      bits_per_pixel = 24;
      cmap_entries = 0;
    }
  } else {
    
    bits_per_pixel = 8;
    cmap_entries = 256;
  }
  
  headersize = 14 + 12 + cmap_entries * 3; 
  bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
  
  
  MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
  MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader));

  
  bmpfileheader[0] = 0x42;	
  bmpfileheader[1] = 0x4D;
  PUT_4B(bmpfileheader, 2, bfSize); 
  
  PUT_4B(bmpfileheader, 10, headersize); 

  
  PUT_2B(bmpcoreheader, 0, 12);	
  PUT_2B(bmpcoreheader, 4, cinfo->output_width); 
  PUT_2B(bmpcoreheader, 6, cinfo->output_height); 
  PUT_2B(bmpcoreheader, 8, 1);	
  PUT_2B(bmpcoreheader, 10, bits_per_pixel); 

  if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
    ERREXIT(cinfo, JERR_FILE_WRITE);
  if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12)
    ERREXIT(cinfo, JERR_FILE_WRITE);

  if (cmap_entries > 0)
    write_colormap(cinfo, dest, cmap_entries, 3);
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:53,代码来源:wrbmp.c

示例3: put_pixel_rows

put_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
               JDIMENSION rows_supplied)
{
  ppm_dest_ptr dest = (ppm_dest_ptr)dinfo;

  (void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
开发者ID:GerbilSoft,项目名称:rom-properties,代码行数:7,代码来源:wrppm.c

示例4: put_demapped_rgb

METHODDEF void
put_demapped_rgb (decompress_info_ptr cinfo, int num_rows,
		  JSAMPIMAGE pixel_data)
{
  FILE * outfile = cinfo->output_file;
  register JSAMPROW ptr;
  register char * row_bufferptr;
  register JSAMPROW color_map0 = cinfo->colormap[0];
  register JSAMPROW color_map1 = cinfo->colormap[1];
  register JSAMPROW color_map2 = cinfo->colormap[2];
  register int pixval;
  register long col;
  long width = cinfo->image_width;
  int row;
  
  for (row = 0; row < num_rows; row++) {
    ptr = pixel_data[0][row];
    row_bufferptr = row_buffer;
    for (col = width; col > 0; col--) {
      pixval = GETJSAMPLE(*ptr++);
      *row_bufferptr++ = (char) GETJSAMPLE(color_map0[pixval]);
      *row_bufferptr++ = (char) GETJSAMPLE(color_map1[pixval]);
      *row_bufferptr++ = (char) GETJSAMPLE(color_map2[pixval]);
    }
    (void) JFWRITE(outfile, row_buffer, 3*width);
  }
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:27,代码来源:jwrppm.c

示例5: write_backing_store

METHODDEF void
write_backing_store(j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count)
{
    if(fseek(info->temp_file, file_offset, SEEK_SET))
        ERREXIT(cinfo, JERR_TFILE_SEEK);
    if(JFWRITE(info->temp_file, buffer_address, byte_count) != (size_t) byte_count)
        ERREXIT(cinfo, JERR_TFILE_WRITE);
}
开发者ID:justinvh,项目名称:Rogue-Reborn,代码行数:8,代码来源:jmemname.c

示例6: flush_packet

flush_packet (gif_dest_ptr dinfo)
{
  if (dinfo->bytesinpkt > 0) {	
    dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++;
    if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt)
	!= (size_t) dinfo->bytesinpkt)
      ERREXIT(dinfo->cinfo, JERR_FILE_WRITE);
    dinfo->bytesinpkt = 0;
  }
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:10,代码来源:wrgif.c

示例7: write_backing_store

METHODDEF void
write_backing_store (backing_store_ptr info, void FAR * buffer_address,
		     long file_offset, long byte_count)
{
  if (fseek(info->temp_file, file_offset, SEEK_SET))
    ERREXIT(methods, "fseek failed on temporary file");
  if (JFWRITE(info->temp_file, buffer_address, byte_count)
      != (size_t) byte_count)
    ERREXIT(methods, "fwrite failed on temporary file --- out of disk space?");
}
开发者ID:AnimatorPro,项目名称:Animator-Pro,代码行数:10,代码来源:JMEMNAME.C

示例8: empty_output_buffer

empty_output_buffer(j_compress_ptr cinfo)
{
	my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
	if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
	    (size_t) OUTPUT_BUF_SIZE)
		ERREXIT(cinfo, JERR_FILE_WRITE);
	dest->pub.next_output_byte = dest->buffer;
	dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
	return TRUE;
}
开发者ID:Codyle,项目名称:pcsx2,代码行数:10,代码来源:jdatadst.c

示例9: flush_packet

flush_packet (gif_dest_ptr dinfo)
/* flush any accumulated data */
{
  if (dinfo->bytesinpkt > 0) {  /* never write zero-length packet */
    dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++;
    if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt)
        != (size_t) dinfo->bytesinpkt)
      ERREXIT(dinfo->cinfo, JERR_FILE_WRITE);
    dinfo->bytesinpkt = 0;
  }
}
开发者ID:DankRank,项目名称:rom-properties,代码行数:11,代码来源:wrgif.c

示例10: term_destination

term_destination (j_compress_ptr cinfo)
{
  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
  size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;

  /* Write any data remaining in the buffer */
  if (datacount > 0) {
    if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
      ERREXIT(cinfo, JERR_FILE_WRITE);
  }
  f_close(dest->outfile);
}
开发者ID:ADTL,项目名称:ARMWork,代码行数:12,代码来源:jdatadst.c

示例11: write_backing_store

	write_backing_store (j_common_ptr cinfo, backing_store_ptr info,
	void FAR * buffer_address,
	long file_offset, long byte_count)
{
	if (fseek(info->temp_file, file_offset, SEEK_SET))
		ERREXIT(cinfo, JERR_TFILE_SEEK);

	size_t wrote = JFWRITE(info->temp_file, buffer_address, byte_count);
	if(wrote != (size_t)byte_count) {
		LOGD("write back store: offset(%d), buf(%p), fp(%p), wrote(%d) != byte_count(%d)", file_offset, buffer_address, info->temp_file, wrote, byte_count);
		ERREXIT(cinfo, JERR_TFILE_WRITE);
	}
}
开发者ID:afpro,项目名称:super-cache,代码行数:13,代码来源:jmem-android-sc.c

示例12: copy_pixel_rows

copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
                 JDIMENSION rows_supplied)
{
  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
  register char *bufferptr;
  register JSAMPROW ptr;
  register JDIMENSION col;

  ptr = dest->pub.buffer[0];
  bufferptr = dest->iobuffer;
  for (col = dest->samples_per_row; col > 0; col--) {
    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
  }
  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
开发者ID:Acidburn0zzz,项目名称:libjpeg-turbo,代码行数:15,代码来源:wrppm.c

示例13: term_destination

term_destination (j_compress_ptr cinfo)
{
    my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
    size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;

    /* Write any data remaining in the buffer */
    if (datacount > 0) {
        if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
            ERREXIT(cinfo, JERR_FILE_WRITE);
    }
    JFFLUSH(dest->outfile);
    /* Make sure we wrote the output file OK */
    if (JFERROR(dest->outfile))
        ERREXIT(cinfo, JERR_FILE_WRITE);
}
开发者ID:sanikoyes,项目名称:lua-tools,代码行数:15,代码来源:jdatadst.c

示例14: put_demapped_gray

put_demapped_gray(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
                  JDIMENSION rows_supplied)
{
  ppm_dest_ptr dest = (ppm_dest_ptr)dinfo;
  register char *bufferptr;
  register JSAMPROW ptr;
  register JSAMPROW color_map = cinfo->colormap[0];
  register JDIMENSION col;

  ptr = dest->pub.buffer[0];
  bufferptr = dest->iobuffer;
  for (col = cinfo->output_width; col > 0; col--) {
    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)]));
  }
  (void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
开发者ID:GerbilSoft,项目名称:rom-properties,代码行数:16,代码来源:wrppm.c

示例15: term_destination

term_destination (j_compress_ptr cinfo)
{
#ifndef USE_SYMBIAN
	my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
	int datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;

	/* Write any data remaining in the buffer */
	if (datacount > 0) {
		if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
			ERREXIT(cinfo, JERR_FILE_WRITE);
	}
	fflush(dest->outfile);
	/* Make sure we wrote the output file OK */
	if (ferror(dest->outfile))
		ERREXIT(cinfo, JERR_FILE_WRITE);
#endif
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:17,代码来源:jdatadst.c


注:本文中的JFWRITE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。