📄 libmng_prop_xs.c
字号:
/* ************************************************************************** *//* * For conditions of distribution and use, * *//* * see copyright notice in libmng.h * *//* ************************************************************************** *//* * * *//* * project : libmng * *//* * file : libmng_prop_xs.c copyright (c) 2000-2004 G.Juyn * *//* * version : 1.0.9 * *//* * * *//* * purpose : property get/set interface (implementation) * *//* * * *//* * author : G.Juyn * *//* * * *//* * comment : implementation of the property get/set functions * *//* * * *//* * changes : 0.5.1 - 05/08/2000 - G.Juyn * *//* * - fixed calling convention * *//* * - changed strict-ANSI stuff * *//* * 0.5.1 - 05/11/2000 - G.Juyn * *//* * - added set_outputprofile2 & set_srgbprofile2 * *//* * 0.5.1 - 05/12/2000 - G.Juyn * *//* * - changed trace to macro for callback error-reporting * *//* * * *//* * 0.5.2 - 05/23/2000 - G.Juyn * *//* * - changed inclusion of cms-routines * *//* * 0.5.2 - 05/24/2000 - G.Juyn * *//* * - added support for get/set default zlib/IJG parms * *//* * 0.5.2 - 05/31/2000 - G.Juyn * *//* * - fixed up punctuation (contribution by Tim Rowley) * *//* * 0.5.2 - 06/05/2000 - G.Juyn * *//* * - added support for RGB8_A8 canvasstyle * *//* * * *//* * 0.5.3 - 06/21/2000 - G.Juyn * *//* * - added get/set for speedtype to facilitate testing * *//* * - added get for imagelevel during processtext callback * *//* * 0.5.3 - 06/26/2000 - G.Juyn * *//* * - changed userdata variable to mng_ptr * *//* * 0.5.3 - 06/29/2000 - G.Juyn * *//* * - fixed incompatible return-types * *//* * * *//* * 0.9.1 - 07/08/2000 - G.Juyn * *//* * - added get routines for internal display variables * *//* * - added get/set routines for suspensionmode variable * *//* * 0.9.1 - 07/15/2000 - G.Juyn * *//* * - added get/set routines for sectionbreak variable * *//* * * *//* * 0.9.2 - 07/31/2000 - G.Juyn * *//* * - added status_xxxx functions * *//* * 0.9.2 - 08/05/2000 - G.Juyn * *//* * - changed file-prefixes * *//* * * *//* * 0.9.3 - 10/10/2000 - G.Juyn * *//* * - added support for alpha-depth prediction * *//* * 0.9.3 - 10/16/2000 - G.Juyn * *//* * - added functions to retrieve PNG/JNG specific header-info * *//* * 0.9.3 - 10/20/2000 - G.Juyn * *//* * - added get/set for bKGD preference setting * *//* * 0.9.3 - 10/21/2000 - G.Juyn * *//* * - added get function for interlace/progressive display * *//* * * *//* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * *//* * - added BGRA8 canvas with premultiplied alpha * *//* * 1.0.1 - 05/02/2001 - G.Juyn * *//* * - added "default" sRGB generation (Thanks Marti!) * *//* * * *//* * 1.0.2 - 06/23/2001 - G.Juyn * *//* * - added optimization option for MNG-video playback * *//* * 1.0.2 - 06/25/2001 - G.Juyn * *//* * - added option to turn off progressive refresh * *//* * * *//* * 1.0.3 - 08/06/2001 - G.Juyn * *//* * - added get function for last processed BACK chunk * *//* * * *//* * 1.0.4 - 06/22/2002 - G.Juyn * *//* * - B495442 - invalid returnvalue in mng_get_suspensionmode * *//* * * *//* * 1.0.5 - 09/14/2002 - G.Juyn * *//* * - added event handling for dynamic MNG * *//* * 1.0.5 - 09/22/2002 - G.Juyn * *//* * - added bgrx8 canvas (filler byte) * *//* * 1.0.5 - 11/07/2002 - G.Juyn * *//* * - added support to get totals after mng_read() * *//* * * *//* * 1.0.6 - 05/11/2003 - G. Juyn * *//* * - added conditionals around canvas update routines * *//* * 1.0.6 - 07/07/2003 - G.R-P * *//* * - added conditionals around some JNG-supporting code * *//* * 1.0.6 - 07/11/2003 - G.R-P * *//* * - added conditionals zlib and jpeg property accessors * *//* * 1.0.6 - 07/14/2003 - G.R-P * *//* * - added conditionals around various unused functions * *//* * * *//* * 1.0.7 - 11/27/2003 - R.A * *//* * - added CANVAS_RGB565 and CANVAS_BGR565 * *//* * 1.0.7 - 12/06/2003 - R.A * *//* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * *//* * 1.0.7 - 01/25/2004 - J.S * *//* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * *//* * 1.0.7 - 03/07/2004 - G.R-P. * *//* * - put gamma, cms-related functions inside #ifdef * *//* * * *//* * 1.0.8 - 04/02/2004 - G.Juyn * *//* * - added CRC existence & checking flags * *//* * * *//* * 1.0.9 - 09/18/2004 - G.R-P. * *//* * - added some MNG_SUPPORT_WRITE conditionals * *//* * 1.0.9 - 10/03/2004 - G.Juyn * *//* * - added function to retrieve current FRAM delay * *//* * 1.0.9 - 10/14/2004 - G.Juyn * *//* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * *//* * 1.0.9 - 12/20/2004 - G.Juyn * *//* * - cleaned up macro-invocations (thanks to D. Airlie) * *//* * * *//* ************************************************************************** */#include "libmng.h"#include "libmng_data.h"#include "libmng_error.h"#include "libmng_trace.h"#ifdef __BORLANDC__#pragma hdrstop#endif#include "libmng_objects.h"#include "libmng_memory.h"#include "libmng_cms.h"#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)#pragma option -A /* force ANSI-C */#endif/* ************************************************************************** *//* * * *//* * Property set functions * *//* * * *//* ************************************************************************** */mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, mng_ptr pUserdata){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->pUserdata = pUserdata;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle, mng_uint32 iStyle){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) switch (iStyle) {#ifndef MNG_SKIPCANVAS_RGB8 case MNG_CANVAS_RGB8 : break;#endif#ifndef MNG_SKIPCANVAS_RGBA8 case MNG_CANVAS_RGBA8 : break;#endif#ifndef MNG_SKIPCANVAS_RGBA8_PM case MNG_CANVAS_RGBA8_PM: break;#endif#ifndef MNG_SKIPCANVAS_ARGB8 case MNG_CANVAS_ARGB8 : break;#endif#ifndef MNG_SKIPCANVAS_ARGB8_PM case MNG_CANVAS_ARGB8_PM: break;#endif#ifndef MNG_SKIPCANVAS_RGB8_A8 case MNG_CANVAS_RGB8_A8 : break;#endif#ifndef MNG_SKIPCANVAS_BGR8 case MNG_CANVAS_BGR8 : break;#endif#ifndef MNG_SKIPCANVAS_BGRX8 case MNG_CANVAS_BGRX8 : break;#endif#ifndef MNG_SKIPCANVAS_BGRA8 case MNG_CANVAS_BGRA8 : break;#endif#ifndef MNG_SKIPCANVAS_BGRA8_PM case MNG_CANVAS_BGRA8_PM: break;#endif#ifndef MNG_SKIPCANVAS_ABGR8 case MNG_CANVAS_ABGR8 : break;#endif#ifndef MNG_SKIPCANVAS_ABGR8_PM case MNG_CANVAS_ABGR8_PM: break;#endif#ifndef MNG_SKIPCANVAS_RGB565 case MNG_CANVAS_RGB565 : break;#endif#ifndef MNG_SKIPCANVAS_RGBA565 case MNG_CANVAS_RGBA565 : break;#endif#ifndef MNG_SKIPCANVAS_BGR565 case MNG_CANVAS_BGR565 : break;#endif#ifndef MNG_SKIPCANVAS_BGRA565 case MNG_CANVAS_BGRA565 : break;#endif#ifndef MNG_SKIPCANVAS_BGR565_A8 case MNG_CANVAS_BGR565_A8 : break;#endif/* case MNG_CANVAS_RGB16 : break; *//* case MNG_CANVAS_RGBA16 : break; *//* case MNG_CANVAS_ARGB16 : break; *//* case MNG_CANVAS_BGR16 : break; *//* case MNG_CANVAS_BGRA16 : break; *//* case MNG_CANVAS_ABGR16 : break; *//* case MNG_CANVAS_INDEX8 : break; *//* case MNG_CANVAS_INDEXA8 : break; *//* case MNG_CANVAS_AINDEX8 : break; *//* case MNG_CANVAS_GRAY8 : break; *//* case MNG_CANVAS_GRAY16 : break; *//* case MNG_CANVAS_GRAYA8 : break; *//* case MNG_CANVAS_GRAYA16 : break; *//* case MNG_CANVAS_AGRAY8 : break; *//* case MNG_CANVAS_AGRAY16 : break; *//* case MNG_CANVAS_DX15 : break; *//* case MNG_CANVAS_DX16 : break; */ default : { MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE) }; } ((mng_datap)hHandle)->iCanvasstyle = iStyle;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle, mng_uint32 iStyle){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) switch (iStyle) /* alpha-modes not supported */ {#ifndef MNG_SKIPCANVAS_RGB8 case MNG_CANVAS_RGB8 : break;#endif#ifndef MNG_SKIPCANVAS_BGR8 case MNG_CANVAS_BGR8 : break;#endif#ifndef MNG_SKIPCANVAS_BGRX8 case MNG_CANVAS_BGRX8 : break;#endif#ifndef MNG_SKIPCANVAS_RGB565 case MNG_CANVAS_RGB565 : break;#endif#ifndef MNG_SKIPCANVAS_BGR565 case MNG_CANVAS_BGR565 : break;#endif/* case MNG_CANVAS_RGB16 : break; *//* case MNG_CANVAS_BGR16 : break; *//* case MNG_CANVAS_INDEX8 : break; *//* case MNG_CANVAS_GRAY8 : break; *//* case MNG_CANVAS_GRAY16 : break; *//* case MNG_CANVAS_DX15 : break; *//* case MNG_CANVAS_DX16 : break; */ default : MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE); } ((mng_datap)hHandle)->iBkgdstyle = iStyle;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle, mng_uint16 iRed, mng_uint16 iGreen, mng_uint16 iBlue){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->iBGred = iRed; ((mng_datap)hHandle)->iBGgreen = iGreen; ((mng_datap)hHandle)->iBGblue = iBlue; ((mng_datap)hHandle)->bUseBKGD = MNG_FALSE;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle, mng_bool bUseBKGD){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->bUseBKGD = bUseBKGD;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle, mng_bool bStorechunks){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->bStorechunks = bStorechunks;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle, mng_bool bSectionbreaks){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->bSectionbreaks = bSectionbreaks;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle, mng_bool bCacheplayback){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) if (((mng_datap)hHandle)->bHasheader) MNG_ERROR (((mng_datap)hHandle), MNG_FUNCTIONINVALID); ((mng_datap)hHandle)->bCacheplayback = bCacheplayback;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle, mng_bool bDoProgressive){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->bDoProgressive = bDoProgressive;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_END);#endif return MNG_NOERROR;}/* ************************************************************************** */mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle, mng_uint32 iCrcmode){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_START);#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->iCrcmode = iCrcmode;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_END);#endif return MNG_NOERROR;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -