uemf.c revision 7f593bcf620bfab8a173db37447c2ccfd0c17a49
/**
@file uemf.c Functions for manipulating EMF files and structures.
[U_EMR*]_set all take data and return a pointer to memory holding the constructed record.
The size of that record is also returned in recsize.
It is also in the second int32 in the record, but may have been byte swapped and so not usable.
If something goes wrong a NULL pointer is returned and recsize is set to 0.
Compile with "U_VALGRIND" defined defined to enable code which lets valgrind check each record for
uninitialized data.
Compile with "SOL8" defined for Solaris 8 or 9 (Sparc).
*/
/*
File: uemf.c
Version: 0.0.21
Date: 20-FEB-2013
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
Copyright: 2013 David Mathog and California Institute of Technology (Caltech)
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iconv.h>
#include <wchar.h>
#include <errno.h>
#include <string.h>
#include <limits.h> // for INT_MAX, INT_MIN
#include <math.h> // for U_ROUND()
#include <stddef.h> /* for offsetof() macro */
#if 0
#include <windef.h> //Not actually used, looking for collisions
#include <winnt.h> //Not actually used, looking for collisions
#include <wingdi.h> //Not actually used, looking for collisions
#endif
#include "uemf.h"
/* one prototype from uemf_endian. Put it here because end user should never need to see it, sno
not in uemf.h or uemf_endian.h */
/**
\brief Look up the name of the EMR record by type. Returns U_EMR_INVALID if out of range.
\return name of the EMR record, "U_EMR_INVALID" if out of range.
\param idx EMR record type.
*/
char *U_emr_names(unsigned int idx){
"U_EMR_INVALID",
"U_EMR_HEADER",
"U_EMR_POLYBEZIER",
"U_EMR_POLYGON",
"U_EMR_POLYLINE",
"U_EMR_POLYBEZIERTO",
"U_EMR_POLYLINETO",
"U_EMR_POLYPOLYLINE",
"U_EMR_POLYPOLYGON",
"U_EMR_SETWINDOWEXTEX",
"U_EMR_SETWINDOWORGEX",
"U_EMR_SETVIEWPORTEXTEX",
"U_EMR_SETVIEWPORTORGEX",
"U_EMR_SETBRUSHORGEX",
"U_EMR_EOF",
"U_EMR_SETPIXELV",
"U_EMR_SETMAPPERFLAGS",
"U_EMR_SETMAPMODE",
"U_EMR_SETBKMODE",
"U_EMR_SETPOLYFILLMODE",
"U_EMR_SETROP2",
"U_EMR_SETSTRETCHBLTMODE",
"U_EMR_SETTEXTALIGN",
"U_EMR_SETCOLORADJUSTMENT",
"U_EMR_SETTEXTCOLOR",
"U_EMR_SETBKCOLOR",
"U_EMR_OFFSETCLIPRGN",
"U_EMR_MOVETOEX",
"U_EMR_SETMETARGN",
"U_EMR_EXCLUDECLIPRECT",
"U_EMR_INTERSECTCLIPRECT",
"U_EMR_SCALEVIEWPORTEXTEX",
"U_EMR_SCALEWINDOWEXTEX",
"U_EMR_SAVEDC",
"U_EMR_RESTOREDC",
"U_EMR_SETWORLDTRANSFORM",
"U_EMR_MODIFYWORLDTRANSFORM",
"U_EMR_SELECTOBJECT",
"U_EMR_CREATEPEN",
"U_EMR_CREATEBRUSHINDIRECT",
"U_EMR_DELETEOBJECT",
"U_EMR_ANGLEARC",
"U_EMR_ELLIPSE",
"U_EMR_RECTANGLE",
"U_EMR_ROUNDRECT",
"U_EMR_ARC",
"U_EMR_CHORD",
"U_EMR_PIE",
"U_EMR_SELECTPALETTE",
"U_EMR_CREATEPALETTE",
"U_EMR_SETPALETTEENTRIES",
"U_EMR_RESIZEPALETTE",
"U_EMR_REALIZEPALETTE",
"U_EMR_EXTFLOODFILL",
"U_EMR_LINETO",
"U_EMR_ARCTO",
"U_EMR_POLYDRAW",
"U_EMR_SETARCDIRECTION",
"U_EMR_SETMITERLIMIT",
"U_EMR_BEGINPATH",
"U_EMR_ENDPATH",
"U_EMR_CLOSEFIGURE",
"U_EMR_FILLPATH",
"U_EMR_STROKEANDFILLPATH",
"U_EMR_STROKEPATH",
"U_EMR_FLATTENPATH",
"U_EMR_WIDENPATH",
"U_EMR_SELECTCLIPPATH",
"U_EMR_ABORTPATH",
"U_EMR_UNDEF69",
"U_EMR_COMMENT",
"U_EMR_FILLRGN",
"U_EMR_FRAMERGN",
"U_EMR_INVERTRGN",
"U_EMR_PAINTRGN",
"U_EMR_EXTSELECTCLIPRGN",
"U_EMR_BITBLT",
"U_EMR_STRETCHBLT",
"U_EMR_MASKBLT",
"U_EMR_PLGBLT",
"U_EMR_SETDIBITSTODEVICE",
"U_EMR_STRETCHDIBITS",
"U_EMR_EXTCREATEFONTINDIRECTW",
"U_EMR_EXTTEXTOUTA",
"U_EMR_EXTTEXTOUTW",
"U_EMR_POLYBEZIER16",
"U_EMR_POLYGON16",
"U_EMR_POLYLINE16",
"U_EMR_POLYBEZIERTO16",
"U_EMR_POLYLINETO16",
"U_EMR_POLYPOLYLINE16",
"U_EMR_POLYPOLYGON16",
"U_EMR_POLYDRAW16",
"U_EMR_CREATEMONOBRUSH",
"U_EMR_CREATEDIBPATTERNBRUSHPT",
"U_EMR_EXTCREATEPEN",
"U_EMR_POLYTEXTOUTA",
"U_EMR_POLYTEXTOUTW",
"U_EMR_SETICMMODE",
"U_EMR_CREATECOLORSPACE",
"U_EMR_SETCOLORSPACE",
"U_EMR_DELETECOLORSPACE",
"U_EMR_GLSRECORD",
"U_EMR_GLSBOUNDEDRECORD",
"U_EMR_PIXELFORMAT",
"U_EMR_DRAWESCAPE",
"U_EMR_EXTESCAPE",
"U_EMR_UNDEF107",
"U_EMR_SMALLTEXTOUT",
"U_EMR_FORCEUFIMAPPING",
"U_EMR_NAMEDESCAPE",
"U_EMR_COLORCORRECTPALETTE",
"U_EMR_SETICMPROFILEA",
"U_EMR_SETICMPROFILEW",
"U_EMR_ALPHABLEND",
"U_EMR_SETLAYOUT",
"U_EMR_TRANSPARENTBLT",
"U_EMR_UNDEF117",
"U_EMR_GRADIENTFILL",
"U_EMR_SETLINKEDUFIS",
"U_EMR_SETTEXTJUSTIFICATION",
"U_EMR_COLORMATCHTOTARGETW",
"U_EMR_CREATECOLORSPACEW"
};
return(U_WMR_NAMES[idx]);
}
/* **********************************************************************************************
These definitions are for code pieces that are used many times in the following implementation. These
definitions are not needed in end user code, so they are here rather than in uemf.h.
*********************************************************************************************** */
//! @cond
// this one may also be used A=Msk,B=MskBmi and F=cbMsk
#define SET_CB_FROM_PXBMI(A,B,C,D,E,F) /* A=Px, B=Bmi, C=cbImage, D=cbImage4, E=cbBmi, F=cbPx */ \
if(A){\
if(!B)return(NULL); /* size is derived from U_BIMAPINFO, but NOT from its size field, go figure*/ \
C = F;\
D = UP4(C); /* pixel array might not be a multiples of 4 bytes*/ \
E = sizeof(U_BITMAPINFOHEADER) + 4 * get_real_color_count((const char *) &(B->bmiHeader)); /* bmiheader + colortable*/ \
}\
else { C = 0; D = 0; E=0; }
// variable "off" must be declared in the function
#define APPEND_PXBMISRC(A,B,C,D,E,F,G) /* A=record, B=U_EMR,C=cbBmi, D=Bmi, E=Px, F=cbImage, G=cbImage4 */ \
if(C){\
((B *) A)->cbBmiSrc = C;\
off += C;\
((B *) A)->offBitsSrc = off;\
((B *) A)->cbBitsSrc = F;\
if(G - F){ \
off += F;\
}\
}\
else {\
((B *) A)->offBmiSrc = 0;\
((B *) A)->cbBmiSrc = 0;\
((B *) A)->offBitsSrc = 0;\
((B *) A)->cbBitsSrc = 0;\
}
// variable "off" must be declared in the function
#define APPEND_MSKBMISRC(A,B,C,D,E,F,G) /* A=record, B=U_EMR*,C=cbMskBmi, D=MskBmi, E=Msk, F=cbMskImage, G=cbMskImage4 */ \
if(C){\
((B *) A)->offBmiMask = off;\
((B *) A)->cbBmiMask = C;\
off += C;\
((B *) A)->offBitsMask = off;\
((B *) A)->cbBitsMask = F;\
}\
else {\
((B *) A)->offBmiMask = 0;\
((B *) A)->cbBmiMask = 0;\
((B *) A)->offBitsMask = 0;\
((B *) A)->cbBitsMask = 0;\
}
//! @endcond
/* **********************************************************************************************
These functions are used for development and debugging and should be be includied in production code.
*********************************************************************************************** */
/**
\brief Debugging utility, used with valgrind to find uninitialized values. Not for use in production code.
\param buf memory area to examine !
\param size length in bytes of buf!
*/
int memprobe(
const void *buf,
){
int sum=0;
for(;size;size--,ptr++){ sum += *ptr; } // read all bytes, trigger valgrind warning if any uninitialized
return(sum);
}
/**
\brief Dump an EMFHANDLES structure. Not for use in production code.
\param string Text to output before dumping eht structure
\param handle Handle
\param eht EMFHANDLES structure to dump
*/
void dumpeht(
char *string,
unsigned int *handle,
){
uint32_t i;
if(handle){
}
for(i=0;i<=5;i++){
}
for(i=1;i<=5;i++){
}
}
/* **********************************************************************************************
These functions are used for Image conversions and other
utility operations. Character type conversions are in uemf_utf.c
*********************************************************************************************** */
/**
\brief Make up an approximate dx array to pass to emrtext_set(), based on character height and weight.
Take abs. value of character height, get width by multiplying by 0.6, and correct weight
approximately, with formula (measured on screen for one text line of Arial).
Caller is responsible for free() on the returned pointer.
\return pointer to dx array
\param height character height (absolute value will be used)
\param weight LF_Weight Enumeration (character weight)
\param members Number of entries to put into dx
*/
){
if(dx){
width = (uint32_t) U_ROUND(((float) (height > 0 ? height : -height)) * 0.6 * (0.00024*(float) weight + 0.904));
}
return(dx);
}
/**
\brief Look up the properties (a bit map) of a type of EMR record.
Bits that may be set are defined in "Draw Properties" in uemf.h, they are U_DRAW_NOTEMPTY, etc..
\return bitmap of EMR record properties, or U_EMR_INVALID on error or release of all memory
\param type EMR record type. If U_EMR_INVALID release memory. (There is no U_EMR_INVALID EMR record type)
*/
uint32_t result = U_EMR_INVALID; // initialized to indicate an error (on a lookup) or nothing (on a memory release)
if(type == U_EMR_INVALID){
}
if(!table){
// 0x80 0x40 0x20 0x10 0x08 0x04 0x02 0x01
// Path properties (U_DRAW_*) TEXT ALTERS ONLYTO VISIBLE
// PATH FORCE CLOSED NOTEMPTY
table[ 93] = 0x80; // U_EMRCREATEMONOBRUSH 1 0 0 0 0 0 0 0 Not selected yet, so no change in drawing conditions
}
}
return(result);
}
/**
\brief Derive from bounding rect, start and end radials, for arc, chord, or pie, the center, start, and end points, and the bounding rectangle.
\return 0 on success, other values on errors.
\param rclBox bounding rectangle
\param ArcStart start of arc
\param ArcEnd end of arc
\param f1 1 if rotation angle >= 180, else 0
\param f2 Rotation direction, 1 if counter clockwise, else 0
\param center Center coordinates
\param start Start coordinates (point on the ellipse defined by rect)
\param end End coordinates (point on the ellipse defined by rect)
\param size W,H of the x,y axes of the bounding rectangle.
*/
int *f1,
int f2,
){
vec_estart.y /= scale;
// Find the intersection of the vectors with the ellipse. With no loss of generality
// we can translate the ellipse to the origin, then we just need to find tu (t a factor, u the unit vector)
// that also satisfies (x/Rx)^2 + (y/Ry)^2 = 1. x is t*(ux), y is t*(uy), where ux,uy are the x,y components
// of the unit vector. Substituting gives:
// (t*(ux)/Rx)^2 + (t*(uy)/Ry)^2 = 1
//lastly figure out if the swept angle is >180 degrees or not, based on the direction of rotation
//and the two unit vectors.
if(!f2){ // counter clockwise rotation
else { *f1 = 0; }
}
else {
else { *f1 = 1; }
}
return(0);
}
/**
\brief Derive from an EMF arc, chord, or pie the center, start, and end points, and the bounding rectangle.
\return 0 on success, other values on errors.
\param record U_EMRPIE, U_EMRCHORD, or _EMRARC record
\param f1 1 if rotation angle >= 180, else 0
\param f2 Rotation direction, 1 if counter clockwise, else 0
\param center Center coordinates
\param start Start coordinates (point on the ellipse defined by rect)
\param end End coordinates (point on the ellipse defined by rect)
\param size W,H of the x,y axes of the bounding rectangle.
*/
int emr_arc_points(
int *f1,
int f2,
){
return emr_arc_points_common(&(pEmr->rclBox), &(pEmr->ptlStart), &(pEmr->ptlEnd), f1, f2, center, start, end, size );
}
/**
\brief Convert a U_RGBA 32 bit pixmap to one of many different types of DIB pixmaps.
Conversions to formats using color tables assume that the color table can hold every color
in the input image. If that assumption is false then the conversion will fail. Conversion
from 8 bit color to N bit colors (N<8) do so by shifting the appropriate number of bits.
\return 0 on success, other values on errors.
\param px DIB pixel array
\param cbPx DIB pixel array size in bytes
\param ct DIB color table
\param numCt DIB color table number of entries
\param rgba_px U_RGBA pixel array (32 bits)
\param w Width of pixel array
\param h Height of pixel array
\param stride Row stride of input pixel array in bytes
\param colortype DIB BitCount Enumeration
\param use_ct If true use color table (only for 1-16 bit DIBs)
\param invert If DIB rows are in opposite order from RGBA rows
*/
int RGBA_to_DIB(
char **px,
PU_RGBQUAD *ct,
int *numCt,
const char *rgba_px,
int w,
int h,
int stride,
int use_ct,
int invert
){
int bs;
int pad;
int i,j,k;
char *pxptr;
const char *rptr;
int found;
int usedbytes;
*numCt=0;
*cbPx=0;
// sanity checking
if(bs<1){
bs=1;
}
else {
}
pad = UP4(usedbytes) - usedbytes; // DIB rows must be aligned on 4 byte boundaries, they are padded at the end to accomplish this.;
if(!px)return(4);
if(use_ct){
if(!lct)return(5);
}
if(invert){
istart = h-1;
iend = -1;
iinc = -1;
}
else {
istart = 0;
iend = h;
iinc = 1;
}
found = 0;
tmp8 = 0;
for(j=0; j<w; j++){
r = *rptr++;
g = *rptr++;
b = *rptr++;
a = *rptr++;
if(use_ct){
index = -1;
for(lct = *ct, k=0; k<found; k++,lct++){ // Is this color in the table (VERY inefficient if there are a lot of colors!!!)
index =k;
break;
}
found++;
*numCt=0;
*cbPx=0;
return(6);
}
}
switch(colortype){
case U_BCBM_MONOCHROME: // 2 colors. bmiColors array has two entries
if(!((j+1) % 8)){
tmp8 = 0;
}
break;
case U_BCBM_COLOR4: // 2^4 colors. bmiColors array has 16 entries
if(!((j+1) % 2)){
tmp8 = 0;
}
break;
case U_BCBM_COLOR8: // 2^8 colors. bmiColors array has 256 entries
break;
case U_BCBM_COLOR16: // 2^16 colors. (Several different color methods))
case U_BCBM_COLOR24: // 2^24 colors. bmiColors is not used. Pixels are U_RGBTRIPLE.
case U_BCBM_COLOR32: // 2^32 colors. bmiColors is not used. Pixels are U_RGBQUAD.
case U_BCBM_EXPLICIT: // Derinved from JPG or PNG compressed image or ?
default:
return(7); // This should not be possible, but might happen with memory corruption
}
}
else {
switch(colortype){
case U_BCBM_COLOR16: // 2^16 colors. (Several different color methods))
b /= 8; g /= 8; r /= 8;
// Do it in this way so that the bytes are always stored Little Endian
tmp8 = b;
tmp8 |= r<<2;
break;
case U_BCBM_COLOR24: // 2^24 colors. bmiColors is not used. Pixels are U_RGBTRIPLE.
*pxptr++ = b;
*pxptr++ = g;
*pxptr++ = r;
break;
case U_BCBM_COLOR32: // 2^32 colors. bmiColors is not used. Pixels are U_RGBQUAD.
*pxptr++ = b;
*pxptr++ = g;
*pxptr++ = r;
*pxptr++ = a;
break;
case U_BCBM_MONOCHROME: // 2 colors. bmiColors array has two entries
case U_BCBM_COLOR4: // 2^4 colors. bmiColors array has 16 entries
case U_BCBM_COLOR8: // 2^8 colors. bmiColors array has 256 entries
case U_BCBM_EXPLICIT: // Derinved from JPG or PNG compressed image or ?
default:
return(7); // This should not be possible, but might happen with memory corruption
}
}
}
tmp8 = 0;
}
tmp8 = 0;
}
if(pad){
memset(pxptr,0,pad); // not strictly necessary, but set all bytes so that we can find important unset ones with valgrind
}
}
return(0);
}
/**
\brief Get the actual number of colors in the color table from the BitMapInfoHeader.
BitmapInfoHeader may list 0 for some types which implies the maximum value.
If the image is big enough, that is set by the bit count, as in 256 for an 8
bit image.
If the image is smaller it is set by width * height.
Note, this may be called by WMF code, so it is not safe to assume the data is aligned.
\return Number of entries in the color table.
\param Bmih char * pointer to the U_BITMAPINFOHEADER
*/
int get_real_color_count(
const char *Bmih
){
}
/**
\brief Get the actual number of colors in the color table from the ClrUsed, BitCount, Width, and Height.
BitmapInfoHeader may list 0 for some types which implies the maximum value.
If the image is big enough, that is set by the bit count, as in 256 for an 8
bit image.
If the image is smaller it is set by width * height.
\return Number of entries in the color table.
\param PU_BITMAPINFOHEADER pointer to to the U_BITMAPINFOHEADER
*/
int Colors,
int BitCount,
int Width,
int Height
){
if(Colors == 0){
}
return(Colors);
}
/**
\brief Get the DIB parameters from the BMI of the record for use by DBI_to_RGBA()
\return BI_Compression Enumeration. For anything other than U_BI_RGB values other than px may not be valid.
\param pEmr pointer to EMR record that has a U_BITMAPINFO and bitmap
\param offBitsSrc Offset to the bitmap
\param offBmiSrc Offset to the U_BITMAPINFO
\param px pointer to DIB pixel array in pEmr
\param ct pointer to DIB color table in pEmr
\param numCt DIB color table number of entries, for PNG or JPG returns the number of bytes in the image
\param width Width of pixel array
\param height Height of pixel array (always returned as a positive number)
\param colortype DIB BitCount Enumeration
\param invert If DIB rows are in opposite order from RGBA rows
*/
int get_DIB_params(
void *pEmr,
const char **px,
){
/* if biCompression is not U_BI_RGB some or all of the following might not hold real values */
*invert = 1;
}
else {
*invert = 0;
}
}
else {
}
return(bic);
}
/**
\brief Convert one of many different types of DIB pixmaps to an RGBA 32 bit pixmap.
\return 0 on success, other values on errors.
\param px DIB pixel array
\param ct DIB color table
\param numCt DIB color table number of entries
\param rgba_px U_RGBA pixel array (32 bits), created by this routine, caller must free.
\param w Width of pixel array in the record
\param h Height of pixel array in the record
\param colortype DIB BitCount Enumeration
\param use_ct Kept for symmetry with RGBA_to_DIB, should be set to numCt
\param invert If DIB rows are in opposite order from RGBA rows
*/
int DIB_to_RGBA(
const char *px,
int numCt,
char **rgba_px,
int w,
int h,
int use_ct,
int invert
){
int stride;
int bs;
int pad;
int i,j;
const char *pxptr;
char *rptr;
int usedbytes;
// sanity checking
stride = w * 4;
if(bs<1){
bs=1;
}
else {
}
pad = UP4(usedbytes) - usedbytes; // DIB rows must be aligned on 4 byte boundaries, they are padded at the end to accomplish this.;
if(!rgba_px)return(4);
if(invert){
istart = h-1;
iend = -1;
iinc = -1;
}
else {
istart = 0;
iend = h;
iinc = 1;
}
tmp8 = 0; // silences a compiler warning, tmp8 always sets when j=0, so never used uninitialized
for(j=0; j<w; j++){
if(use_ct){
switch(colortype){
case U_BCBM_MONOCHROME: // 2 colors. bmiColors array has two entries
break;
case U_BCBM_COLOR4: // 2^4 colors. bmiColors array has 16 entries
break;
case U_BCBM_COLOR8: // 2^8 colors. bmiColors array has 256 entries
break;
case U_BCBM_COLOR16: // 2^16 colors. (Several different color methods))
case U_BCBM_COLOR24: // 2^24 colors. bmiColors is not used. Pixels are U_RGBTRIPLE.
case U_BCBM_COLOR32: // 2^32 colors. bmiColors is not used. Pixels are U_RGBQUAD.
case U_BCBM_EXPLICIT: // Derinved from JPG or PNG compressed image or ?
default:
return(7); // This should not be possible, but might happen with memory corruption
}
b = U_BGRAGetB(color);
g = U_BGRAGetG(color);
r = U_BGRAGetR(color);
a = U_BGRAGetA(color);
}
else {
switch(colortype){
case U_BCBM_COLOR16: // 2^16 colors. (Several different color methods))
// Do it in this way because the bytes are always stored Little Endian
g = g << 3; // restore intensity (have lost 3 bits of accuracy)
a = 0;
break;
case U_BCBM_COLOR24: // 2^24 colors. bmiColors is not used. Pixels are U_RGBTRIPLE.
b = *pxptr++;
g = *pxptr++;
r = *pxptr++;
a = 0;
break;
case U_BCBM_COLOR32: // 2^32 colors. bmiColors is not used. Pixels are U_RGBQUAD.
b = *pxptr++;
g = *pxptr++;
r = *pxptr++;
a = *pxptr++;
break;
case U_BCBM_MONOCHROME: // 2 colors. bmiColors array has two entries
case U_BCBM_COLOR4: // 2^4 colors. bmiColors array has 16 entries
case U_BCBM_COLOR8: // 2^8 colors. bmiColors array has 256 entries
case U_BCBM_EXPLICIT: // Derinved from JPG or PNG compressed image or ?
default:
return(7); // This should not be possible, but might happen with memory corruption
}
}
*rptr++ = r;
*rptr++ = g;
*rptr++ = b;
*rptr++ = a;
}
}
return(0);
}
/**
\brief Extract a subset of an RGBA bitmap array.
Frees the incoming bitmap array IF a subset is extracted, otherwise it is left alone.
If the entire array is extracted it just returns the incoming pointer.
If the subset requested is partially outside of the bitmap the region is clipped to the
bitmap boundaries and extracted. This seems to be a (very) grey area in EMF files, and
even different Microsoft applications do not always do the same thing. For instance,
XP Preview gives some different images for EMR_BITBLT records than does the "import image"
(but not unpacked) view in PowerPoint. Since all of these states are probably best viewed
as undefined or errors we can only try to do something reasonable and not blow up when
encountering one.
\return Pointer to the sub array on success, NULL otherwise.
\param rgba_px U_RGBA pixel array (32 bits), created by this routine, caller must free.
\param w Width of pixel array in the record
\param h Height of pixel array in the record
\param sl start left position in the pixel array in the record to start extracting
\param st start top position in the pixel array in the record to start extracting
\param eew Width of pixel array to extract
\param eeh Height of pixel array to extract
*/
char *RGBA_to_RGBA(
char *rgba_px,
int w,
int h,
int sl,
int st,
int *eew,
int *eeh
){
int i;
char *sub;
char *sptr;
// sanity checking
if(sl<0){
sl = 0;
}
if(st<0){
st = 0;
}
}
else {
}
}
return(sub);
}
/* **********************************************************************************************
These functions are for setting up, appending to, and then tearing down an EMF structure, including
writing the final data structure out to a file.
*********************************************************************************************** */
/**
\brief Duplicate an EMR record.
\param emr record to duplicate
*/
char *emr_dup(
const char *emr
){
char *dup;
int irecsize;
return(dup);
}
/**
\brief Start constructing an emf in memory. Supply the file name and initial size.
\return 0 for success, >=0 for failure.
\param name EMF filename (will be opened)
\param initsize Initialize EMF in memory to hold this many bytes
\param chunksize When needed increase EMF in memory by this number of bytes
\param et EMF in memory
*/
int emf_start(
const char *name,
){
if(!name)return(3);
if(!etl)return(4);
return(5);
}
if(!fp){
return(6);
}
etl->PalEntries = 0;
return(0);
}
/**
\brief Finalize the emf in memory and write it to the file.
\return 0 on success, >=1 on failure
\param et EMF in memory
\param eht EMF handle table (peak handle number needed)
*/
int emf_finish(
){
if(!et->fp)return(1); // This could happen if something stomps on memory, otherwise should be caught in emf_start
// Set the header fields which were unknown up until this point
#if U_BYTE_SWAP
//This is a Big Endian machine, EMF data must be Little Endian
#endif
return(0);
}
/**
\brief Release memory for an emf structure in memory. Call this after emf_finish().
\return 0 on success, >=1 on failure
\param et EMF in memory
*/
int emf_free(
){
if(!et)return(1);
if(!etl)return(2);
return(0);
}
/**
\brief wrapper for fopen, works on any platform
\return 0 on success, >=1 on failure
\param filename file to open (either ASCII or UTF-8)
\param mode U_READ or U_WRITE (these map to "rb" and "wb")
*/
const char *filename,
const int mode
){
#ifdef WIN32
#else
#endif
return(fp);
}
/**
\brief Retrieve contents of an EMF file by name.
\return 0 on success, >=1 on failure
\param filename Name of file to open, including the path
\param contents Contents of the file. Buffer must be free()'d by caller.
\param length Number of bytes in Contents
*/
int emf_readdata(
const char *filename,
char **contents,
){
int status=0;
else {
// read the entire file into memory
if(!*contents){
status = 2;
}
else {
if(inbytes != 1){
status = 3;
}
else {
#if U_BYTE_SWAP
//This is a Big Endian machine, EMF data is Little Endian
#endif
}
}
}
return(status);
}
/**
\brief Append an EMF record to an emf in memory. This may reallocate buf memory.
\return 0 for success, >=1 for failure.
\param rec Record to append to EMF in memory
\param et EMF in memory
\param freerec If true, free rec after append
*/
int emf_append(
int freerec
){
#ifdef U_VALGRIND
printf("\nbefore \n");
printf("after \n");
#endif
if(!rec)return(1);
if(!et)return(2);
}
return(0);
}
/**
\brief Create a handle table. Entries filled with 0 are empty, entries >0 hold a handle.
\return 0 for success, >=1 for failure.
\param initsize Initialize with space for this number of handles
\param chunksize When needed increase space by this number of handles
\param eht EMF handle table
*/
int emf_htable_create(
){
unsigned int i;
if(!ehtl)return(3);
return(4);
}
return(5);
}
return(0);
}
/**
\brief Delete an entry from the handle table. Move it back onto the stack. The specified slot is filled with a 0.
\return 0 for success, >=1 for failure.
\param ih handle
\param eht EMF handle table
*/
int emf_htable_delete(
){
if(!eht)return(1);
}
*ih=0; // invalidate handle variable, so a second delete will of it is not possible
return(0);
}
/**
\brief Returns the index of the first free slot.
Call realloc() if needed. The slot is set to handle (indicates occupied) and the peak value is adjusted.
\return 0 for success, >=1 for failure.
\param ih handle
\param eht EMF handle table
*/
int emf_htable_insert(
){
unsigned int i;
if(!eht)return(1);
if(!ih)return(4);
memset(&eht->table[eht->allocated] , 0, eht->chunk * sizeof(uint32_t)); // zero all NEW slots in the table
}
return(0);
}
/**
\brief Free all memory in an htable. Sets the pointer to NULL.
\return 0 for success, >=1 for failure.
\param eht EMF handle table
*/
int emf_htable_free(
){
if(!eht)return(1);
if(!ehtl)return(2);
return(0);
}
/* **********************************************************************************************
These functions create standard structures used in the EMR records.
*********************************************************************************************** */
/**
\brief Set up fields for an EMR_HEADER from the physical device's width and height in mm and dots per millimeter.
Typically this is something like 216,279,47.244 (Letter paper, 1200 DPI = 47.244 DPmm)
\return 0 for success, >=1 for failure.
\param xmm Device width in millimeters
\param ymm Device height in millimeters
\param dpmm Dots per millimeter
\param szlDev Device size structure in pixels
\param szlMm Device size structure in mm
*/
int device_size(
const int xmm,
const int ymm,
const float dpmm,
){
return(0);
}
/**
\brief Set up fields for an EMR_HEADER for drawing by physical size in mm and dots per millimeter.
Technically rclBounds is supposed to be the extent of the drawing within the EMF, but libUEMF has no way
of knowing this since it never actually draws anything. Instead this is set to the full drawing size.
Coordinates are inclusive inclusive, so 297 -> 0,29699.
\return 0 for success, >=1 for failure.
\param xmm Drawing width in millimeters
\param ymm Drawing height in millimeters
\param dpmm Dots per millimeter
\param rclBounds Drawing size structure in pixels
\param rclFrame Drawing size structure in mm
*/
int drawing_size(
const int xmm,
const int ymm,
const float dpmm,
){
rclBounds->right = U_ROUND((float) xmm * dpmm) - 1; // because coordinate system is 0,0 in upper left, N,M in lower right
return(0);
}
/**
\brief Set a U_COLORREF value from separeate R,G,B values.
Or use macro directly: cr = U_RGB(r,g,b).
\param red Red component
\param green Green component
\param blue Blue component
*/
){
return(cr);
}
/**
\brief Set rect and rectl objects from Upper Left and Lower Right corner points.
\param ul upper left corner of rectangle
\param lr lower right corner of rectangle
*/
){
return(rct);
}
/**
\brief Set sizel objects with X,Y values.
\param x X coordinate
\param y Y coordinate
*/
int32_t x,
int32_t y
){
return(sz);
}
/**
\brief Set pointl objects with X,Y values.
\param x X coordinate
\param y Y coordinate
*/
int32_t x,
int32_t y
){
pt.x = x;
pt.y = y;
return(pt);
}
/**
\brief Set point16 objects with 16 bit X,Y values.
\param x X coordinate
\param y Y coordinate
*/
int16_t x,
int16_t y
){
pt.x = x;
pt.y = y;
return(pt);
}
/**
\brief Find the bounding rectangle from a polyline of a given width.
\param count number of points in the polyline
\param pts the polyline
\param width width of drawn line
*/
){
unsigned int i;
}
if(width > 0){
}
return(rect);
}
/**
\brief Find the bounding rectangle from a polyline of a given width.
\param count number of points in the polyline
\param pts the polyline
\param width width of drawn line
*/
){
unsigned int i;
}
if(width > 0){
}
return(rect);
}
/**
\brief Construct a U_LOGBRUSH structure.
\return U_LOGBRUSH structure
\param lbStyle LB_Style Enumeration
\param lbColor Brush color
\param lbHatch HatchStyle Enumertaion
*/
){
return(lb);
}
/**
\brief Construct a U_XFORM structure.
\return U_XFORM structure
\param eM11 Rotation Matrix element
\param eM12 Rotation Matrix element
\param eM21 Rotation Matrix element
\param eM22 Rotation Matrix element
\param eDx Translation element
\param eDy Translation element
*/
){
return(xform);
}
/**
\brief Construct a U_XFORM structure.
\return U_XFORM structure
\param scale Scale factor
\param rot Rotation angle in degrees, positive is counter clockwise from the x axis.
\param axisrot Angle in degrees defining the major axis before rotation, positive is counter clockwise from the x axis.
\param eDx Translation element
\param eDy Translation element
Operation is:
1 Conformal map of points based on scale, axis rotation, and axis ratio,
2. Apply rotation
3. Apply offset
*/
){
// angles are in degrees, must be in radians
}
else { // when the ratio is 1.0 then the major axis angle is ignored and only scale matters
}
return(xform);
}
/**
\brief Construct a U_LOGCOLORSPACEA structure.
\return U_LOGCOLORSPACEA structure
\param lcsCSType LCS_CSType Enumeration
\param lcsIntent LCS_Intent Enumeration
\param lcsEndpoints CIE XYZ color space endpoints
\param lcsGammaRGB Gamma For RGB
\param lcsFilename Could name an external color profile file, otherwise empty string
*/
char *lcsFilename
){
return(lcsa);
}
/**
\brief Construct a U_LOGCOLORSPACEW structure.
\return U_LOGCOLORSPACEW structure
\param lcsCSType LCS_CSType Enumeration
\param lcsIntent LCS_Intent Enumeration
\param lcsEndpoints CIE XYZ color space endpoints
\param lcsGammaRGB Gamma For RGB
\param lcsFilename Could name an external color profile file, otherwise empty string
*/
){
return(lcsa);
}
/**
\brief Construct a U_PANOSE structure.
\return U_PANOSE structure
\param bFamilyType FamilyType Enumeration
\param bSerifStyle SerifType Enumeration
\param bWeight Weight Enumeration
\param bProportion Proportion Enumeration
\param bContrast Contrast Enumeration
\param bStrokeVariation StrokeVariation Enumeration
\param bArmStyle ArmStyle Enumeration
\param bLetterform Letterform Enumeration
\param bMidline Midline Enumeration
\param bXHeight XHeight Enumeration
*/
){
return(panose);
}
/**
\brief Construct a U_LOGFONT structure.
\return U_LOGFONT structure
\param lfHeight Height in Logical units
\param lfWidth Average Width in Logical units
\param lfEscapement Angle in 0.1 degrees betweem escapement vector and X axis
\param lfOrientation Angle in 0.1 degrees between baseline and X axis
\param lfWeight LF_Weight Enumeration
\param lfItalic Italics: 0 or 1
\param lfUnderline Underline: 0 or 1
\param lfStrikeOut Strikeout: 0 or 1
\param lfCharSet LF_CharSet Enumeration
\param lfOutPrecision LF_OutPrecision Enumeration
\param lfClipPrecision LF_ClipPrecision Enumeration
\param lfQuality LF_Quality Enumeration
\param lfPitchAndFamily LF_PitchAndFamily Enumeration
\param lfFaceName Name of font. truncates at U_LF_FACESIZE, smaller must be null terminated
*/
){
wchar16strncpypad(lf.lfFaceName, lfFaceName, U_LF_FACESIZE); // pad this one as the intial structure was not set to zero
return(lf);
}
/**
\brief Construct a U_LOGFONT_PANOSE structure.
\return U_LOGFONT_PANOSE structure
\param elfLogFont Basic font attributes
\param elfFullName Font full name, truncates at U_LF_FULLFACESIZE, smaller must be null terminated
\param elfStyle Font style, truncates at U_LF_FULLFACESIZE, smaller must be null terminated
\param elfStyleSize Font hinting starting at this point size, if 0, starts at Height
\param elfPanose Panose Object. If all zero, it is ignored.
*/
){
memset(&lfp,0,sizeof(U_LOGFONT_PANOSE)); // all fields zero unless needed. Many should be ignored or must be 0.
return(lfp);
}
/**
\brief Construct a U_BITMAPINFOHEADER structure.
\return U_BITMAPINFOHEADER structure
\param biWidth Bitmap width in pixels
\param biHeight Bitmap height in pixels
\param biPlanes Planes (must be 1)
\param biBitCount BitCount Enumeration
\param biCompression BI_Compression Enumeration
\param biSizeImage Size in bytes of image
\param biClrUsed Number of bmciColors in U_BITMAPCOREINFO
\param biClrImportant Number of bmciColors needed (0 means all).
*/
){
return(Bmi);
}
/**
\brief Allocate and construct a U_BITMAPINFO structure.
\return Pointer to a U_BITMAPINFO structure
\param BmiHeader Geometry and pixel properties
\param BmiColors Color table (must be NULL for some values of BmiHeader->biBitCount)
*/
){
char *record;
int irecsize;
if(record){
if(cbColors){
off = sizeof(U_BITMAPINFOHEADER);
}
}
return((PU_BITMAPINFO) record);
}
/**
\brief Allocate and construct a U_EXTLOGPEN structure.
\return pointer to U_EXTLOGPEN structure, or NULL on error
\param elpPenStyle PenStyle Enumeration
\param elpWidth Width in logical units (elpPenStyle & U_PS_GEOMETRIC) or 1 (pixel)
\param elpBrushStyle LB_Style Enumeration
\param elpColor Pen color
\param elpHatch HatchStyle Enumeration
\param elpNumEntries Count of StyleEntry array
*/
){
int irecsize,szSyleArray;
char *record;
if(elpNumEntries){
if(!elpStyleEntry)return(NULL);
}
else {
szSyleArray = 0;
irecsize = sizeof(U_EXTLOGPEN);
}
if(record){
else { memset(((PU_EXTLOGPEN) record)->elpStyleEntry,0,sizeof(U_STYLEENTRY)); } // not used, but this stops valgrind warnings
}
return((PU_EXTLOGPEN) record);
}
/**
\brief Construct a U_LOGPEN structure.
\return U_LOGPEN structure
\param lopnStyle PenStyle Enumeration
\param lopnWidth Width of pen set by X, Y is ignored
\param lopnColor Pen color value
*/
){
return(lp);
}
/**
\brief Construct a U_LOGPLTNTRY structure.
\return U_LOGPLTNTRY structure
\param peReserved Ignore
\param peRed Palette entry Red Intensity
\param peGreen Palette entry Green Intensity
\param peBlue Palette entry Blue Intensity
*/
){
return(lpny);
}
/**
\brief Allocate and construct a U_LOGPALETTE structure.
\return pointer to U_LOGPALETTE structure, or NULL on error.
\param palNumEntries Number of U_LOGPLTNTRY objects
\param palPalEntry array, PC_Entry Enumeration
*/
){
int cbPalArray,irecsize;
if(irecsize){
}
return(record);
}
/**
\brief Construct a U_RGNDATAHEADER structure.
\return U_RGNDATAHEADER structure
\param nCount Number of rectangles in region
\param rclBounds Region bounds
*/
){
return(rdh);
}
/**
\brief Allocate and construct a U_RGNDATA structure.
\return pointer to U_RGNDATA structure, or NULL on error.
\param rdh Data description
\param Buffer Array of U_RECTL elements
*/
){
char *record;
int irecsize;
int szRgnArray,off;
if(record){
off = sizeof(U_RGNDATAHEADER);
}
return((PU_RGNDATA) record);
}
/**
\brief Construct a U_COLORADJUSTMENT structure.
\return U_COLORADJUSTMENT structure
\param Size Size of this structure in bytes
\param Flags ColorAdjustment Enumeration
\param IlluminantIndex Illuminant Enumeration
\param RedGamma Red Gamma correction (range:2500:65000, 10000 is no correction)
\param GreenGamma Green Gamma correction (range:2500:65000, 10000 is no correction)
\param BlueGamma Blue Gamma correction (range:2500:65000, 10000 is no correction)
\param ReferenceBlack Values less than this are black (range:0:4000)
\param ReferenceWhite Values more than this are white (range:6000:10000)
\param Contrast Contrast adjustment (range:-100:100, 0 is no correction)
\param Brightness Brightness adjustment (range:-100:100, 0 is no correction)
\param Colorfulness Colorfulness adjustment (range:-100:100, 0 is no correction)
\param RedGreenTint Tine adjustment (range:-100:100, 0 is no correction)
*/
){
// Next one is different to eliminate compiler warning - U_R_B_MIN is 0 and unsigned
return(ca);
}
/**
\brief Construct a U_PIXELFORMATDESCRIPTOR structure.
\return U_PIXELFORMATDESCRIPTOR structure
\param dwFlags PFD_dwFlags Enumeration
\param iPixelType PFD_iPixelType Enumeration
\param cColorBits RGBA: total bits per pixel
\param cRedBits Red bits per pixel
\param cRedShift Red shift to data bits
\param cGreenBits Green bits per pixel
\param cGreenShift Green shift to data bits
\param cBlueBits Blue bits per pixel
\param cBlueShift Blue shift to data bits
\param cAlphaBits Alpha bits per pixel
\param cAlphaShift Alpha shift to data bits
\param cAccumBits Accumulator buffer, total bitplanes
\param cAccumRedBits Red accumulator buffer bitplanes
\param cAccumGreenBits Green accumulator buffer bitplanes
\param cAccumBlueBits Blue accumulator buffer bitplanes
\param cAccumAlphaBits Alpha accumulator buffer bitplanes
\param cDepthBits Depth of Z-buffer
\param cStencilBits Depth of stencil buffer
\param cAuxBuffers Depth of auxilliary buffers (not supported)
\param iLayerType PFD_iLayerType Enumeration, may be ignored
\param dwLayerMask may be ignored
\param dwVisibleMask color or index of underlay plane
\param dwDamageMask may be ignored
*/
){
return(pfd);
}
/**
\brief Allocate and create a U_EMRTEXT structure followed by its variable pieces via a char* pointer.
Dx cannot be NULL, if the calling program has no appropriate values call dx_set() first.
\return char* pointer to U_EMRTEXT structure followed by its variable pieces, or NULL on error
\param ptlReference String start coordinates
\param NumString Number of characters in string, does NOT include a terminator
\param cbChar Number of bytes per character
\param String String to write
\param fOptions ExtTextOutOptions Enumeration
\param Dx Character spacing array from the start of the RECORD
*/
char *emrtext_set(
void *String,
){
char *record;
if(fOptions & U_ETO_PDY)cbDxArray += cbDxArray; // of the Dx buffer, here do both X and Y coordinates
irecsize = sizeof(U_EMRTEXT) + sizeof(uint32_t) + cbString4 + cbDxArray; // core structure + offDx + string buf + dx buf
if(!(fOptions & U_ETO_NO_RECT)){ irecsize += sizeof(U_RECTL); } // plus variable U_RECTL, when it is present
if(record){
// pick up ((PU_EMRTEXT)record)->offString later
}
}
}
return(record);
}
/* **********************************************************************************************
These functions are simpler or more convenient ways to generate the specified types of EMR records.
Each should be called in preference to the underlying "base" EMR function.
*********************************************************************************************** */
/**
\brief Allocate and construct a U_EMRCOMMENT structure with a UTF8 string.
A U_EMRCOMMENT contains application specific data, and that may include contain null characters. This function may be used when the
comment only incluces UT8 text.
\return pointer to U_EMRCOMMENT structure, or NULL on error.
\param string UTF8 string to store in the comment
*/
char *textcomment_set(
const char *string
){
}
/**
\brief Allocate and construct a U_EMRDELETEOBJECT structure and also delete the requested object from the table.
Use this function instead of calling U_EMRDELETEOBJECT_set() directly.
\return pointer to U_EMRDELETEOBJECT structure, or NULL on error.
\param ihObject Pointer to handle to delete. This value is set to 0 if the function succeeds.
\param eht EMF handle table
Note that calling this function should always be conditional on the specifed object being defined. It is easy to
write a program where deleteobject_set() is called in a sequence where, at the time, we know that ihObject is defined.
Then a later modification, possibly quite far away in the code, causes it to be undefined. That distant change will
result in a failure when this function reutrns. That problem cannot be handled here because the only values which
may be returned are a valid U_EMRDELETEOBJECT record or a NULL, and other errors could result in the NULL.
So the object must be checked before the call.
*/
char *deleteobject_set(
){
if(emf_htable_delete(ihObject,eht))return(NULL); // invalid handle or other problem, cannot be deleted
return(U_EMRDELETEOBJECT_set(saveObject));
}
/**
\brief Allocate and construct a U_EMRSELECTOBJECT structure, checks that the handle specified is one that can actually be selected.
Use this function instead of calling U_EMRSELECTOBJECT_set() directly.
\return pointer to U_EMRSELECTOBJECT structure, or NULL on error.
\param ihObject handle to select
\param eht EMF handle table
*/
char *selectobject_set(
){
if(!eht->table[ihObject])return(NULL); // handle is not in the table, so not active, so cannot be selected
}
return(U_EMRSELECTOBJECT_set(ihObject));
}
/**
\brief Allocate and construct a U_EMREXTCREATEPEN structure, create a handle and return it.
Use this function instead of calling U_EMREXTCREATEPEN_set() directly.
\return pointer to U_EMREXTCREATEPEN structure, or NULL on error.
\param ihPen handle to be used by new object
\param eht EMF handle table
\param Bmi bitmapbuffer
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px pixel array (NULL if cbPx == 0)
\param elp Pen parameters (Size is Variable!!!!)
*/
char *extcreatepen_set(
char *Px,
){
}
/**
\brief Allocate and construct a U_EMRCREATEPEN structure, create a handle and returns it
Use this function instead of calling U_EMRCREATEPEN_set() directly.
\return pointer to U_EMRCREATEPEN structure, or NULL on error.
\param ihPen handle to be used by new object
\param eht EMF handle table
\param lopn Pen parameters
*/
char *createpen_set(
){
}
/**
\brief Allocate and construct a U_EMRCREATEBRUSHINDIRECT structure, create a handle and returns it
Use this function instead of calling U_EMRCREATEBRUSHINDIRECT_set() directly.
\return pointer to U_EMRCREATEBRUSHINDIRECT structure, or NULL on error.
\param ihBrush handle to be used by new object
\param eht EMF handle table
\param lb Brush parameters
*/
char *createbrushindirect_set(
){
}
/**
\brief Allocate and construct a U_EMRCREATEDIBPATTERNBRUSHPT_set structure, create a handle and returns it
Use this function instead of calling U_EMRCREATEDIBPATTERNBRUSHPT_set() directly.
\return pointer to U_EMRCREATEDIBPATTERNBRUSHPT_set structure, or NULL on error.
\param ihBrush handle to be used by new object
\param eht EMF handle table
\param iUsage DIBColors enumeration
\param Bmi Bitmap info
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *createdibpatternbrushpt_set(
const char *Px
){
}
/**
\brief Allocate and construct a U_EMRCREATEMONOBRUSH_set structure, create a handle and returns it
Use this function instead of calling U_EMRCREATEMONOBRUSH_set() directly.
\return pointer to U_EMRCREATEMONOBRUSH_set structure, or NULL on error.
\param ihBrush handle to be used by new object
\param eht EMF handle table
\param iUsage DIBColors enumeration
\param Bmi Bitmap info
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *createmonobrush_set(
const char *Px
){
}
/**
\brief Allocate and construct a U_EMRCREATECOLORSPACE structure, create a handle and returns it
Use this function instead of calling U_EMRCREATECOLORSPACE_set() directly.
\return pointer to U_EMRCREATECOLORSPACE structure, or NULL on error.
\param ihCS ColorSpace handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param lcs ColorSpace parameters
*/
char *createcolorspace_set(
){
}
/**
\brief Allocate and construct a U_EMRCREATECOLORSPACEW structure, create a handle and returns it
Use this function instead of calling U_EMRCREATECOLORSPACEW_set() directly.
\return pointer to U_EMRCREATECOLORSPACEW structure, or NULL on error.
\param ihCS ColorSpace handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param lcs ColorSpace parameters
\param dwFlags If low bit set Data is present
\param cbData Number of bytes of theData field.
\param Data (Optional, dwFlags & 1) color profile data
*/
char *createcolorspacew_set(
){
}
/**
\brief Allocate and construct a U_EMREXTCREATEFONTINDIRECTW structure, create a handle and returns it
Use this function instead of calling U_EMREXTCREATEFONTINDIRECTW_set() directly.
\return pointer to U_EMREXTCREATEFONTINDIRECTW structure, or NULL on error.
\param ihFont Font handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param elf Pointer to Font parameters asPU_LOGFONT
\param elfw Pointer to Font parameters as U_LOGFONT_PANOSE
*/
char *extcreatefontindirectw_set(
const char *elf,
const char *elfw
){
}
/**
\brief Allocate and construct a U_EMRCREATEPALETTE structure, create a handle and returns it
Use this function instead of calling U_EMRCREATEPALETTE_set() directly.
\return pointer to U_EMRCREATEPALETTE structure, or NULL on error.
\param ihPal Palette handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param lgpl PaletteFont parameters
*/
char *createpalette_set(
){
}
/**
\brief Allocate and construct a U_EMRSETPALETTEENTRIES structure, create a handle and returns it
Use this function instead of calling U_EMRSETPALETTEENTRIES_set() directly.
\return pointer to U_EMRSETPALETTEENTRIES structure, or NULL on error.
\param ihPal Palette handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param iStart First Palette entry in selected object to set
\param cEntries Number of Palette entries in selected object to set
\param aPalEntries Values to set with
*/
char *setpaletteentries_set(
const U_NUM_LOGPLTNTRY cEntries,
const PU_LOGPLTNTRY aPalEntries
){
}
/**
\brief Allocate and construct a U_EMRFILLRGN structure, create a handle and returns it
Use this function instead of calling U_EMRFILLRGN_set() directly.
\return pointer to U_EMRFILLRGN structure, or NULL on error.
\param ihBrush Brush handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param rclBounds Bounding rectangle in device units
\param RgnData Pointer to a U_RGNDATA structure
*/
char *fillrgn_set(
const PU_RGNDATA RgnData
){
}
/**
\brief Allocate and construct a U_EMRFRAMERGN structure, create a handle and returns it
Use this function instead of calling U_EMRFRAMERGN_set() directly.
\return pointer to U_EMRFRAMERGN structure, or NULL on error.
\param ihBrush Brush handle, will be created and returned
\param eht Pointer to structure holding all EMF handles
\param rclBounds Bounding rectangle in device units
\param szlStroke W & H of Brush stroke
\param RgnData Pointer to a U_RGNDATA structure
*/
char *framergn_set(
const PU_RGNDATA RgnData
){
}
/**
\brief Allocate and construct an array of U_POINT objects which has been subjected to a U_XFORM
\returns pointer to an array of U_POINT structures.
\param points pointer to the source U_POINT structures
\param count number of members in points
\param xform U_XFORM to apply
May also be used to modify U_RECT by doubling the count and casting the pointer.
*/
int i;
float x,y;
for(i=0; i<count; i++){
x = (float) points[i].x;
y = (float) points[i].y;
}
return(newpts);
}
/**
\brief Allocate and construct an array of U_POINT16 objects which has been subjected to a U_XFORM
\returns pointer to an array of U_POINT16 structures.
\param points pointer to the source U_POINT16 structures
\param count number of members in points
\param xform U_XFORM to apply
Transformed src points {x0,y0} appear at {x0*xscale + x, y0*yscale + y}
*/
int i;
float x,y;
for(i=0; i<count; i++){
x = (float) points[i].x;
y = (float) points[i].y;
}
return(newpts);
}
/**
\brief Allocate and construct an array of U_TRIVERTEX objects which has been subjected to a U_XFORM
\returns pointer to an array of U_TRIVERTEX structures.
\param tv pointer to the source U_TRIVERTEX structures
\param count number of members in points
\param xform U_XFORM to apply
Transformed Trivertex points {x0,y0} appear at {x0*xscale + x, y0*yscale + y}
*/
int i;
float x,y;
for(i=0; i<count; i++){
x = (float) tv[i].x;
y = (float) tv[i].y;
}
return(newtvs);
}
/**
\brief Allocate and construct an array of U_POINT objects from a set of U_POINT16 objects
\returns pointer to an array of U_POINT structures.
\param points pointer to the source U_POINT16 structures
\param count number of members in points
*/
int i;
for(i=0; i<count; i++){
}
return(newpts);
}
/**
\brief Allocate and construct an array of U_POINT16 objects from a set of U_POINT objects
\returns pointer to an array of U_POINT16 structures.
\param points pointer to the source U_POINT structures
\param count number of members in points
If a coordinate is out of range it saturates at boundary.
*/
int i;
for(i=0; i<count; i++){
}
return(newpts);
}
// hide these from Doxygen
//! @cond
/* **********************************************************************************************
These functions contain shared code used by various U_EMR*_set functions. These should NEVER be called
by end user code and to further that end prototypes are NOT provided and they are hidden from Doxygen.
These are (mostly) ordered by U_EMR_* index number.
For all _set functions the caller must eventually call free() on the returned pointer.
CORE1(uint32_t iType, U_RECTL rclBounds, const uint32_t cptl, const U_POINTL *points){
CORE2(uint32_t iType, U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cptl, const U_POINTL *points){
CORE3(uint32_t iType, uint32_t iMode){ (generic 1 uint)
CORE4(uint32_t iType, U_RECTL rclBox){
CORE5(uint32_t iType){ (generic noargs)
CORE6(uint32_t iType, U_RECTL rclBounds, const uint32_t cpts, const U_POINT16 *points){ (16bit form of CORE1)
CORE7(uint32_t iType, U_PAIR pair){
CORE8(uint32_t iType, U_RECTL rclBounds, uint32_t iGraphicsMode, U_FLOAT exScale, U_FLOAT eyScale, PU_EMRTEXT emrtext){
CORE9(uint32_t iType, U_RECTL rclBox, U_POINTL ptlStart, U_POINTL ptlEnd){
CORE10(uint32_t iType, U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cpts, const U_POINT16 *points){ (16bit form of CORE2)
CORE11(uint32_t iType, PU_RGNDATA RgnData){
CORE12(uint32_t iType, uint32_t ihBrush, uint32_t iUsage, PU_BITMAPINFO Bmi){
CORE13(uint32_t iType, U_RECTL rclBounds, U_POINTL Dest, U_POINTL cDest,
U_POINTL Src, U_POINTL cSrc, U_XFORM xformSrc, U_COLORREF crBkColorSrc, uint32_t iUsageSrc,
uint32_t Data, PU_BITMAPINFO Bmi);
*********************************************************************************************** */
// Functions with the same form starting with U_EMRPOLYBEZIER_set
char *record;
int cbPoints;
int irecsize;
if(record){
}
return(record);
}
// Functions with the same form starting with U_EMR_POLYPOLYLINE
char *U_EMR_CORE2(uint32_t iType, U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cptl, const U_POINTL *points){
char *record;
int irecsize;
irecsize = sizeof(U_EMRPOLYPOLYLINE) + cbPoints + cbPolys - sizeof(uint32_t); // First instance of each is in struct
if(record){
}
return(record);
}
// Functions with the same form starting with U_EMR_SETMAPMODE_set
char *record;
int irecsize;
irecsize = sizeof(U_EMRSETMAPMODE);
if(record){
}
return(record);
}
// Functions taking a single U_RECT or U_RECTL, starting with U_EMRELLIPSE_set, also U_EMRFILLPATH,
char *record;
int irecsize;
irecsize = sizeof(U_EMRELLIPSE);
if(record){
}
return(record);
}
// Functions with the same form starting with U_EMRSETMETARGN_set
char *record;
int irecsize = 8;
if(record){
}
return(record);
}
// Functions with the same form starting with U_EMRPOLYBEZIER16_set
char *record;
int irecsize;
off = sizeof(U_EMR) + sizeof(U_RECTL) + sizeof(U_NUM_POINT16); // offset to the start of the variable region
if(record){
}
}
return(record);
}
// Functions that take a single struct argument which contains two uint32_t, starting with U_EMRSETWINDOWEXTEX_set
// these all pass two 32 bit ints and are cast by the caller to U_PAIR
char *record;
int irecsize = sizeof(U_EMRGENERICPAIR);
if(record){
}
return(record);
}
// For U_EMREXTTEXTOUTA and U_EMREXTTEXTOUTW
char *U_EMR_CORE8(
){
char *record;
int csize;
else { return(NULL); }
if(!(emrtext->fOptions & U_ETO_NO_RECT)){ cbEmrtext += sizeof(U_RECTL); } // plus the variable U_RECTL, when it is present
if(emrtext->fOptions & U_ETO_PDY)cbDx += cbDx; // size of Dx buffer when both x and y offsets are used
cbEmrtextAll = cbEmrtext + sizeof(uint32_t) + cbString4 + cbDx; // structure (+- rect) + offDx + string buf + dx buf + offDx
/* adjust offset fields in emrtext to match the EMRTEXTOUT* field, currently they match EMRTEXT.
This works because the variable pieces have all been moved outside of the U_EMRTEXT and U_EMRTEXTOUTA strutures.
*/
((PU_EMRTEXT)emrtext)->offString += sizeof(U_EMREXTTEXTOUTA) - sizeof(U_EMRTEXT); // adjust offString
// final record size is: U_EMREXTTEXTOUTA (includes constant part of U_EMRTEXT) + U_RECTL (if present) + offDx + dx buffer + string buffer
irecsize = sizeof(U_EMREXTTEXTOUTA) + cbEmrtextAll - sizeof(U_EMRTEXT); // do not count core emrtext strcture twice
if(record){
// copy the adjusted U_EMRTEXT into the emrtext part of the full record..
}
return(record);
}
// Functions that take a rect and a pair of points, starting with U_EMRARC_set
char *record;
if(record){
}
return(record);
}
// Functions with the same form starting with U_EMR_POLYPOLYLINE16
char *U_EMR_CORE10(uint32_t iType, U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cpts, const U_POINT16 *points){
char *record;
int irecsize;
irecsize = sizeof(U_EMRPOLYPOLYLINE16) + cbPoints + cbPolys - sizeof(uint32_t); // First instance of each is in struct
if(record){
}
return(record);
}
// common code for U_EMRINVERTRGN and U_EMRPAINTRGN,
char *record;
int irecsize;
if(record){
}
return(record);
}
// common code for U_EMRCREATEMONOBRUSH_set and U_EMRCREATEDIBPATTERNBRUSHPT_set,
char *U_EMR_CORE12_set(
const uint32_t cbPx, // Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
const char *Px // (Optional) bitmapbuffer (pixel array section )
){
char *record;
int irecsize;
if(record){
if(cbBmi){
off = sizeof(U_EMRCREATEMONOBRUSH);
}
else {
}
}
return(record);
}
// common code for U_EMRBLEND_set and U_EMRTRANSPARENTBLT_set,
char *U_EMR_CORE13_set(
const uint32_t cbPx, // Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
char *Px // (Optional) bitmapbuffer (pixel array section )
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRALPHABLEND);
}
return(record);
}
//! @endcond
/* **********************************************************************************************
These are the core EMR functions, each creates a particular type of record.
All return these records via a char* pointer, which is NULL if the call failed.
They are listed in order by the corresponding U_EMR_* index number.
*********************************************************************************************** */
// U_EMRHEADER_set 1
/**
\brief Allocate and construct a U_EMRHEADER record.
\return pointer to U_EMRHEADER record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param rclFrame Bounding rectangle in 0.01 mm units
\param pfmtDesc Pointer to a PixelFormatDescriptor
\param nDesc number of characters in Description, will include first three '\0'
\param Description Description, formatted like: text1\0text2\0\0
\param szlDevice Reference device size in pixels
\param szlMillimeters Reference device size in 0.01 mm
\param bOpenGL nonZero if OpenGL commands are included
*/
char *U_EMRHEADER_set(
U_PIXELFORMATDESCRIPTOR* const pfmtDesc,
uint16_t* const Description,
const U_SIZEL szlMillimeters,
){
char *record;
int irecsize;
else { cbPFD = 0; }
else { cbDesc = 0; }
if(record){
off = sizeof(U_EMRHEADER);
if(cbDesc4){
}
if(cbPFD){
}
}
return(record);
}
// U_EMRPOLYBEZIER_set 2
/**
\brief Allocate and construct a U_EMR_POLYBEZIER record.
\return pointer to U_EMR_POLYBEZIER record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param cptl Number of points to draw
\param points array of points
*/
char *U_EMRPOLYBEZIER_set(
){
}
// U_EMRPOLYGON_set 3
/**
\brief Allocate and construct a U_EMR_POLYGON record.
\return pointer to U_EMR_POLYGON record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param cptl Number of points to draw
\param points array of points
*/
char *U_EMRPOLYGON_set(
){
}
// U_EMRPOLYLINE_set 4
/**
\brief Allocate and construct a U_EMR_POLYLINE record.
\return pointer to U_EMR_POLYLINE record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param cptl Number of points to draw
\param points array of points
*/
char *U_EMRPOLYLINE_set(
){
}
// U_EMRPOLYBEZIERTO_set 5
/**
\brief Allocate and construct a U_EMR_POLYBEZIERTO record.
\return pointer to U_EMR_POLYBEZIERTO record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param cptl Number of points to draw
\param points array of points
*/
char *U_EMRPOLYBEZIERTO_set(
){
}
// U_EMRPOLYLINETO_set 6
/**
\brief Allocate and construct a U_EMR_POLYLINETO record.
\return pointer to U_EMR_POLYLINETO record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param cptl Number of points to draw
\param points array of points
*/
char *U_EMRPOLYLINETO_set(
){
}
// U_EMRPOLYPOLYLINE_set 7
/**
\brief Allocate and construct a U_EMR_POLYPOLYLINE record.
\return pointer to U_EMR_POLYPOLYLINE record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param nPolys Number of elements in aPolyCounts
\param aPolyCounts Number of points in each poly (sequential)
\param cptl Total number of points (over all poly)
\param points array of points
*/
char *U_EMRPOLYPOLYLINE_set(
const uint32_t *aPolyCounts,
){
}
// U_EMRPOLYPOLYGON_set 8
/**
\brief Allocate and construct a U_EMR_POLYPOLYGON record.
\return pointer to U_EMR_POLYPOLYGON record, or NULL on error.
\param rclBounds bounding rectangle in device units
\param nPolys Number of elements in aPolyCounts
\param aPolyCounts Number of points in each poly (sequential)
\param cptl Total number of points (over all poly)
\param points array of points
*/
char *U_EMRPOLYPOLYGON_set(
const uint32_t *aPolyCounts,
){
}
// U_EMRSETWINDOWEXTEX_set 9
/**
\brief Allocate and construct a U_EMR_SETWINDOWEXTEX record.
\return pointer to U_EMR_SETWINDOWEXTEX record, or NULL on error.
\param szlExtent H & V extent in logical units
*/
char *U_EMRSETWINDOWEXTEX_set(
){
}
// U_EMRSETWINDOWORGEX_set 10
/**
\brief Allocate and construct a U_EMR_SETWINDOWORGEX record.
\return pointer to U_EMR_SETWINDOWORGEX record, or NULL on error.
\param ptlOrigin H & V origin in logical units
*/
char *U_EMRSETWINDOWORGEX_set(
){
}
// U_EMRSETVIEWPORTEXTEX_set 11
/**
\brief Allocate and construct a U_EMR_SETVIEWPORTEXTEX record.
\return pointer to U_EMR_SETVIEWPORTEXTEX record, or NULL on error.
\param szlExtent H & V extent in logical units
*/
char *U_EMRSETVIEWPORTEXTEX_set(
){
}
// U_EMRSETVIEWPORTORGEX_set 12
/**
\brief Allocate and construct a U_EMR_SETVIEWPORTORGEX record.
\return pointer to U_EMR_SETVIEWPORTORGEX record, or NULL on error.
\param ptlOrigin H & V origin in logical units
*/
char *U_EMRSETVIEWPORTORGEX_set(
){
}
// U_EMRSETBRUSHORGEX_set 13
/**
\brief Allocate and construct a U_EMR_SETBRUSHORGEX record.
\return pointer to U_EMR_SETBRUSHORGEX record, or NULL on error.
\param ptlOrigin H & V origin in logical units
*/
char *U_EMRSETBRUSHORGEX_set(
){
}
// U_EMREOF_set 14
/**
\brief Allocate and construct a U_EMR_EOF record.
\return pointer to U_EMR_EOF record, or NULL on error.
\param cbPalEntries Number of palette entries
\param PalEntries (optional) array of PalEntries
\param et tracking information, needed for nSizeLast calculation
*/
char *U_EMREOF_set(
const U_CBPLENTRIES cbPalEntries,
const PU_LOGPLTNTRY PalEntries,
){
char *record;
char *ptr;
int irecsize;
int cbPals; // space allocated for Palette Entries
irecsize = sizeof(U_EMREOF) + cbPals + sizeof(uint32_t); //invariant core, variable palette, palette byte count
if(record){
if(cbPals){
}
*(uint32_t *)ptr = irecsize + et->used; // EMREOF nSizeLast field, not at a fixed position, cannot be accessed by field name
}
return(record);
}
// U_EMRSETPIXELV_set 15
/**
\brief Allocate and construct a U_EMR_SETPIXELV record.
\return pointer to U_EMR_SETPIXELV record, or NULL on error.
\param ptlPixel Pixel coordinates (logical)
\param crColor Pixel color
*/
char *U_EMRSETPIXELV_set(
const U_COLORREF crColor
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRSETPIXELV);
if(record){
}
return(record);
}
// U_EMRSETMAPPERFLAGS_set 16
/**
\brief Allocate and construct a U_EMR_SETMAPPERFLAGS record.
\return pointer to U_EMR_SETMAPPERFLAGS record, or NULL on error.
*/
char *U_EMRSETMAPPERFLAGS_set(void){
char *record;
int irecsize;
irecsize = sizeof(U_EMRSETMAPPERFLAGS);
if(record){
}
return(record);
}
// U_EMRSETMAPMODE_set 17
/**
\brief Allocate and construct a U_EMR_SETMAPMODE record.
\return pointer to U_EMR_SETMAPMODE record, or NULL on error.
\param iMode MapMode Enumeration
*/
char *U_EMRSETMAPMODE_set(
){
}
// U_EMRSETBKMODE_set 18
/**
\brief Allocate and construct a U_EMR_SETBKMODE record.
\return pointer to U_EMR_SETBKMODE record, or NULL on error.
\param iMode BackgroundMode Enumeration
*/
char *U_EMRSETBKMODE_set(
){
}
// U_EMRSETPOLYFILLMODE_set 19
/**
\brief Allocate and construct a U_EMR_SETPOLYFILLMODE record.
\return pointer to U_EMR_SETPOLYFILLMODE record, or NULL on error.
\param iMode PolygonFillMode Enumeration
*/
char *U_EMRSETPOLYFILLMODE_set(
){
}
// U_EMRSETROP2_set 20
/**
\brief Allocate and construct a U_EMR_SETROP2 record.
\return pointer to U_EMR_SETROP2 record, or NULL on error.
\param iMode RasterOperation2 Enumeration
*/
char *U_EMRSETROP2_set(
){
}
// U_EMRSETSTRETCHBLTMODE_set 21
/**
\brief Allocate and construct a U_EMR_SETSTRETCHBLTMODE record.
\return pointer to U_EMR_SETSTRETCHBLTMODE record, or NULL on error.
\param iMode StretchMode Enumeration
*/
char *U_EMRSETSTRETCHBLTMODE_set(
){
}
// U_EMRSETTEXTALIGN_set 22
/**
\brief Allocate and construct a U_EMR_SETTEXTALIGN record.
\return pointer to U_EMR_SETTEXTALIGN record, or NULL on error.
\param iMode TextAlignment Enumeration
*/
char *U_EMRSETTEXTALIGN_set(
){
}
// U_EMRSETCOLORADJUSTMENT_set 23
/**
\brief Allocate and construct a U_EMR_SETCOLORADJUSTMENT record.
\return pointer to U_EMR_SETCOLORADJUSTMENT record, or NULL on error.
\param ColorAdjustment Color Adjustment
*/
char *U_EMRSETCOLORADJUSTMENT_set(
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRSETCOLORADJUSTMENT);
if(record){
}
return(record);
}
// U_EMRSETTEXTCOLOR_set 24
/**
\brief Allocate and construct a U_EMR_SETTEXTCOLOR record.
\return pointer to U_EMR_SETTEXTCOLOR record, or NULL on error.
\param crColor Text Color
*/
char *U_EMRSETTEXTCOLOR_set(
const U_COLORREF crColor
){
}
// U_EMRSETBKCOLOR_set 25
/**
\brief Allocate and construct a U_EMR_SETBKCOLOR record.
\return pointer to U_EMR_SETBKCOLOR record, or NULL on error.
\param crColor Background Color
*/
char *U_EMRSETBKCOLOR_set(
const U_COLORREF crColor
){
}
// U_EMROFFSETCLIPRGN_set 26
/**
\brief Allocate and construct a U_EMR_OFFSETCLIPRGN record.
\return pointer to U_EMR_OFFSETCLIPRGN record, or NULL on error.
\param ptl Clipping region
*/
char *U_EMROFFSETCLIPRGN_set(
){
}
// U_EMRMOVETOEX_set 27
/**
\brief Allocate and construct a U_EMR_MOVETOEX record.
\return pointer to U_EMR_MOVETOEX record, or NULL on error.
\param ptl Point coordinates
*/
char *U_EMRMOVETOEX_set(
){
}
// U_EMRSETMETARGN_set 28
/**
\brief Allocate and construct a U_EMR_SETMETARGN record.
\return pointer to U_EMR_SETMETARGN record, or NULL on error.
*/
char *U_EMRSETMETARGN_set(void){
return(U_EMR_CORE5(U_EMR_SETMETARGN));
}
// U_EMREXCLUDECLIPRECT_set 29
/**
\brief Allocate and construct a U_EMR_EXCLUDECLIPRECT record.
\return pointer to U_EMR_EXCLUDECLIPRECT record, or NULL on error.
\param rclClip Clipping Region
*/
char *U_EMREXCLUDECLIPRECT_set(
){
}
// U_EMRINTERSECTCLIPRECT_set 30
/**
\brief Allocate and construct a U_EMR_INTERSECTCLIPRECT record.
\return pointer to U_EMR_INTERSECTCLIPRECT record, or NULL on error.
\param rclClip Clipping Region
*/
char *U_EMRINTERSECTCLIPRECT_set(
){
}
// U_EMRSCALEVIEWPORTEXTEX_set 31
/**
\brief Allocate and construct a U_EMR_SCALEVIEWPORTEXTEX record.
\return pointer to U_EMR_SCALEVIEWPORTEXTEX record, or NULL on error.
\param xNum Horizontal multiplier (!=0)
\param xDenom Horizontal divisor (!=0)
\param yNum Vertical multiplier (!=0)
\param yDenom Vertical divisor (!=0)
*/
char *U_EMRSCALEVIEWPORTEXTEX_set(
){
}
// U_EMRSCALEWINDOWEXTEX_set 32
/**
\brief Allocate and construct a U_EMR_SCALEWINDOWEXTEX record.
\return pointer to U_EMR_SCALEWINDOWEXTEX record, or NULL on error.
\param xNum Horizontal multiplier (!=0)
\param xDenom Horizontal divisor (!=0)
\param yNum Vertical multiplier (!=0)
\param yDenom Vertical divisor (!=0)
*/
char *U_EMRSCALEWINDOWEXTEX_set(
){
}
// U_EMRSAVEDC_set 33
/**
\brief Allocate and construct a U_EMR_SAVEDC record.
\return pointer to U_EMR_SAVEDC record, or NULL on error.
*/
char *U_EMRSAVEDC_set(void){
return(U_EMR_CORE5(U_EMR_SAVEDC));
}
// U_EMRRESTOREDC_set 34
/**
\brief Allocate and construct a U_EMR_RESTOREDC record.
\return pointer to U_EMR_RESTOREDC record, or NULL on error.
\param iRelative DC to restore. -1 is preceding
*/
char *U_EMRRESTOREDC_set(
){
}
// U_EMRSETWORLDTRANSFORM_set 35
/**
\brief Allocate and construct a U_EMR_SETWORLDTRANSFORM record.
\return pointer to U_EMR_SETWORLDTRANSFORM record, or NULL on error.
\param xform Transform to use
*/
char *U_EMRSETWORLDTRANSFORM_set(
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRSETWORLDTRANSFORM);
if(record){
}
return(record);
}
// U_EMRMODIFYWORLDTRANSFORM_set 36
/**
\brief Allocate and construct a U_EMR_MODIFYWORLDTRANSFORM record.
\return pointer to U_EMR_MODIFYWORLDTRANSFORM record, or NULL on error.
\param xform Transform to use
\param iMode ModifyWorldTransformMode Enumeration
*/
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRMODIFYWORLDTRANSFORM);
if(record){
}
return(record);
}
// U_EMRSELECTOBJECT_set 37
/**
\brief Allocate and construct a U_EMR_SELECTOBJECT record.
Use selectobject_set() instead of calling this function directly.
\return pointer to U_EMR_SELECTOBJECT record, or NULL on error.
\param ihObject Number of a stock or created object
*/
char *U_EMRSELECTOBJECT_set(
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRSELECTOBJECT);
if(record){
}
return(record);
}
// U_EMRCREATEPEN_set 38
/**
\brief Allocate and construct a U_EMR_CREATEPEN record.
Use createpen_set() instead of calling this function directly.
\return pointer to U_EMR_CREATEPEN record, or NULL on error.
\param ihPen Handle of created pen
\param lopn U_LOGPEN structure describing this pen
*/
char *U_EMRCREATEPEN_set(
){
char *record;
int irecsize=sizeof(U_EMRCREATEPEN);
if(record){
}
return(record);
}
// U_EMRCREATEBRUSHINDIRECT_set 39
/**
\brief Allocate and construct a U_EMR_CREATEBRUSHINDIRECT record.
Use createbrushindirect_set() instead of calling this function directly.
\return pointer to U_EMR_CREATEBRUSHINDIRECT record, or NULL on error.
\param ihBrush Index to place object in EMF object table (this entry must not yet exist)
\param lb Brush properties
*/
char *U_EMRCREATEBRUSHINDIRECT_set(
const U_LOGBRUSH lb
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRCREATEBRUSHINDIRECT);
if(record){
((PU_EMRCREATEBRUSHINDIRECT) record)->ihBrush = ihBrush; // Index to place object in EMF object table (this entry must not yet exist)
}
return(record);
}
// U_EMRDELETEOBJECT_set 40
/**
\brief Allocate and construct a U_EMR_DELETEOBJECT record.
Use deleteobject_set() instead of calling this function directly.
\return pointer to U_EMR_DELETEOBJECT record, or NULL on error.
\param ihObject Number of a stock or created object
*/
char *U_EMRDELETEOBJECT_set(
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRDELETEOBJECT);
if(record){
}
return(record);
}
// U_EMRANGLEARC_set 41
/**
\brief Allocate and construct a U_EMR_ANGLEARC record.
\return pointer to U_EMR_ANGLEARC record, or NULL on error.
\param ptlCenter Center in logical units
\param nRadius Radius in logical units
\param eStartAngle Starting angle in degrees (counter clockwise from x axis)
\param eSweepAngle Sweep angle in degrees
*/
char *U_EMRANGLEARC_set(
const U_FLOAT eStartAngle,
const U_FLOAT eSweepAngle
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRANGLEARC);
if(record){
}
return(record);
}
// U_EMRELLIPSE_set 42
/**
\brief Allocate and construct a U_EMR_ELLIPSE record.
\return pointer to U_EMR_ELLIPSE record, or NULL on error.
\param rclBox bounding rectangle in logical units
*/
char *U_EMRELLIPSE_set(
){
}
// U_EMRRECTANGLE_set 43
/**
\brief Allocate and construct a U_EMR_RECTANGLE record.
\return pointer to U_EMR_RECTANGLE record, or NULL on error.
\param rclBox bounding rectangle in logical units
*/
char *U_EMRRECTANGLE_set(
){
}
// U_EMRROUNDRECT_set 44
/**
\brief Allocate and construct a U_EMR_ROUNDRECT record.
\return pointer to U_EMR_ROUNDRECT record, or NULL on error.
\param rclBox bounding rectangle in logical units
\param szlCorner W & H in logical units of ellipse used to round corner
*/
char *U_EMRROUNDRECT_set(
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRROUNDRECT);
if(record){
}
return(record);
}
// U_EMRARC_set 45
/**
\brief Allocate and construct a U_EMR_ARC record.
\return pointer to U_EMR_ARC record, or NULL on error.
\param rclBox bounding rectangle in logical units
\param ptlStart Start point in logical units
\param ptlEnd End point in logical units
*/
char *U_EMRARC_set(
){
}
// U_EMRCHORD_set 46
/**
\brief Allocate and construct a U_EMR_CHORD record.
\return pointer to U_EMR_CHORD record, or NULL on error.
\param rclBox bounding rectangle in logical units
\param ptlStart Start point in logical units
\param ptlEnd End point in logical units
*/
char *U_EMRCHORD_set(
){
}
// U_EMRPIE_set 47
/**
\brief Allocate and construct a U_EMR_PIE record.
\return pointer to U_EMR_PIE record, or NULL on error.
\param rclBox bounding rectangle in logical units
\param ptlStart Start point in logical units
\param ptlEnd End point in logical units
*/
char *U_EMRPIE_set(
){
}
// U_EMRSELECTPALETTE_set 48
/**
\brief Allocate and construct a U_EMR_SELECTPALETTE record.
\return pointer to U_EMR_SELECTPALETTE record, or NULL on error.
\param ihPal Index of a Palette object in the EMF object table
*/
char *U_EMRSELECTPALETTE_set(
){
}
// U_EMRCREATEPALETTE_set 49
/**
\brief Allocate and construct a U_EMR_CREATEPALETTE record.
Use createpalette_set() instead of calling this function directly.
\return pointer to U_EMR_CREATEPALETTE record, or NULL on error.
\param ihPal Index to place object in EMF object table (this entry must not yet exist)
\param lgpl Palette properties
*/
char *U_EMRCREATEPALETTE_set(
const U_LOGPALETTE lgpl
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRCREATEPALETTE);
if(record){
}
return(record);
}
// U_EMRSETPALETTEENTRIES_set 50
/**
\brief Allocate and construct a U_EMR_SETPALETTEENTRIES record.
Use setpaletteentries_set() instead of calling this function directly.
\return pointer to U_EMR_SETPALETTEENTRIES record, or NULL on error.
\param ihPal Index of a Palette object in the EMF object table
\param iStart First Palette entry in selected object to set
\param cEntries Number of Palette entries in selected object to set
\param aPalEntries Values to set with
*/
char *U_EMRSETPALETTEENTRIES_set(
const U_NUM_LOGPLTNTRY cEntries,
const PU_LOGPLTNTRY aPalEntries
){
char *record;
int irecsize;
int cbPals;
if(!aPalEntries)return(NULL);
if(record){
}
return(record);
}
// U_EMRRESIZEPALETTE_set 51
/**
\brief Allocate and construct a U_EMR_RESIZEPALETTE record.
\return pointer to U_EMR_RESIZEPALETTE record, or NULL on error.
\param ihPal Index of a Palette object in the EMF object table
\param cEntries Number to expand or truncate the Palette entry list to
*/
char *U_EMRRESIZEPALETTE_set(
){
}
// U_EMRREALIZEPALETTE_set 52
/**
\brief Allocate and construct a U_EMR_REALIZEPALETTE record.
\return pointer to U_EMR_REALIZEPALETTE record, or NULL on error.
*/
char *U_EMRREALIZEPALETTE_set(void){
return(U_EMR_CORE5(U_EMR_REALIZEPALETTE));
}
// U_EMREXTFLOODFILL_set 53
/**
\brief Allocate and construct a U_EMR_EXTFLOODFILL record.
\return pointer to U_EMR_EXTFLOODFILL record, or NULL on error.
\param ptlStart Start point in logical units
\param crColor Color to fill with
\param iMode FloodFill Enumeration
*/
char *U_EMREXTFLOODFILL_set(
const U_COLORREF crColor,
){
char *record;
int irecsize;
irecsize = sizeof(U_EMREXTFLOODFILL);
if(record){
}
return(record);
}
// U_EMRLINETO_set 54
/**
\brief Allocate and construct a U_EMR_LINETO record.
\return pointer to U_EMR_LINETO record, or NULL on error.
\param ptl Point coordinates
*/
char *U_EMRLINETO_set(
){
}
// U_EMRARCTO_set 55
/**
\brief Allocate and construct a U_EMR_ARCTO record.
\return pointer to U_EMR_ARCTO record, or NULL on error.
\param rclBox bounding rectangle in logical units
\param ptlStart Start point in logical units
\param ptlEnd End point in logical units
Note that the draw begins with a line from the current point to ptlStart, which is
not indicated in the Microsoft EMF documentation for this record.
*/
char *U_EMRARCTO_set(
){
}
// U_EMRPOLYDRAW_set 56
/**
\brief Allocate and construct a U_EMR_POLYDRAW record.
\return pointer to U_EMR_POLYDRAW record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cptl Number of U_POINTL objects
\param aptl Array of U_POINTL objects
\param abTypes Array of Point Enumeration
*/
char *U_EMRPOLYDRAW_set(
const U_NUM_POINTL cptl,
){
char *record;
int irecsize;
if(record){
if(cbAbTypes4 > cbAbTypes){ memset(record+off,0,cbAbTypes4-cbAbTypes); } // keeps valgrind happy (initialize padding after byte array)
}
return(record);
}
// U_EMRSETARCDIRECTION_set 57
/**
\brief Allocate and construct a U_EMR_SETARCDIRECTION record.
\return pointer to U_EMR_SETARCDIRECTION record, or NULL on error.
\param iArcDirection ArcDirection Enumeration
*/
char *U_EMRSETARCDIRECTION_set(
const uint32_t iArcDirection
){
}
// U_EMRSETMITERLIMIT_set 58
/**
\brief Allocate and construct a U_EMR_SETMITERLIMIT record.
\return pointer to U_EMR_SETMITERLIMIT record, or NULL on error.
\param eMiterLimit MapMode Enumeration
*/
char *U_EMRSETMITERLIMIT_set(
const uint32_t eMiterLimit
){
}
// U_EMRBEGINPATH_set 59
/**
\brief Allocate and construct a U_EMR_BEGINPATH record.
\return pointer to U_EMR_BEGINPATH record, or NULL on error.
*/
char *U_EMRBEGINPATH_set(void){
return(U_EMR_CORE5(U_EMR_BEGINPATH));
}
// U_EMRENDPATH_set 60
/**
\brief Allocate and construct a U_EMR_ENDPATH record.
\return pointer to U_EMR_ENDPATH record, or NULL on error.
*/
char *U_EMRENDPATH_set(void){
return(U_EMR_CORE5(U_EMR_ENDPATH));
}
// U_EMRCLOSEFIGURE_set 61
/**
\brief Allocate and construct a U_EMR_CLOSEFIGURE record.
\return pointer to U_EMR_CLOSEFIGURE record, or NULL on error.
*/
char *U_EMRCLOSEFIGURE_set(void){
return(U_EMR_CORE5(U_EMR_CLOSEFIGURE));
}
// U_EMRFILLPATH_set 62
/**
\brief Allocate and construct a U_EMR_FILLPATH record.
\return pointer to U_EMR_FILLPATH record, or NULL on error.
\param rclBox Bounding rectangle in device units
U_EMR_FILLPATH closes the open figure before filling.
*/
char *U_EMRFILLPATH_set(
){
}
// U_EMRSTROKEANDFILLPATH_set 63
/**
\brief Allocate and construct a U_EMR_STROKEANDFILLPATH record.
\return pointer to U_EMR_STROKEANDFILLPATH record, or NULL on error.
\param rclBox Bounding rectangle in device units
U_EMR_STROKEANDFILLPATH closes the open figure before filling and stroking.
There appears to be no way to fill an open path while stroking it, as any one
of U_EMRFILLPATH, U_EMRSTROKEPATH, or U_EMRSTROKEANDFILEPATH will "use up" the path,
*/
char *U_EMRSTROKEANDFILLPATH_set(
){
}
// U_EMRSTROKEPATH_set 64
/**
\brief Allocate and construct a U_EMR_STROKEPATH record.
\return pointer to U_EMR_STROKEPATH record, or NULL on error.
\param rclBox Bounding rectangle in device units
U_EMR_STROKEPATH does NOT close the open figure before stroking it.
*/
char *U_EMRSTROKEPATH_set(
){
}
// U_EMRFLATTENPATH_set 65
/**
\brief Allocate and construct a U_EMR_FLATTENPATH record.
\return pointer to U_EMR_FLATTENPATH record, or NULL on error.
*/
char *U_EMRFLATTENPATH_set(void){
return(U_EMR_CORE5(U_EMR_FLATTENPATH));
}
// U_EMRWIDENPATH_set 66
/**
\brief Allocate and construct a U_EMR_WIDENPATH record.
\return pointer to U_EMR_WIDENPATH record, or NULL on error.
*/
char *U_EMRWIDENPATH_set(void){
return(U_EMR_CORE5(U_EMR_WIDENPATH));
}
// U_EMRSELECTCLIPPATH_set 67
/**
\brief Allocate and construct a U_EMR_SELECTCLIPPATH record.
\return pointer to U_EMR_SELECTCLIPPATH record, or NULL on error.
\param iMode RegionMode Enumeration
*/
char *U_EMRSELECTCLIPPATH_set(
){
}
// U_EMRABORTPATH_set 68
/**
\brief Allocate and construct a U_EMR_ABORTPATH record.
\return pointer to U_EMR_ABORTPATH record, or NULL on error.
*/
char *U_EMRABORTPATH_set(void){
return(U_EMR_CORE5(U_EMR_ABORTPATH));
}
// U_EMRUNDEF69 69
// U_EMRCOMMENT_set 70 Comment (any binary data, interpretation is program specific)
/**
\brief Allocate and construct a U_EMR_COMMENT record.
\return pointer to U_EMR_COMMENT record, or NULL on error.
\param cbData Number of bytes in comment
\param Data Comment (any binary data, interpretation is program specific)
*/
char *U_EMRCOMMENT_set(
const char *Data
){
char *record;
unsigned int cbData4;
int irecsize;
if(record){
if(cbData4 > cbData)memset(record + irecsize - cbData4 + cbData,0,cbData4-cbData); // clear any unused bytes
}
return(record);
}
// U_EMRFILLRGN_set 71
/**
\brief Allocate and construct a U_EMR_FILLRGN record.
Use fillrgn_set() instead of calling this function directly.
\return pointer to U_EMR_FILLRGN record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param ihBrush Index of a Brush object in the EMF object table
\param RgnData Pointer to a U_RGNDATA structure
*/
char *U_EMRFILLRGN_set(
const PU_RGNDATA RgnData
){
char *record;
int irecsize;
if(record){
}
return(record);
}
// U_EMRFRAMERGN_set 72
/**
\brief Allocate and construct a U_EMR_FRAMERGN record.
Use framegrn_set() instead of calling this function directly.
\return pointer to U_EMR_FRAMERGN record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param ihBrush Index of a Brush object in the EMF object table
\param szlStroke W & H of Brush stroke
\param RgnData Pointer to a U_RGNDATA structure
*/
char *U_EMRFRAMERGN_set(
const PU_RGNDATA RgnData
){
char *record;
int irecsize;
if(record){
((PU_EMRFRAMERGN) record)->rclBounds = rclBounds; // or ??? ((PU_RGNDATAHEADER) RgnData)->rclBounds;
}
return(record);
}
// U_EMRINVERTRGN_set 73
/**
\brief Allocate and construct a U_EMR_INVERTRGN record.
\return pointer to U_EMR_INVERTRGN record, or NULL on error.
\param RgnData Variable size U_RGNDATA structure
*/
char *U_EMRINVERTRGN_set(
const PU_RGNDATA RgnData
){
}
// U_EMRPAINTRGN_set 74
/**
\brief Allocate and construct a U_EMR_PAINTRGN record.
\return pointer to U_EMR_PAINTRGN record, or NULL on error.
\param RgnData Variable size U_RGNDATA structure
*/
char *U_EMRPAINTRGN_set(
const PU_RGNDATA RgnData
){
}
// U_EMREXTSELECTCLIPRGN_set 75
/**
\brief Allocate and construct a U_EMR_EXTSELECTCLIPRGN record.
\return pointer to U_EMR_EXTSELECTCLIPRGN or NULL on error.
\param iMode RegionMode Enumeration
\param RgnData Variable size U_RGNDATA structure
*/
char *U_EMREXTSELECTCLIPRGN_set(
const PU_RGNDATA RgnData
){
char *record;
int irecsize;
irecsize = sizeof(U_EMREXTSELECTCLIPRGN) + cbRgns4 - sizeof(U_RGNDATAHEADER); // core + array - overlap
if(record){
}
return(record);
}
// U_EMRBITBLT_set 76
/**
\brief Allocate and construct a U_EMR_BITBLT record.
\return pointer to U_EMR_BITBLT record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination width in logical units
\param Src Source rectangle UL corner in logical units
\param xformSrc Source bitmap transform (world to page coordinates)
\param crBkColorSrc Source bitmap background color
\param iUsageSrc DIBcolors Enumeration
\param dwRop Ternary Raster Operation enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRBITBLT_set(
const U_COLORREF crBkColorSrc,
const PU_BITMAPINFO Bmi,
char *Px
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRBITBLT);
}
return(record);
}
// U_EMRSTRETCHBLT_set 77
/**
\brief Allocate and construct a U_EMR_STRETCHBLT record.
\return pointer to U_EMR_STRETCHBLT record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination width in logical units
\param Src Source UL corner in logical units
\param cSrc Src W & H in logical units
\param xformSrc Transform to apply to source
\param crBkColorSrc Background color
\param iUsageSrc DIBcolors Enumeration
\param dwRop Ternary Raster Operation enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRSTRETCHBLT_set(
const U_COLORREF crBkColorSrc,
const PU_BITMAPINFO Bmi,
char *Px
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRSTRETCHBLT);
}
return(record);
}
// U_EMRMASKBLT_set 78
/**
\brief Allocate and construct a U_EMR_MASKBLT record.
\return pointer to U_EMR_MASKBLT record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination width in logical units
\param Src Source UL corner in logical units
\param xformSrc Transform to apply to source
\param crBkColorSrc Background color
\param iUsageSrc DIBcolors Enumeration
\param Mask Mask UL corner in logical units
\param iUsageMask DIBcolors Enumeration
\param dwRop Ternary Raster Operation enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
\param MskBmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbMsk Size in bytes of mask array (row stride * height, there may be some padding at the end of each row)
\param Msk (Optional) bitmapbuffer (mask section )
*/
char *U_EMRMASKBLT_set(
const U_COLORREF crBkColorSrc,
const uint32_t iUsageMask,
const PU_BITMAPINFO Bmi,
char *Px,
const PU_BITMAPINFO MskBmi,
char *Msk
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRMASKBLT);
}
return(record);
}
// U_EMRPLGBLT_set 79
/**
\brief Allocate and construct a U_EMRPLGBLT record.
\return U_EMRPLGBLT record.
\param rclBounds Bounding rectangle in device units
\param aptlDst Defines parallelogram, UL, UR, LL corners, LR is derived (3 points)
\param Src Source UL corner in logical units
\param cSrc Source width in logical units
\param xformSrc Transform to apply to source
\param crBkColorSrc Background color
\param iUsageSrc DIBcolors Enumeration
\param Mask Mask UL corner in logical units
\param iUsageMask DIBcolors Enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
\param MskBmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbMsk Size in bytes of mask array (row stride * height, there may be some padding at the end of each row)
\param Msk (Optional) bitmapbuffer (mask section )
*/
char *U_EMRPLGBLT_set(
const U_COLORREF crBkColorSrc,
const uint32_t iUsageMask,
const PU_BITMAPINFO Bmi,
char *Px,
const PU_BITMAPINFO MskBmi,
char *Msk
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRPLGBLT);
}
return(record);
}
// U_EMRSETDIBITSTODEVICE_set 80
/**
\brief Allocate and construct a U_EMR_SETDIBITSTODEVICE record.
\return pointer to U_EMR_SETDIBITSTODEVICE record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param Src Source UL corner in logical units
\param cSrc Source W & H in logical units
\param iUsageSrc DIBColors Enumeration
\param iStartScan First scan line
\param cScans Number of scan lines
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRSETDIBITSTODEVICE_set(
const uint32_t iStartScan,
const PU_BITMAPINFO Bmi,
char *Px
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRSETDIBITSTODEVICE);
}
return(record);
}
// U_EMRSTRETCHDIBITS_set 81
/**
\brief Allocate and construct a U_EMR_EMRSTRETCHDIBITS record.
\return pointer to U_EMR_EMRSTRETCHDIBITS record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination W & H in logical units
\param Src Source UL corner in logical units
\param cSrc Source W & H in logical units
\param iUsageSrc DIBColors Enumeration
\param dwRop RasterOPeration Enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row STRIDE * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRSTRETCHDIBITS_set(
const PU_BITMAPINFO Bmi,
char *Px
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMRSTRETCHDIBITS);
}
return(record);
}
// U_EMREXTCREATEFONTINDIRECTW_set 82
/**
\brief Allocate and construct a U_EMR_EXTCREATEFONTINDIRECTW record.
Use extcreatefontindirectw_set() instead of calling this function directly.
\return pointer to U_EMR_EXTCREATEFONTINDIRECTW record, or NULL on error.
\param ihFont Index of the font in the EMF object table
\param elf Font parameters as U_LOGFONT
\param elfw Font parameters as U_LOGFONT_PANOSE
*/
const char * elf,
const char * elfw
){
char *record;
const char *cptr;
int irecsize;
if(record){
}
return(record);
}
// U_EMREXTTEXTOUTA_set 83
/**
\brief Allocate and construct a U_EMR_EXTTEXTOUTA record.
\return pointer to U_EMR_EXTTEXTOUTA record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param iGraphicsMode Graphics mode Enumeration
\param exScale scale to 0.01 mm units ( only if iGraphicsMode & GM_COMPATIBLE)
\param eyScale scale to 0.01 mm units ( only if iGraphicsMode & GM_COMPATIBLE)
\param emrtext Text parameters
*/
char *U_EMREXTTEXTOUTA_set(
const uint32_t iGraphicsMode,
const PU_EMRTEXT emrtext
){
}
// U_EMREXTTEXTOUTW_set 84
/**
\brief Allocate and construct a U_EMR_EXTTEXTOUTW record.
\return pointer to U_EMR_EXTTEXTOUTW record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param iGraphicsMode Graphics mode Enumeration
\param exScale scale to 0.01 mm units ( only if iGraphicsMode & GM_COMPATIBLE)
\param eyScale scale to 0.01 mm units ( only if iGraphicsMode & GM_COMPATIBLE)
\param emrtext Text parameters
*/
char *U_EMREXTTEXTOUTW_set(
const uint32_t iGraphicsMode,
const PU_EMRTEXT emrtext
){
}
// U_EMRPOLYBEZIER16_set 85
/**
\brief Allocate and construct a U_EMR_POLYBEZIER16 record.
\return pointer to U_EMR_POLYBEZIER16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYBEZIER16_set(
){
}
// U_EMRPOLYGON16_set 86
/**
\brief Allocate and construct a U_EMR_POLYGON16 record.
\return pointer to U_EMR_POLYGON16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYGON16_set(
){
}
// U_EMRPOLYLINE16_set 87
/**
\brief Allocate and construct a U_EMR_POLYLINE16 record.
\return pointer to U_EMR_POLYLINE16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYLINE16_set(
){
}
// U_EMRPOLYBEZIERTO16_set 88
/**
\brief Allocate and construct a U_EMR_POLYBEZIERTO record.
\return pointer to U_EMR_POLYBEZIERTO record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYBEZIERTO16_set(
){
}
// U_EMRPOLYLINETO16_set 89
/**
\brief Allocate and construct a U_EMR_POLYLINETO record.
\return pointer to U_EMR_POLYLINETO record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYLINETO16_set(
){
}
// U_EMRPOLYPOLYLINE16_set 90
/**
\brief Allocate and construct a U_EMR_POLYPOLYLINE16 record.
\return pointer to U_EMR_POLYPOLYLINE16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param nPolys Number of elements in aPolyCounts
\param aPolyCounts Number of points in each poly (sequential)
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYPOLYLINE16_set(
const uint32_t *aPolyCounts,
){
}
// U_EMRPOLYPOLYGON16_set 91
/**
\brief Allocate and construct a U_EMR_POLYPOLYGON16 record.
\return pointer to U_EMR_POLYPOLYGON16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param nPolys Number of elements in aPolyCounts
\param aPolyCounts Number of points in each poly (sequential)
\param cpts Number of POINT16 in array
\param points Array of POINT16
*/
char *U_EMRPOLYPOLYGON16_set(
const uint32_t *aPolyCounts,
){
}
// U_EMRPOLYDRAW16_set 92
/**
\brief Allocate and construct a U_EMR_POLYDRAW16 record.
\return pointer to U_EMR_POLYDRAW16 record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param cpts Number of U_POINTL objects
\param aptl Array of U_POINTL objects
\param abTypes Array of Point Enumeration
*/
char *U_EMRPOLYDRAW16_set(
const U_NUM_POINT16 cpts,
){
char *record;
int irecsize;
if(record){
if(cbAbTypes4 > cbAbTypes){ memset(record+off,0,cbAbTypes4-cbAbTypes); } // keeps valgrind happy (initialize padding after byte array)
}
return(record);
}
// U_EMRCREATEMONOBRUSH_set 93
/**
\brief Allocate and construct a U_EMR_CREATEMONOBRUSH record.
\return pointer to U_EMR_CREATEMONOBRUSH record, or NULL on error.
\param ihBrush Index to place object in EMF object table (this entry must not yet exist)
\param iUsage DIBcolors Enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO + pixel array)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRCREATEMONOBRUSH_set(
const PU_BITMAPINFO Bmi,
const char *Px
){
}
// U_EMRCREATEDIBPATTERNBRUSHPT_set 94
/**
\brief Allocate and construct a U_EMR_CREATEDIBPATTERNBRUSHPT record.
Use createdibpatternbrushpt_set() instead of calling this function directly.
\return pointer to U_EMR_CREATEDIBPATTERNBRUSHPT record, or NULL on error.
\param ihBrush Index to place object in EMF object table (this entry must not yet exist)
\param iUsage DIBcolors Enumeration
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO + pixel array)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
const PU_BITMAPINFO Bmi,
const char *Px
){
}
// U_EMREXTCREATEPEN_set 95
/**
\brief Allocate and construct a U_EMR_EXTCREATEPEN record.
Use extcreatepen_set() instead of calling this function directly.
\return pointer to U_EMR_EXTCREATEPEN record, or NULL on error.
\param ihPen ihPen Index to place object in EMF object table (this entry must not yet exist)
\param Bmi Bmi bitmapbuffer
\param cbPx cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px Px pixel array (NULL if cbPx == 0)
\param elp elp Pen parameters (Size is Variable!!!!)
*/
char *U_EMREXTCREATEPEN_set(
const PU_BITMAPINFO Bmi,
char *Px,
const PU_EXTLOGPEN elp
){
char *record;
cbStyleArray = elp->elpNumEntries * sizeof(U_STYLEENTRY); // space actually used by penstyle entries
// EXTLOGPEN is already included in EMREXTCREATEPEN, including the possibly unused first penstyle entry
if(cbStyleArray){
}
else {
}
if(record){
if(cbStyleArray){
}
else {
off = sizeof(U_EMREXTCREATEPEN);
}
// Cannot use APPEND_PXBMISRC here because there is no "Src" in the field names
if(cbBmi){
}
else {
}
}
return(record);
}
// U_EMRPOLYTEXTOUTA_set 96 NOT IMPLEMENTED, denigrated after Windows NT
// U_EMRPOLYTEXTOUTW_set 97 NOT IMPLEMENTED, denigrated after Windows NT
// U_EMRSETICMMODE_set 98
/**
\brief Allocate and construct a U_EMR_SETICMMODE record.
\return pointer to U_EMR_SETICMMODE record, or NULL on error.
\param iMode ICMMode Enumeration
*/
char *U_EMRSETICMMODE_set(
){
}
// U_EMRCREATECOLORSPACE_set 99
/**
\brief Allocate and construct a U_EMR_CREATECOLORSPACE record.
Use createcolorspace_set() instead of calling this function directly.
\return pointer to U_EMR_CREATECOLORSPACE record, or NULL on error.
\param ihCS Index to place object in EMF object table (this entry must not yet exist)
\param lcs ColorSpace parameters
*/
char *U_EMRCREATECOLORSPACE_set(
const U_LOGCOLORSPACEA lcs
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRCREATECOLORSPACE);
if(record){
}
return(record);
}
// U_EMRSETCOLORSPACE_set 100
/**
\brief Allocate and construct a U_EMR_SETCOLORSPACE record.
\return pointer to U_EMR_SETCOLORSPACE record, or NULL on error.
\param ihCS Index of object in EMF object table
*/
char *U_EMRSETCOLORSPACE_set(
){
}
// U_EMRDELETECOLORSPACE_set 101
/**
\brief Allocate and construct a U_EMR_DELETECOLORSPACE record.
\return pointer to U_EMR_DELETECOLORSPACE record, or NULL on error.
\param ihCS Index of object in EMF object table
*/
char *U_EMRDELETECOLORSPACE_set(
){
}
// U_EMRGLSRECORD_set 102 Not implemented
// U_EMRGLSBOUNDEDRECORD_set 103 Not implemented
// U_EMRPIXELFORMAT_set 104
/**
\brief Allocate and construct a U_EMR_PIXELFORMAT record.
\return pointer to U_EMR_PIXELFORMAT record, or NULL on error.
\param pfd PixelFormatDescriptor
*/
char *U_EMRPIXELFORMAT_set(
const U_PIXELFORMATDESCRIPTOR pfd
){
char *record;
int irecsize;
irecsize = sizeof(U_EMRPIXELFORMAT);
if(record){
}
return(record);
}
// U_EMRDRAWESCAPE_set 105 Not implemented
// U_EMREXTESCAPE_set 106 Not implemented
// U_EMRUNDEF107_set 107 Not implemented
// U_EMRSMALLTEXTOUT_set 108
/**
\brief Allocate and construct a U_EMR_SMALLTEXTOUT record.
\return pointer to U_EMR_SMALLTEXTOUT record, or NULL on error.
\param Dest Where to draw the text
\param cChars Characters in TextString (not null terminated)
\param fuOptions ExtTextOutOptions Enumeration
\param iGraphicsMode GraphicsMode Enumeration
\param exScale scale on X axis
\param eyScale scale on Y axis
\param rclBounds OPTIONAL Bounding rectangle (absent when: fuOPtions & ETO_NO_U_RECT)
\param TextString text to output (fuOptions & ETO_SMALL_CHARS ? 8 bit : 16 bit)
*/
char *U_EMRSMALLTEXTOUT_set(
const uint32_t iGraphicsMode,
const char *TextString
){
char *record;
int csize;
else { csize = 2; }
if(record){
if(cbRectl){
}
}
}
return(record);
}
// U_EMRFORCEUFIMAPPING_set 109 Not implemented
// U_EMRNAMEDESCAPE_set 110 Not implemented
// U_EMRCOLORCORRECTPALETTE_set 111 Not implemented
// U_EMRSETICMPROFILEA_set 112 Not implemented
// U_EMRSETICMPROFILEW_set 113 Not implemented
// U_EMRALPHABLEND_set 114
/**
\brief Allocate and construct a U_EMR_ALPHABLEND record.
\return pointer to U_EMR_ALPHABLEND record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination width in logical units
\param Src Source UL corner in logical units
\param cSrc Src W & H in logical units
\param xformSrc Transform to apply to source
\param crBkColorSrc Background color
\param iUsageSrc DIBcolors Enumeration
\param Blend Blend function
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRALPHABLEND_set(
const U_COLORREF crBkColorSrc,
const PU_BITMAPINFO Bmi,
char *Px
){
return(U_EMR_CORE13_set(U_EMR_ALPHABLEND,rclBounds,Dest,cDest,Src,cSrc,xformSrc,crBkColorSrc,iUsageSrc,*((uint32_t *) &Blend),Bmi,cbPx,Px));
}
// U_EMRSETLAYOUT_set 115
/**
\brief Allocate and construct a U_EMR_SETLAYOUT record.
\return pointer to U_EMR_SETLAYOUT record, or NULL on error.
\param iMode Mirroring Enumeration
*/
}
// U_EMRTRANSPARENTBLT_set 116
/**
\brief Allocate and construct a U_EMR_TRANSPARENTBLT record.
\return pointer to U_EMR_TRANSPARENTBLT record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param Dest Destination UL corner in logical units
\param cDest Destination width in logical units
\param Src Source UL corner in logical units
\param cSrc Src W & H in logical units
\param xformSrc Transform to apply to source
\param crBkColorSrc Background color
\param iUsageSrc DIBcolors Enumeration
\param TColor Bitmap color to be treated as transparent
\param Bmi (Optional) bitmapbuffer (U_BITMAPINFO section)
\param cbPx Size in bytes of pixel array (row stride * height, there may be some padding at the end of each row)
\param Px (Optional) bitmapbuffer (pixel array section )
*/
char *U_EMRTRANSPARENTBLT_set(
const U_COLORREF crBkColorSrc,
const PU_BITMAPINFO Bmi,
char *Px
){
return(U_EMR_CORE13_set(U_EMR_TRANSPARENTBLT,rclBounds,Dest,cDest,Src,cSrc,xformSrc,crBkColorSrc,iUsageSrc,TColor,Bmi,cbPx,Px));
}
// U_EMRUNDEF117_set 117 Not implemented
// U_EMRGRADIENTFILL_set 118
/**
\brief Allocate and construct a U_EMR_TRANSPARENTBLT record.
\return pointer to U_EMR_TRANSPARENTBLT record, or NULL on error.
\param rclBounds Bounding rectangle in device units
\param nTriVert Number of TriVertex objects in TriVert
\param TriVert Array of TriVertex objects
\param GradObj Array of gradient objects (each has 2 [rect] or 3 [triangle] indices into TriVert array)
*/
char *U_EMRGRADIENTFILL_set(
const U_NUM_TRIVERTEX nTriVert,
const U_NUM_GRADOBJ nGradObj,
const PU_TRIVERTEX TriVert,
){
char *record;
int irecsize;
else if(ulMode == U_GRADIENT_FILL_RECT_H ||
else { return(NULL); }
if(record){
}
return(record);
}
// U_EMRSETLINKEDUFIS_set 119 Not implemented
// U_EMRSETTEXTJUSTIFICATION_set 120 Not implemented (denigrated)
// U_EMRCOLORMATCHTOTARGETW_set 121 Not implemented
// U_EMRCREATECOLORSPACEW_set 122
/**
\brief Allocate and construct a U_EMR_CREATECOLORSPACEW record.
Use createcolorspacew_set() instead of calling this function directly.
\return pointer to U_EMR_CREATECOLORSPACEW record, or NULL on error.
\param ihCS Index to place object in EMF object table (this entry must not yet exist)
\param lcs ColorSpace parameters
\param dwFlags If low bit set Data is present
\param cbData Number of bytes of theData field.
\param Data (Optional, dwFlags & 1) color profile data
*/
char *U_EMRCREATECOLORSPACEW_set(
const U_LOGCOLORSPACEW lcs,
){
char *record;
int irecsize;
if(record){
off = sizeof(U_EMR) + sizeof(uint32_t) + sizeof(U_LOGCOLORSPACEW) + sizeof(uint32_t) + sizeof(U_CBDATA); // offset to Data field
}
}
return(record);
}
#ifdef __cplusplus
}
#endif