/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.2.38 [July 16, 2009]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
* Transformations that are used in both reading and writing are
* in pngtrans.c.
*/
#define PNG_INTERNAL
#include "png.h"
#if defined(PNG_READ_SUPPORTED)
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{
png_debug(1, "in png_set_crc_action");
/* Tell libpng how we react to CRC errors in critical chunks */
if (png_ptr == NULL)
return;
switch (crit_action)
{
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
break;
case PNG_CRC_WARN_USE: /* Warn/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE;
break;
case PNG_CRC_QUIET_USE: /* Quiet/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE |
PNG_FLAG_CRC_CRITICAL_IGNORE;
break;
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
"Can't discard critical data on CRC error.");
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
default:
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
break;
}
switch (ancil_action)
{
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
break;
case PNG_CRC_WARN_USE: /* Warn/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE;
break;
case PNG_CRC_QUIET_USE: /* Quiet/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE |
PNG_FLAG_CRC_ANCILLARY_NOWARN;
break;
case PNG_CRC_ERROR_QUIT: /* Error/quit */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN;
break;
case PNG_CRC_WARN_DISCARD: /* Warn/discard data */
case PNG_CRC_DEFAULT:
default:
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
break;
}
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
/* Handle alpha and tRNS via a background color */
void PNGAPI
png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)
{
png_debug(1, "in png_set_background");
if (png_ptr == NULL)
return;
if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
{
png_warning(png_ptr, "Application must supply a known background gamma");
return;
}
png_ptr->transformations |= PNG_BACKGROUND;
png_memcpy(&(png_ptr->background), background_color,
png_sizeof(png_color_16));
png_ptr->background_gamma = (float)background_gamma;
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0);
}
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
/* Strip 16 bit depth files to 8 bit depth */
void PNGAPI
png_set_strip_16(png_structp png_ptr)
{
png_debug(1, "in png_set_strip_16");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_16_TO_8;
}
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
void PNGAPI
png_set_strip_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_strip_alpha");
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
}
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
/* Dither file to 8 bit. Supply a palette, the current number
* of elements in the palette, the maximum number of elements
* allowed, and a histogram if possible. If the current number
* of colors is greater then the maximum number, the palette will be
* modified to fit in the maximum number. "full_dither" indicates
* whether we need a dithering cube set up for RGB images, or if we
* simply are reducing the number of colors in a paletted image.
*/
typedef struct png_dsort_struct
{
struct png_dsort_struct FAR * next;
png_byte left;
png_byte right;
} png_dsort;
typedef png_dsort FAR * png_dsortp;
typedef png_dsort FAR * FAR * png_dsortpp;
void PNGAPI
png_set_dither(png_structp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_uint_16p histogram,
int full_dither)
{
png_debug(1, "in png_set_dither");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_DITHER;
if (!full_dither)
{
int i;
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(num_palette * png_sizeof(png_byte)));
for (i = 0; i < num_palette; i++)
png_ptr->dither_index[i] = (png_byte)i;
}
if (num_palette > maximum_colors)
{
if (histogram != NULL)
{
/* This is easy enough, just throw out the least used colors.
* Perhaps not the best solution, but good enough.
*/
int i;
/* Initialize an array to sort colors */
png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(num_palette * png_sizeof(png_byte)));
/* Initialize the dither_sort array */
for (i = 0; i < num_palette; i++)
png_ptr->dither_sort[i] = (png_byte)i;
/* Find the least used palette entries by starting a
* bubble sort, and running it until we have sorted
* out enough colors. Note that we don't care about
* sorting all the colors, just finding which are
* least used.
*/
for (i = num_palette - 1; i >= maximum_colors; i--)
{
int done; /* To stop early if the list is pre-sorted */
int j;
done = 1;
for (j = 0; j < i; j++)
{
if (histogram[png_ptr->dither_sort[j]]
< histogram[png_ptr->dither_sort[j + 1]])
{
png_byte t;
t = png_ptr->dither_sort[j];
png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1];
png_ptr->dither_sort[j + 1] = t;
done = 0;
}
}
if (done)
break;
}
/* Swap the palette around, and set up a table, if necessary */
if (full_dither)
{
int j = num_palette;
/* Put all the useful colors within the max, but don't
* move the others.
*/
for (i = 0; i < maximum_colors; i++)
{
if ((int)png_ptr->dither_sort[i] >= maximum_colors)
{
do
j--;
while ((int)png_ptr->dither_sort[j] >= maximum_colors);
palette[i] = palette[j];
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Codejock.Xtreme.Toolkit.Pro.v15.3.1 源码,.sln的工程属性32位和64位已经全部修改为 VS2017工程属性。直接使用VS2017打开编译即可使用。同时里面包含了已编译好的debug和release的动态库和静态库如下: ToolkitPro1531vc150.lib ToolkitPro1531vc150.dll ToolkitPro1531vc150D.lib ToolkitPro1531vc150D.dll ToolkitPro1531vc150S.lib ToolkitPro1531vc150SD.lib
资源推荐
资源详情
资源评论
收起资源包目录
Codejock.Xtreme.Toolkit.Pro.v15.3.1 VS2017版本 (4654个子文件)
UserIcons.bmp 5KB
ReportGlyphs.bmp 5KB
bookmark.bmp 2KB
glyph_hot.bmp 2KB
glyph.bmp 2KB
TaskPanelGripperSpecial.bmp 1KB
TaskPanelGripper.bmp 1KB
glyphs.bmp 938B
tbar_hdr.bmp 718B
tbar_hex.bmp 718B
scroll.bmp 602B
btn_out.bmp 600B
EventGlyps.bmp 558B
btn_listedit.bmp 454B
TabGroups.bmp 374B
tbar_propgrid.bmp 374B
checklist.bmp 358B
checklist_3d.bmp 358B
font.bmp 358B
tbar_out.bmp 358B
UpDown.bmp 250B
TenativePattern.bmp 246B
ExpandSignDown.bmp 214B
ExpandSignUp.bmp 214B
VisioGripper.bmp 214B
MenuBarIcons.bmp 190B
Office2007_CalendarTenativePattern.bmp 94B
pngrtran.c 149KB
pngrutil.c 96KB
pngwutil.c 86KB
deflate.c 64KB
pngwrite.c 50KB
inflate.c 49KB
pngpread.c 48KB
pngread.c 47KB
trees.c 44KB
pngset.c 40KB
gzio.c 31KB
png.c 27KB
pngget.c 25KB
infback.c 22KB
pngtrans.c 21KB
pngwtran.c 18KB
pngmem.c 17KB
inftrees.c 14KB
crc32.c 13KB
inffast.c 13KB
pngerror.c 11KB
pngwio.c 8KB
zutil.c 7KB
pngrio.c 6KB
adler32.c 5KB
compress.c 3KB
uncompr.c 2KB
WinXP.Luna.cjstyles 1.5MB
Codejock.cjstyles 1.31MB
Office2010.cjstyles 818KB
Vista.cjstyles 728KB
Office2007.cjstyles 624KB
WinXP.Royale.cjstyles 509KB
XTPCalendarThemeOffice2007.cpp 248KB
XTPSyntaxEditCtrl.cpp 214KB
XTPReportControl.cpp 187KB
XTPSyntaxEditLexParser.cpp 119KB
XTPCalendarTheme.cpp 116KB
XTPCalendarDatabaseDataProvider.cpp 112KB
XTPReportPaintManager.cpp 112KB
XTPCalendarMAPIDataProvider.cpp 108KB
XTPCalendarView.cpp 108KB
XTPImageManager.cpp 107KB
XTPCalendarPaintManager.cpp 97KB
XTPDockingPanePaintManager.cpp 96KB
XTPCalendarDayView.cpp 91KB
XTPSyntaxEditLexClass.cpp 88KB
XTOutBarCtrl.cpp 85KB
XTPTaskPanelPaintManager.cpp 85KB
XTPRibbonBar.cpp 85KB
XTPCalendarControl.cpp 85KB
XTPTabClientWnd.cpp 76KB
XTPPaintManager.cpp 73KB
XTPSkinObjectMenu.cpp 71KB
XTPResourceTheme.cpp 68KB
XTPPropExchange.cpp 64KB
XTPCalendarCaptionBarControl.cpp 61KB
XTPOffice2003Theme.cpp 61KB
XTPTaskPanel.cpp 59KB
XTPCommandBars.cpp 58KB
XTPMarkupBuilder.cpp 58KB
XTPTabPaintManagerAppearance.cpp 58KB
XTPDatePickerControl.cpp 58KB
XTPToolTipContext.cpp 57KB
XTPControlGallery.cpp 56KB
XTPDockingPaneContext.cpp 56KB
XTPStatusBar.cpp 56KB
XTPCommandBar.cpp 56KB
XTPDockState.cpp 55KB
XTPSkinManagerApiHook.cpp 54KB
XTPTaskDialogClient.cpp 54KB
XTPSkinManagerSchema.cpp 54KB
XTPPropertyGridPaintManager.cpp 54KB
共 4654 条
- 1
- 2
- 3
- 4
- 5
- 6
- 47
资源评论
- 驱动未来2019-03-30这个不知道咋用的
- inlench2019-05-03再次下载看看
- 柳长街2024-01-16很好用,我已经下载试用了,十分感谢!! #完美解决问题
- fenqinyao2023-09-20没有装VS2017,用VS2022打开,升级平台工具集为v143可以编译,作为学习很不错,遗憾的是没有样例程序。至于有没许可限制就不知道了,只用来学习的。
明卿
- 粉丝: 1w+
- 资源: 54
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功