index.html
Main Page
classes.html
Alphabetical List
annotated.html
Data Structures
files.html
File List
functions.html
Data Fields
globals.html
Globals
api.h File Reference
Defines
#define
api_8h.html#a0
WMF_ERROR
(Z, M)   wmf_error (Z,__FILE__,__LINE__,M)
#define
api_8h.html#a1
WMF_DEBUG
(Z, M)
#define
api_8h.html#a2
WMF_ASSERT
(Z, M)
#define
api_8h.html#a3
WMF_OPT_ALLOC
(1<<0)
#define
api_8h.html#a4
WMF_OPT_ARGS
(1<<1)
#define
api_8h.html#a5
WMF_OPT_FONTDIRS
(1<<2)
#define
api_8h.html#a6
WMF_OPT_FONTMAP
(1<<3)
#define
api_8h.html#a7
WMF_OPT_SYS_FONTS
(1<<4)
#define
api_8h.html#a8
WMF_OPT_SYS_FONTMAP
(1<<5)
#define
api_8h.html#a9
WMF_OPT_XTRA_FONTS
(1<<6)
#define
api_8h.html#a10
WMF_OPT_XTRA_FONTMAP
(1<<7)
#define
api_8h.html#a11
WMF_OPT_GS_FONTMAP
(1<<8)
#define
api_8h.html#a12
WMF_OPT_WRITE
(1<<9)
#define
api_8h.html#a13
WMF_OPT_FUNCTION
(1<<10)
#define
api_8h.html#a14
WMF_OPT_MODULE
(1<<11)
#define
api_8h.html#a15
WMF_OPT_MODULE_DIRS
(1<<12)
#define
api_8h.html#a16
WMF_OPT_IGNORE_NONFATAL
(1<<14)
#define
api_8h.html#a17
WMF_OPT_NO_ERROR
(1<<15)
#define
api_8h.html#a18
WMF_OPT_NO_DEBUG
(1<<16)
#define
api_8h.html#a19
WMF_OPT_LOG_ERROR
(1<<17)
#define
api_8h.html#a20
WMF_OPT_LOG_DEBUG
(1<<18)
#define
api_8h.html#a21
WMF_OPT_DIAGNOSTICS
(1<<19)
Functions
types_8h.html#a5
wmf_error_t
api_8h.html#a22
wmf_api_create
(
types_8h.html#a22
wmfAPI
**, unsigned long,
types_8h.html#a21
wmfAPI_Options
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a23
wmf_api_destroy
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a24
wmf_lite_create
(
types_8h.html#a22
wmfAPI
**, unsigned long,
types_8h.html#a21
wmfAPI_Options
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a25
wmf_lite_destroy
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a26
wmf_header_read
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a27
wmf_scan
(
types_8h.html#a22
wmfAPI
*, unsigned long,
types_8h.html#a15
wmfD_Rect
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a28
wmf_play
(
types_8h.html#a22
wmfAPI
*, unsigned long,
types_8h.html#a15
wmfD_Rect
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a29
wmf_size
(
types_8h.html#a22
wmfAPI
*, float *, float *)
types_8h.html#a5
wmf_error_t
api_8h.html#a30
wmf_display_size
(
types_8h.html#a22
wmfAPI
*, unsigned int *, unsigned int *, double, double)
types_8h.html#a5
wmf_error_t
api_8h.html#a31
wmf_bbuf_input
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a8
wmfRead
,
types_8h.html#a9
wmfSeek
,
types_8h.html#a10
wmfTell
, void *)
types_8h.html#a5
wmf_error_t
api_8h.html#a32
wmf_file_open
(
types_8h.html#a22
wmfAPI
*, const char *)
types_8h.html#a5
wmf_error_t
api_8h.html#a33
wmf_file_close
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a34
wmf_mem_open
(
types_8h.html#a22
wmfAPI
*, unsigned char *, long)
types_8h.html#a5
wmf_error_t
api_8h.html#a35
wmf_mem_close
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a23
wmfStream
*
api_8h.html#a36
wmf_ztream_create
(
types_8h.html#a22
wmfAPI
*, gzFile)
types_8h.html#a23
wmfStream
*
api_8h.html#a37
wmf_stream_create
(
types_8h.html#a22
wmfAPI
*, FILE *)
void
api_8h.html#a38
wmf_ztream_destroy
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a23
wmfStream
*, char **, unsigned long *)
void
api_8h.html#a39
wmf_stream_destroy
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a23
wmfStream
*, char **, unsigned long *)
int
api_8h.html#a40
wmf_stream_printf
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a23
wmfStream
*, char *,...)
void *
api_8h.html#a41
wmf_malloc
(
types_8h.html#a22
wmfAPI
*, size_t)
void *
api_8h.html#a42
wmf_calloc
(
types_8h.html#a22
wmfAPI
*, size_t, size_t)
void *
api_8h.html#a43
wmf_realloc
(
types_8h.html#a22
wmfAPI
*, void *, size_t)
void
api_8h.html#a44
wmf_free
(
types_8h.html#a22
wmfAPI
*, void *)
void
api_8h.html#a45
wmf_detach
(
types_8h.html#a22
wmfAPI
*, void *)
char *
api_8h.html#a46
wmf_strdup
(
types_8h.html#a22
wmfAPI
*, const char *)
char *
api_8h.html#a47
wmf_str_append
(
types_8h.html#a22
wmfAPI
*, char *, char *)
char *
api_8h.html#a48
wmf_strstr
(const char *, const char *)
unsigned long
api_8h.html#a49
wmf_strbuf_grow
(
types_8h.html#a22
wmfAPI
*)
types_8h.html#a5
wmf_error_t
api_8h.html#a50
wmf_player_init
(
types_8h.html#a22
wmfAPI
*)
U16
api_8h.html#a51
wmf_aldus_checksum
(
types_8h.html#a22
wmfAPI
*)
U16
api_8h.html#a52
wmf_read_16
(
types_8h.html#a22
wmfAPI
*)
U32
api_8h.html#a53
wmf_read_32
(
types_8h.html#a22
wmfAPI
*, U16 *, U16 *)
int
api_8h.html#a54
wmf_file_read
(void *)
int
api_8h.html#a55
wmf_file_seek
(void *, long)
long
api_8h.html#a56
wmf_file_tell
(void *)
int
api_8h.html#a57
wmf_mem_read
(void *)
int
api_8h.html#a58
wmf_mem_seek
(void *, long)
long
api_8h.html#a59
wmf_mem_tell
(void *)
int
api_8h.html#a60
wmf_stream_zputs
(char *, void *)
int
api_8h.html#a61
wmf_stream_rezet
(void *)
int
api_8h.html#a62
wmf_stream_sputs
(char *, void *)
int
api_8h.html#a63
wmf_stream_reset
(void *)
void
api_8h.html#a64
wmf_error
(
types_8h.html#a22
wmfAPI
*, char *, int, char *)
void
api_8h.html#a65
wmf_debug
(
types_8h.html#a22
wmfAPI
*, char *, int, char *)
void
api_8h.html#a66
wmf_printf
(
types_8h.html#a22
wmfAPI
*, char *,...)
void
api_8h.html#a67
wmf_assert
(
types_8h.html#a22
wmfAPI
*, char *, int)
char *
api_8h.html#a68
wmf_help
(void)
void
api_8h.html#a69
wmf_set_viewport_origin
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a14
wmfD_Coord
)
void
api_8h.html#a70
wmf_status_function
(
types_8h.html#a22
wmfAPI
*, void *,
types_8h.html#a13
wmfStatus
)
void
api_8h.html#a71
wmf_write
(
types_8h.html#a22
wmfAPI
*, unsigned long, unsigned int, const char *, char **, const unsigned char *, unsigned long)
void
api_8h.html#a72
wmf_write_begin
(
types_8h.html#a22
wmfAPI
*, const char *)
void
api_8h.html#a73
wmf_write_end
(
types_8h.html#a22
wmfAPI
*)
void
api_8h.html#a74
wmf_attr_new
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a25
wmfAttributes
*)
void
api_8h.html#a75
wmf_attr_clear
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a25
wmfAttributes
*)
void
api_8h.html#a76
wmf_attr_free
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a25
wmfAttributes
*)
const char *
api_8h.html#a77
wmf_attr_add
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a25
wmfAttributes
*, const char *, const char *)
const char *
api_8h.html#a78
wmf_attr_query
(
types_8h.html#a22
wmfAPI
*,
types_8h.html#a25
wmfAttributes
*, const char *)
types_8h.html#a5
wmf_error_t
api_8h.html#a79
wmf_wmfxml_import
(
types_8h.html#a22
wmfAPI
*, const char *)
Define Documentation
#define WMF_ASSERT
(
Z,
M
)
Parameters:
Z
the API handle
M
an <expr>, if zero then call
api_8h.html#a67
wmf_assert()
(debug build only)
#define WMF_DEBUG
(
Z,
M
)
Parameters:
Z
the API handle
M
string to send to the debug stream via
api_8h.html#a65
wmf_debug()
(debug build only)
#define WMF_ERROR
(
Z,
M
)
wmf_error (Z,__FILE__,__LINE__,M)
Parameters:
Z
the API handle
M
string to send to the error stream via
api_8h.html#a64
wmf_error()
#define WMF_OPT_ALLOC   (1<<0)
Option to
api_8h.html#a22
wmf_api_create()
use provided [*]alloc/free functions
#define WMF_OPT_ARGS   (1<<1)
Option to
api_8h.html#a22
wmf_api_create()
check provided command line for --wmf-<option>
#define WMF_OPT_DIAGNOSTICS   (1<<19)
Option to
api_8h.html#a22
wmf_api_create()
emit diagnostic information --wmf-diagnostics
#define WMF_OPT_FONTDIRS   (1<<2)
Option to
api_8h.html#a22
wmf_api_create()
font directories specified
#define WMF_OPT_FONTMAP   (1<<3)
Option to
api_8h.html#a22
wmf_api_create()
font mappings specified
#define WMF_OPT_FUNCTION   (1<<10)
Option to
api_8h.html#a22
wmf_api_create()
initialize device-layer with supplied function
#define WMF_OPT_GS_FONTMAP   (1<<8)
Option to
api_8h.html#a22
wmf_api_create()
use specified ghostscript fontmap file
#define WMF_OPT_IGNORE_NONFATAL   (1<<14)
Option to
api_8h.html#a22
wmf_api_create()
ignore (some) non-fatal errors --wmf-ignore-nonfatal
#define WMF_OPT_LOG_DEBUG   (1<<18)
Option to
api_8h.html#a22
wmf_api_create()
divert debug reports to specified stream
#define WMF_OPT_LOG_ERROR   (1<<17)
Option to
api_8h.html#a22
wmf_api_create()
divert error reports to specified stream
#define WMF_OPT_MODULE   (1<<11)
Option to
api_8h.html#a22
wmf_api_create()
initialize device-layer with specified module
#define WMF_OPT_MODULE_DIRS   (1<<12)
Option to
api_8h.html#a22
wmf_api_create()
check for module also in specified directories
#define WMF_OPT_NO_DEBUG   (1<<16)
Option to
api_8h.html#a22
wmf_api_create()
suppress all debug reports --wmf-debug
#define WMF_OPT_NO_ERROR   (1<<15)
Option to
api_8h.html#a22
wmf_api_create()
suppress all error reports --wmf-error
#define WMF_OPT_SYS_FONTMAP   (1<<5)
Option to
api_8h.html#a22
wmf_api_create()
use specified XML system fontmap file
#define WMF_OPT_SYS_FONTS   (1<<4)
Option to
api_8h.html#a22
wmf_api_create()
use system fonts, if found
#define WMF_OPT_WRITE   (1<<9)
Option to
api_8h.html#a22
wmf_api_create()
write metafile to specified file
#define WMF_OPT_XTRA_FONTMAP   (1<<7)
Option to
api_8h.html#a22
wmf_api_create()
use specified XML non-system fontmap file
#define WMF_OPT_XTRA_FONTS   (1<<6)
Option to
api_8h.html#a22
wmf_api_create()
use non-system fonts, if found
Function Documentation
U16 wmf_aldus_checksum
(
types_8h.html#a22
wmfAPI
*
API
)
Compute the Aldus checksum of the metafile's header.
Parameters:
API
the API handle
(Must read the header first, either via
api_8h.html#a27
wmf_scan()
or by calling
api_8h.html#a26
wmf_header_read()
directly.)
Returns:
Returns the checksum.
types_8h.html#a5
wmf_error_t
wmf_api_create
(
types_8h.html#a22
wmfAPI
**
API_return
,
unsigned long
flags
,
types_8h.html#a21
wmfAPI_Options
*
options
)
Creates and initializes an instance of the
libwmf
library for a specified device layer.
Parameters:
API_return
pointer to a wmfAPI* (the API handle use henceforth)
flags
bitwise OR of WMF_OPT_ options
options
pointer to wmfAPI_Options structure
This is the first and necessary step when using
libwmf
. Options are passed via the wmfAPI_Options structure and
flags
. wmf_api_create allocates the wmfAPI structure and initializes the color and font tables, the metafile player, and the device layer. If successful then the pointer to the wmfAPI structure is returned via
API_return
, otherwise all allocated memory is released and the library exits with an appropriate error.
Returns:
The error state of the library:
wmf_E_None
indicates successful creation and initialization of the library, and
*API_return
will be non-zero. For any other error value
*API_return
will be zero.
types_8h.html#a5
wmf_error_t
wmf_api_destroy
(
types_8h.html#a22
wmfAPI
*
API
)
Close the device layer, if open, and release all allocated memory attached to the memory manager.
Parameters:
API
the API handle
Returns:
The final error state of the library.
void wmf_assert
(
types_8h.html#a22
wmfAPI
*
API
,
char *
file
,
int
line
)
Set the error state of the library to wmf_E_Assert.
Parameters:
API
the API handle
file
file name
line
line number
This should only be called via the macro
api_8h.html#a2
WMF_ASSERT(API,<expr>)
which is defined (for debug builds only) as:
#define WMF_ASSERT(Z,M) if (!(M)) wmf_assert (Z,__FILE__,__LINE__)
i.e., if <expr> evaluates to 0 then call
api_8h.html#a67
wmf_assert()
with current file name and line number.
const char* wmf_attr_add
(
types_8h.html#a22
wmfAPI
*
,
types_8h.html#a25
wmfAttributes
*
,
const char *
,
const char *
)
Add an name&value to a wmfAttributes structure; returns ptr to value-in-list
void wmf_attr_clear
(
types_8h.html#a22
wmfAPI
*
,
types_8h.html#a25
wmfAttributes
*
)
Clear/Empty a wmfAttributes structure
void wmf_attr_free
(
types_8h.html#a22
wmfAPI
*
,
types_8h.html#a25
wmfAttributes
*
)
Free memory associated with a wmfAttributes structure
void wmf_attr_new
(
types_8h.html#a22
wmfAPI
*
,
types_8h.html#a25
wmfAttributes
*
)
Initialize a wmfAttributes structure
const char* wmf_attr_query
(
types_8h.html#a22
wmfAPI
*
,
types_8h.html#a25
wmfAttributes
*
,
const char *
)
Return value of name in a wmfAttributes structure; returns 0 if name not found
types_8h.html#a5
wmf_error_t
wmf_bbuf_input
(
types_8h.html#a22
wmfAPI
*
API
,
types_8h.html#a8
wmfRead
fp_read
,
types_8h.html#a9
wmfSeek
fp_seek
,
types_8h.html#a10
wmfTell
fp_tell
,
void *
user_data
)
Set custom metafile input-stream handler functions.
Parameters:
API
the API handle
fp_read
function to read a byte
fp_seek
function to set position
fp_tell
function to get position
user_data
handle for user data
libwmf
has simple methods for reading either from file or from memory, but many applications will want to use customized variants of these.
api_8h.html#a31
wmf_bbuf_input()
enables this.
typedef int  (*wmfRead) (void* user_data);
typedef int  (*wmfSeek) (void* user_data,long position);
typedef long (*wmfTell) (void* user_data);
types_8h.html#a8
wmfRead
returns unsigned char cast to int, or EOF (cf. fgetc())
types_8h.html#a9
wmfSeek
returns (-1) on error, otherwise 0 (cf. fseek())
types_8h.html#a10
wmfTell
returns (-1) on error, otherwise current position (cf. ftell())
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error state of
wmf_E_Glitch
, if any of the three functions is zero.
void* wmf_calloc
(
types_8h.html#a22
wmfAPI
*
API
,
size_t
number
,
size_t
size
)
Allocate memory of specified size and attach to the API's memory manager's internal list.
Parameters:
API
the API handle
number
number or elements
size
size in bytes of memory required by one element
With syntax similar to calloc(),
api_8h.html#a42
wmf_calloc()
allocates
number
*
size
bytes of memory and adds a reference to it in the memory manager's list. To free the memory, use
api_8h.html#a44
wmf_free()
.
Returns:
Pointer to new memory, or zero on failure. Sets error state
wmf_E_InsMem
on failure.
void wmf_debug
(
types_8h.html#a22
wmfAPI
*
API
,
char *
file
,
int
line
,
char *
msg
)
Print message to debug stream.
Parameters:
API
the API handle
file
file name
line
line number
msg
message to print
This should only be called via the macro
api_8h.html#a1
WMF_DEBUG(API,msg)
which (in debug builds only) calls
api_8h.html#a65
wmf_debug()
with the current file name and line number.
void wmf_detach
(
types_8h.html#a22
wmfAPI
*
API
,
void *
mem
)
Detach memory attached to the API's memory manager's internal list.
Parameters:
API
the API handle
mem
pointer to memory previously allocated via the API
This removes the reference in the API's memory manager's internal list, and the memory will not, therefore, be released by
api_8h.html#a23
wmf_api_destroy()
. To free subsequently, use free().
types_8h.html#a5
wmf_error_t
wmf_display_size
(
types_8h.html#a22
wmfAPI
*
API
,
unsigned int *
width
,
unsigned int *
height
,
double
res_x
,
double
res_y
)
Get estimate of image display size.
Parameters:
API
the API handle
width
width return
height
height return
res_x
x-resolution of display
res_y
y-resolution of display
api_8h.html#a30
wmf_display_size()
returns image width in
*width
and image height in
*height
.
api_8h.html#a29
wmf_size()
is used to get the calculated/estimate width and height of the image, and these values are converted to integer width and height estimates for display.
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error state of
wmf_E_Glitch
(the metafile has not been scanned).
void wmf_error
(
types_8h.html#a22
wmfAPI
*
API
,
char *
file
,
int
line
,
char *
msg
)
Print message to error stream.
Parameters:
API
the API handle
file
file name
line
line number
msg
message to print
This should only be called via the macro
api_8h.html#a0
WMF_ERROR(API,msg)
which calls
api_8h.html#a64
wmf_error()
with the current file name and line number.
types_8h.html#a5
wmf_error_t
wmf_file_close
(
types_8h.html#a22
wmfAPI
*
API
)
Close metafile input file stream.
Parameters:
API
the API handle
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error state of
wmf_E_Glitch
.
types_8h.html#a5
wmf_error_t
wmf_file_open
(
types_8h.html#a22
wmfAPI
*
API
,
const char *
file
)
Open file as metafile.
Parameters:
API
the API handle
file
file name
Simple method for reading from file.
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error states of
wmf_E_Glitch
or
wmf_E_BadFile
.
int wmf_file_read
(
void *
)
file input (wmf_file_open): fgetc()
int wmf_file_seek
(
void *
,
long
)
file input (wmf_file_open): fseek()
long wmf_file_tell
(
void *
)
file input (wmf_file_open): ftell()
void wmf_free
(
types_8h.html#a22
wmfAPI
*
API
,
void *
mem
)
Frees memory attached to the API's memory manager's internal list.
Parameters:
API
the API handle
mem
pointer to memory previously allocated via the API
Syntax is similar to free().
types_8h.html#a5
wmf_error_t
wmf_header_read
(
types_8h.html#a22
wmfAPI
*
API
)
Read the metafile's header.
Parameters:
API
the API handle
(Must read the header first, either via
api_8h.html#a27
wmf_scan()
or by calling
api_8h.html#a26
wmf_header_read()
directly.)
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error states of
wmf_E_Glitch
,
wmf_E_BadFormat
(bad header),
wmf_E_BadFile
(no open input stream) and
wmf_E_EOF
(premature end-of-file).
char* wmf_help
(
void
)
Additional wmf-related options:
--wmf-error[=yes|no]            switch for error reports.
--wmf-debug[=yes|no]            switch for debug reports, if any.
--wmf-ignore-nonfatal[=yes|no]  switch to ignore (some) non-fatal errors.
--wmf-diagnostics               emit diagnostic information.
--wmf-fontdir=<path>            add <path> to list of font directories.
--wmf-sys-fonts                 use system fonts, if any found.
--wmf-sys-fontmap=<file>        use system xml-fontmap file <file>.
--wmf-xtra-fonts                use non-system fonts, if any found.
--wmf-xtra-fontmap=<file>       use non-system xml-fontmap file <file>.
--wmf-gs-fontmap=<file>         use ghostscript file <file>.
--wmf-write=<file>              write metafile to <file>.
Report bugs to <http://www.wvware.com/>.
Returns:
Returns the above as a string.
types_8h.html#a5
wmf_error_t
wmf_lite_create
(
types_8h.html#a22
wmfAPI
**
API_return
,
unsigned long
flags
,
types_8h.html#a21
wmfAPI_Options
*
options
)
Creates and initializes an instance of the
libwmf
library (lite interface) for a specified device layer.
Parameters:
API_return
pointer to a wmfAPI* (the API handle use henceforth)
flags
bitwise OR of WMF_OPT_ options
options
pointer to wmfAPI_Options structure
This is the first and necessary step when using
libwmf
. Options are passed via the wmfAPI_Options structure and
flags
. wmf_api_create allocates the wmfAPI structure and initializes the color tables, the metafile player, and the device layer. If successful then the pointer to the wmfAPI structure is returned via
API_return
, otherwise all allocated memory is released and the library exits with an appropriate error.
wmf_lite_create () ignores command line arguments, if any are given, and does
not
attempt to set up font mapping.
The library should be closed using the corresponding wmf_lite_destroy () function.
Returns:
The error state of the library:
wmf_E_None
indicates successful creation and initialization of the library, and
*API_return
will be non-zero. For any other error value
*API_return
will be zero.
types_8h.html#a5
wmf_error_t
wmf_lite_destroy
(
types_8h.html#a22
wmfAPI
*
API
)
Close the device layer, if open, and release all allocated memory attached to the memory manager.
Parameters:
API
the API handle
Returns:
The final error state of the library.
void* wmf_malloc
(
types_8h.html#a22
wmfAPI
*
API
,
size_t
size
)
Allocate memory of specified size and attach to the API's memory manager's internal list.
Parameters:
API
the API handle
size
size in bytes of memory required
With syntax similar to malloc(),
api_8h.html#a41
wmf_malloc()
allocates
size
bytes of memory and adds a reference to it in the memory manager's list. To free the memory, use
api_8h.html#a44
wmf_free()
.
Returns:
Pointer to new memory, or zero on failure. Sets error state
wmf_E_InsMem
on failure.
types_8h.html#a5
wmf_error_t
wmf_mem_close
(
types_8h.html#a22
wmfAPI
*
API
)
Close metafile input memory stream.
Parameters:
API
the API handle
Returns:
Returns the library error state (
wmf_E_None
on success).
types_8h.html#a5
wmf_error_t
wmf_mem_open
(
types_8h.html#a22
wmfAPI
*
API
,
unsigned char *
mem
,
long
length
)
Open metafile in memory.
Parameters:
API
the API handle
mem
the metafile in memory
length
the length in bytes of metafile data
Simple method for reading from memory as array of unsigned char.
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error state of
wmf_E_Glitch
.
int wmf_mem_read
(
void *
)
memory input (wmf_mem_open): fgetc() equiv.
int wmf_mem_seek
(
void *
,
long
)
memory input (wmf_mem_open): fseek() equiv.
long wmf_mem_tell
(
void *
)
memory input (wmf_mem_open): ftell() equiv.
types_8h.html#a5
wmf_error_t
wmf_play
(
types_8h.html#a22
wmfAPI
*
API
,
unsigned long
flags
,
types_8h.html#a15
wmfD_Rect
*
d_r
)
Play the metafile.
Parameters:
API
the API handle
flags
(unused)
d_r
for bounding-box return
Before the metafile can be played, it must be scanned - see
api_8h.html#a27
wmf_scan()
.
The first time (and only the first time) the metafile is played, it first calls
device_open()
for the device layer specified (and initialized) in
api_8h.html#a22
wmf_api_create()
. Then, and also each subsequent time the metafile is played, it calls
device_begin()
, plays the metafile (with calls to various other device layer functions), and finally it calls
device_end()
.
device_close()
is only ever called via
api_8h.html#a23
wmf_api_destroy()
.
d_r
is recomputed, but should not change.
Returns:
Returns the library error state (
wmf_E_None
on success).
types_8h.html#a5
wmf_error_t
wmf_player_init
(
types_8h.html#a22
wmfAPI
*
)
Initializes the metafile player (called by
api_8h.html#a22
wmf_api_create()
)
void wmf_printf
(
types_8h.html#a22
wmfAPI
*
API
,
char *
msg
,
...
)
Print formatted message to debug stream.
Parameters:
API
the API handle
msg
message to print
With syntax similar to printf(),
api_8h.html#a66
wmf_printf()
prints formatted output to the debug stream.
U16 wmf_read_16
(
types_8h.html#a22
wmfAPI
*
)
Reads a two-byte sequence from the current metafile, returns U16
U32 wmf_read_32
(
types_8h.html#a22
wmfAPI
*
,
U16 *
,
U16 *
)
Reads a four-byte sequence from the current metafile, returns U32
void* wmf_realloc
(
types_8h.html#a22
wmfAPI
*
API
,
void *
mem
,
size_t
size
)
(Re)Allocate memory of specified size and attach to the API's memory manager's internal list.
Parameters:
API
the API handle
mem
pointer to memory previously allocated via the API
size
new size in bytes of memory required
With syntax similar to realloc(),
api_8h.html#a43
wmf_realloc()
allocates
size
bytes of memory and adds a reference to it in the memory manager's list. To free the memory, use
api_8h.html#a44
wmf_free()
. If
mem
is zero, this is equivalent to a call to
api_8h.html#a41
wmf_malloc()
. If
size
is zero, the memory is released via
api_8h.html#a44
wmf_free()
.
Returns:
Pointer to new memory, or zero on failure. Sets error state
wmf_E_InsMem
on failure.
types_8h.html#a5
wmf_error_t
wmf_scan
(
types_8h.html#a22
wmfAPI
*
API
,
unsigned long
flags
,
types_8h.html#a15
wmfD_Rect
*
d_r
)
Scan the metafile.
Parameters:
API
the API handle
flags
(unused)
d_r
for bounding-box return
Before the metafile can be played, it must be scanned. This is because metafile headers do not always provide image size information. Although the device layer (the graphics exporter) is initialized in
api_8h.html#a22
wmf_api_create()
, the output device is not opened until after the metafile is scanned. By scanning, therefore, the device layer can be provided on opening not only with size information but also a list of colors to expect (not including those in raster images) and of other required resources, if necessary. Finally, if scanning fails, then there's certainly no point in playing the metafile.
The bounding box, in device coordinates, is returned in
*d_r
.
Returns:
Returns the library error state (
wmf_E_None
on success).
void wmf_set_viewport_origin
(
types_8h.html#a22
wmfAPI
*
API
,
types_8h.html#a14
wmfD_Coord
d_pt
)
Set the device origin coordinate.
Parameters:
API
the API handle
d_pt
origin in device coordinates
Not really recommended.
types_8h.html#a5
wmf_error_t
wmf_size
(
types_8h.html#a22
wmfAPI
*
API
,
float *
width
,
float *
height
)
Get image size.
Parameters:
API
the API handle
width
width return
height
height return
api_8h.html#a29
wmf_size()
returns image width in
*width
and image height in
*height
. If supplied, the metafile header values are used, otherwise the width and height found by
api_8h.html#a27
wmf_scan()
are used.
Returns:
Returns the library error state (
wmf_E_None
on success). Possible library error state of
wmf_E_Glitch
(the metafile has not been scanned).
void wmf_status_function
(
types_8h.html#a22
wmfAPI
*
API
,
void *
context
,
types_8h.html#a13
wmfStatus
function
)
Set a status call-back function.
Parameters:
API
the API handle
context
handle for user data
function
call-back function
The metafile player calls the status function after each record.
char* wmf_str_append
(
types_8h.html#a22
wmfAPI
*
API
,
char *
pre
,
char *
post
)
Create concatenatation of two strings and attach to the API's memory manager's internal list.
Parameters:
API
the API handle
pre
a string
post
a string
api_8h.html#a47
wmf_str_append()
allocates the necessary memory via
api_8h.html#a41
wmf_malloc()
, copies
pre
into the string and appends
post
. Use
api_8h.html#a44
wmf_free()
to free the string.
Returns:
Pointer to new string, or zero on failure. Sets error state
wmf_E_InsMem
on failure, or
wmf_E_Glitch
if str is zero.
unsigned long wmf_strbuf_grow
(
types_8h.html#a22
wmfAPI
*
API
)
Increase the size of the internal string buffer.
Parameters:
API
the API handle
libwmf
maintains an internal buffer for string operations.
api_8h.html#a49
wmf_strbuf_grow()
increases the size by 64.
Returns:
Returns the new size of the buffer. Uses
api_8h.html#a43
wmf_realloc()
, so may set
wmf_E_InsMem
on failure.
char* wmf_strdup
(
types_8h.html#a22
wmfAPI
*
API
,
const char *
str
)
Duplicate string and attach to the API's memory manager's internal list.
Parameters:
API
the API handle
str
a string
With syntax similar to strdup(),
api_8h.html#a46
wmf_strdup()
allocates the necessary memory via
api_8h.html#a41
wmf_malloc()
and copies the string. Use
api_8h.html#a44
wmf_free()
to free the string.
Returns:
Pointer to new string, or zero on failure. Sets error state
wmf_E_InsMem
on failure, or
wmf_E_Glitch
if str is zero.
types_8h.html#a23
wmfStream
* wmf_stream_create
(
types_8h.html#a22
wmfAPI
*
API
,
FILE *
out
)
Open an uncompressed character output stream.
Parameters:
API
the API handle
out
descriptor for a file stream; or zero to write to memory
api_8h.html#a37
wmf_stream_create()
creates a
types_8h.html#a23
wmfStream
(a character-based output stream) for output to a file or, if
out
is zero, to memory.
Returns:
Returns a
types_8h.html#a23
wmfStream
pointer, or zero on failure. Possible library error states of
wmf_E_InsMem
or
wmf_E_BadFile
.
void wmf_stream_destroy
(
types_8h.html#a22
wmfAPI
*
API
,
types_8h.html#a23
wmfStream
*
stream
,
char **
buffer
,
unsigned long *
length
)
Close an uncompressed character output stream.
Parameters:
API
the API handle
stream
stream handle
buffer
for memory return
length
for length return
In the case of write-to-memory, on return
*buffer
is an array of length
length
.
int wmf_stream_printf
(
types_8h.html#a22
wmfAPI
*
API
,
types_8h.html#a23
wmfStream
*
stream
,
char *
format
,
...
)
Formatted print to character output stream.
Parameters:
API
the API handle
stream
stream handle
format
print format
With syntax similar to printf(),
api_8h.html#a40
wmf_stream_printf()
prints a formatted message to a
types_8h.html#a23
wmfStream
character stream.
Returns:
Returns the number of characters written, or zero on failure. Possible library error state of
wmf_E_InsMem
.
int wmf_stream_reset
(
void *
)
uncompressed char output (wmf_stream_create): rewind()
int wmf_stream_rezet
(
void *
)
compressed char output (wmf_ztream_create): rewind()
int wmf_stream_sputs
(
char *
,
void *
)
uncompressed char output (wmf_stream_create): fputs()
int wmf_stream_zputs
(
char *
,
void *
)
compressed char output (wmf_ztream_create): fputs()
char* wmf_strstr
(
const char *
haystack
,
const char *
needle
)
Substring search.
Parameters:
haystack
a string
needle
a substring to search for in haystack
With syntax identical to strstr(),
api_8h.html#a48
wmf_strstr()
searches for string
needle
in string
haystack
.
Returns:
Pointer to substring
needle
found in
haystack
, or zero if not found.
types_8h.html#a5
wmf_error_t
wmf_wmfxml_import
(
types_8h.html#a22
wmfAPI
*
,
const char *
)
Load wmfxml file and
api_8h.html#a34
wmf_mem_open()
it
void wmf_write
(
types_8h.html#a22
wmfAPI
*
,
unsigned
long
,
unsigned
int
,
const char *
,
char **
,
const unsigned char *
,
unsigned
long
)
Writes to --wmf-write file (which may be WMF or home-made wmfxml)
void wmf_write_begin
(
types_8h.html#a22
wmfAPI
*
,
const char *
)
Open --wmf-write file (which may be WMF or home-made wmfxml)
void wmf_write_end
(
types_8h.html#a22
wmfAPI
*
)
Close --wmf-write file (which may be WMF or home-made wmfxml)
types_8h.html#a23
wmfStream
* wmf_ztream_create
(
types_8h.html#a22
wmfAPI
*
API
,
gzFile
out
)
Open a compressed character output stream.
Parameters:
API
the API handle
out
descriptor for a zlib compressed file stream
api_8h.html#a36
wmf_ztream_create()
creates a
types_8h.html#a23
wmfStream
(a character-based output stream) for output to a file opened via
zlib
. (Writing compressed data to memory is not currently supported.)
Returns:
Returns a
types_8h.html#a23
wmfStream
pointer, or zero on failure. Possible library error state of
wmf_E_InsMem
.
void wmf_ztream_destroy
(
types_8h.html#a22
wmfAPI
*
API
,
types_8h.html#a23
wmfStream
*
stream
,
char **
buffer
,
unsigned long *
length
)
Close a compressed character output stream.
Parameters:
API
the API handle
stream
stream handle
buffer
(unused)
length
(unused)
Generated on Tue Dec 10 19:53:47 2002 for libwmf by
http://www.doxygen.org/index.html
doxygen
1.2.18
