OPNGCORE is a PNG Compression Optimization and Recovery Engine. More...
#include <limits.h>
#include <stddef.h>
#include "optk/bits.h"
Go to the source code of this file.
Data Structures | |
struct | opng_options |
The user options structure. More... | |
struct | opng_version_info |
The version info structure. More... | |
Typedefs | |
typedef struct opng_optimizer | opng_optimizer_t |
The optimizer type. | |
typedef struct opng_image | opng_image_t |
The image type. | |
Enumerations | |
enum | { OPNG_MSG_ALL = 0, OPNG_MSG_DEBUG = 10, OPNG_MSG_INFO = 20, OPNG_MSG_WARNING = 30, OPNG_MSG_ERROR = 40, OPNG_MSG_CRITICAL = 50, OPNG_MSG_OFF = (unsigned int)(-1), OPNG_MSG_DEFAULT = OPNG_MSG_OFF } |
Message severity levels. More... | |
enum | { OPNG_MSGFMT_RAW = 0, OPNG_MSGFMT_UNIX = 1, OPNG_MSGFMT_FANCY = 2, OPNG_MSGFMT_DEFAULT = OPNG_MSGFMT_UNIX } |
Message formats. | |
enum | { OPNG_OPTIM_LEVEL_MIN = -2, OPNG_OPTIM_LEVEL_MAX = 6, OPNG_OPTIM_LEVEL_FASTEST = -2, OPNG_OPTIM_LEVEL_FAST = -1, OPNG_OPTIM_LEVEL_DEFAULT = 2, OPNG_FILTER_MIN = 0, OPNG_FILTER_MAX = 5, OPNG_FILTER_SET_MASK = (1 << (5+1)) - (1 << 0), OPNG_ZCOMPR_LEVEL_MIN = 1, OPNG_ZCOMPR_LEVEL_MAX = 9, OPNG_ZCOMPR_LEVEL_SET_MASK = (1 << (9+1)) - (1 << 1), OPNG_ZMEM_LEVEL_MIN = 1, OPNG_ZMEM_LEVEL_MAX = 9, OPNG_ZMEM_LEVEL_SET_MASK = (1 << (9+1)) - (1 << 1), OPNG_ZSTRATEGY_MIN = 0, OPNG_ZSTRATEGY_MAX = 3, OPNG_ZSTRATEGY_SET_MASK = (1 << (3+1)) - (1 << 0), OPNG_ZWINDOW_BITS_MIN = 8, OPNG_ZWINDOW_BITS_MAX = 15, OPNG_ZWINDOW_BITS_SET_MASK = (1 << (15+1)) - (1 << 8) } |
Encoder constants and limits. | |
Functions | |
opng_optimizer_t * | opng_create_optimizer (void) |
Creates an optimizer object. | |
int | opng_set_options (opng_optimizer_t *optimizer, const struct opng_options *user_options) |
Sets the user options in an optimizer object. | |
int | opng_optimize_file (opng_optimizer_t *optimizer, const char *in_fname, const char *out_fname, const char *out_dirname) |
Optimizes an image file. | |
void | opng_destroy_optimizer (opng_optimizer_t *optimizer) |
Destroys an optimizer object. | |
void | opng_set_logging_name (const char *program_name) |
Sets the program name associated with the logger. | |
void | opng_set_logging_level (unsigned int level) |
Sets the logging severity level. | |
void | opng_set_logging_format (int format) |
Sets the logging format. | |
int | opng_flush_logging (unsigned int level) |
Flushes the logger at the given severity level. | |
int | opng_print_message (unsigned int level, const char *fname, const char *message) |
Prints a message of a given severity level, concerning a given file name, using the current logging message format, to the logger. | |
int | opng_debugf (const char *format,...) |
Prints a printf-formatted debug message (level = OPNG_MSG_DEBUG ) to the logger. | |
int | opng_printf (const char *format,...) |
Prints a printf-formatted informational message (level = OPNG_MSG_INFO ) to the logger. | |
int | opng_warning (const char *fname, const char *message) |
Prints a warning message (level = OPNG_MSG_WARNING ) to the logger. | |
int | opng_error (const char *fname, const char *message, const char *submessage) |
Prints an error message (level = OPNG_MSG_ERROR ), optionally accompanied by a submessage, to the logger. | |
struct opng_version_info * | opng_get_version_info (void) |
Returns an array of version info objects, terminated by NULLs. | |
OPNGCORE is a PNG Compression Optimization and Recovery Engine.
Copyright (C) 2001-2012 Cosmin Truta.
This software is distributed under the zlib license. Please see the accompanying LICENSE file, or visit http://www.opensource.org/licenses/zlib-license.php
typedef struct opng_image opng_image_t |
The image type.
Image objects are currently used internally only. There is no public API to access them yet.
typedef struct opng_optimizer opng_optimizer_t |
The optimizer type.
An optimizer object can optimize one or more images, sequentially.
anonymous enum |
Message severity levels.
Each level allows up to 10 custom sub-levels. The level numbers are loosely based on the Python logging module.
opng_optimizer_t* opng_create_optimizer | ( | void | ) |
Creates an optimizer object.
NULL
on failure. void opng_destroy_optimizer | ( | opng_optimizer_t * | optimizer | ) |
Destroys an optimizer object.
optimizer | the optimizer object to be destroyed. |
int opng_flush_logging | ( | unsigned int | level | ) |
Flushes the logger at the given severity level.
To avoid useless fflush operations, it is recommended to set the severity level to the level of the messages that have been displayed and need to be flushed.
level | the minimum severity level at which flushing is triggered. |
int opng_optimize_file | ( | opng_optimizer_t * | optimizer, |
const char * | in_fname, | ||
const char * | out_fname, | ||
const char * | out_dirname | ||
) |
Optimizes an image file.
optimizer | the optimizer object. |
in_fname | the input file name. |
out_fname | the output file name. It can be NULL , in which case the output has the same name as the input. |
out_dirname | the output directory name. It can be NULL . |
int opng_print_message | ( | unsigned int | level, |
const char * | fname, | ||
const char * | message | ||
) |
Prints a message of a given severity level, concerning a given file name, using the current logging message format, to the logger.
fname | the file name associated with the message; can be NULL . |
level | the severity level OPNG_MSG_ ... |
message | the message to be displayed. |
void opng_set_logging_format | ( | int | format | ) |
void opng_set_logging_level | ( | unsigned int | level | ) |
Sets the logging severity level.
level | the severity level OPNG_MSG_ ... |
void opng_set_logging_name | ( | const char * | program_name | ) |
Sets the program name associated with the logger.
program_name | the program name displayed on warnings or errors. It can be NULL . |
int opng_set_options | ( | opng_optimizer_t * | optimizer, |
const struct opng_options * | user_options | ||
) |
Sets the user options in an optimizer object.
An optimizer can run only if it has been given a set of options; there are no defaults. Options can be changed repeatedly between optimization sessions (for the benefit of interactive applications), but they shall not be changed during these sessions.
optimizer | the optimizer object whose user options are changed. |
user_options | the user options. |