15#if defined(__BORLANDC__)
29const uint32 TMetaFilePict::MFHeaderKey = 0x9AC6CDD7L;
70 if ((MFHeader.key == MFHeaderKey)
81 HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, size);
85 file.
Read((
void *)pMem, size);
87 Handle = SetMetaFileBitsEx(size, pMem);
106 Extent.cx = MFHeader.bbox.right - MFHeader.bbox.left;
107 Extent.cy = MFHeader.bbox.bottom - MFHeader.bbox.top;
111 Extent.cx = MulDiv(Extent.cx, 2540, MFHeader.inch);
112 Extent.cy = MulDiv(Extent.cy, 2540, MFHeader.inch);
116 Handle = ::GetMetaFile(filename.c_str());
132 HGLOBAL hmfp = ::GetClipboardData(CF_METAFILEPICT);
133 METAFILEPICT * mfp = (METAFILEPICT *)::GlobalLock(hmfp);
137 Extent =
TSize(mfp->xExt, mfp->yExt);
139 ::GlobalUnlock(hmfp);
184 TGdiBase(::CopyMetaFile(src, fileName.empty() ? nullptr : fileName.c_str()),
AutoDelete),
198 ::DeleteMetaFile(HMETAFILE(
Handle));
212 for (lpw = (LPWORD)&header;
235 return ::GetMetaFileBitsEx(HMETAFILE(
Handle), size, (LPBYTE)data);
248 if (Mm != MM_ISOTROPIC && Mm != MM_ANISOTROPIC) {
249 WARNX(OwlGDI, (Extent.X() == 0) || (Extent.Y() == 0), 0,
"Constrained metafile extent == 0");
259 if (Extent.X() == 0) {
260 WARNX(OwlGDI, (defSize.
X() == 0) || (defSize.
Y() == 0), 0,
"Metafile using default extent == 0");
266 else if (Extent.cx > 0) {
275 long xscale = 100L * defSize.cx *
277 long yscale = 100L * defSize.cy *
279 long scale = std::min(xscale, yscale);
301 if ((Mm == MM_ISOTROPIC || Mm == MM_ANISOTROPIC) && Extent.cx && Extent.cy)
305 return ::PlayMetaFile(dc, *
this);
318 HGLOBAL hmfp = ::GlobalAlloc(GMEM_MOVEABLE,
sizeof(METAFILEPICT));
321 METAFILEPICT * mfp = (METAFILEPICT *)::GlobalLock(hmfp);
323 mfp->xExt = extent.cx;
324 mfp->yExt = extent.cy;
325 mfp->hMF = (HMETAFILE)
Handle;
326 ::GlobalUnlock(hmfp);
367 :
TGdiBase(::CopyEnhMetaFile(metafilepict, fileName.empty() ? nullptr : fileName.c_str()),
AutoDelete)
385 ::DeleteEnhMetaFile(HENHMETAFILE(
Handle));
394 return ::PlayEnhMetaFile(dc, *
this, rect);
#define WARNX(group, condition, level, message)
The clipboard class encapsulates the methods for the clipboard object of Windows.
HANDLE SetClipboardData(uint format, HANDLE handle)
Copy the data onto the clipboard in the format.
TDC is the root class for GDI DC wrappers.
virtual int GetDeviceCaps(int index) const
Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
virtual int SetMapMode(int mode)
Sets the current window mapping mode of this DC to mode.
virtual bool SetViewportExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's viewport x- and y-extents to the given extent values.
The TFile class encapsulates standard file characteristics and operations.
virtual bool Open(const tstring &fileName, const uint32 mode=ReadOnly|PermRead|OpenExisting)
Opens file name with the given mode.
@ OpenExisting
Opens the file. The function fails if the file does not exist.
@ PermRead
Subsequent open operations on the object will succeed only if read access is requested.
virtual uint32 Read(void *buffer, uint32 numBytes)
Reads numBytes from the file into buffer. The number of bytes read is returned.
uint ReadStruct(void *buffer, TBinType btype, TByteOrderType type)
Read binary predefined structure from file.
virtual bool Close()
Closes the file. Returns true if successful, false otherwise.
bool GetStatus(TFileStatus &status) const
Fills status with the current file status.
TGdiBase()
This default constructor sets Handle to 0 and ShouldDelete to true.
void CheckValid(uint resId=IDS_GDIFAILURE)
bool ShouldDelete
Should object delete GDI handle in dtor?
HANDLE Handle
GDI handle of this object.
TRect is a mathematical class derived from tagRect.
The tagSIZE struct is defined as.
int Y() const
Returns the height.
TSize()
Default constructor that does nothing.
int X() const
Returns the width.
Definition of classes for clipboard Encapsulation.
Definition of abstract GDI object class and derived classes.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
static void Raise()
Construct a TXOutOfMemory exception from scratch, and throw it.
@ boLittle_Endian
LSB at lowest address: Intel //.
Object Windows Library (OWLNext Core).
DIAG_DECLARE_GROUP(OwlThread)
ObjectWindows exception class & function definitions.
WORD checksum
XOR of previous fields.
The TBinField struct describes a group of like-typed fields in a structure to be read or written usin...