![]() |
OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TMetaFilePict is a support class used with TMetaFileDC to simplify metafile operations, such as playing into a device context (DC) or storing data on the Clipboard. More...
#include <owl/metafile.h>
Public Member Functions | |
TMetaFilePict (HMETAFILE handle, TAutoDelete autoDelete) | |
Creates a TMetaFilePict object using the given handle argument. | |
TMetaFilePict (const TClipboard &clipboard) | |
Constructs a TMetaFilePict that represents the metafilepict on the clipboard. | |
TMetaFilePict (const tstring &filename) | |
Creates a TMetaFilePict object for the metafile stored in the named file. | |
TMetaFilePict (uint size, void *data) | |
Creates a TMetaFilePict object for the memory-based metafile specified by data. | |
TMetaFilePict (const TMetaFilePict &, LPCTSTR fileName=nullptr) | |
Copies the metafile src to the named file. | |
TMetaFilePict (const TMetaFilePict &, const tstring &fileName) | |
String-aware overload If the filename is empty, the metafile is copied to a memory-based metafile. | |
~TMetaFilePict () | |
Deletes the metafile. | |
operator HMETAFILE () const | |
Returns the associated handle for the metafile object. | |
uint32 | GetMetaFileBitsEx (uint size, void *data) |
Retrieves the contents of the metafile associated with this object and copies them (up to size bytes) to the data buffer. | |
TSize | CalcPlaySize (TDC &dc, const TSize &defSize) const |
Calculates target play size based on info from the metafilepict (if any) and default target size as necessary. | |
bool | PlayOnto (TDC &dc, const TSize &defSize) const |
Plays this metafile onto a dc, possibly using a default size if this metafile doesn't have one. | |
void | ToClipboard (TClipboard &clipboard, uint mapMode=MM_ANISOTROPIC, const TSize &extent=TSize(0, 0)) |
Moves this metafile to the clipboard inside of a metafilepict struct. | |
uint | MappingMode () const |
Returns the mapping mode of the metafile. | |
int | Width () const |
Returns the width of the metafile. | |
int | Height () const |
Returns the height of the metafile. | |
TSize | Size () const |
Returns the size of the metafile. | |
void | SetMappingMode (uint mm) |
Sets the mapping mode for the metafile. | |
void | SetSize (const TSize &size) |
Sets the size of the metafile. | |
bool | IsPlaceable () |
bool | GetPlaceableHeader (METAFILEHEADER &header) |
void | SetPlaceableHeader (TRect &bounds, uint16 unitsPerInch) |
Warning: values in the bounds rectangle will be cast to unsigned int values. | |
Protected Member Functions | |
uint16 | CalcHeaderChecksum (const METAFILEHEADER &mfHeader) |
BGM consider adding these, as in TDib: BGM Write(ostream& os, bool writeFileHeader = false); BGM Write(TFile& file, bool writeFileHeader = false);. | |
TMetaFilePict is a support class used with TMetaFileDC to simplify metafile operations, such as playing into a device context (DC) or storing data on the Clipboard.
TMetaFilePict automatically handles the conversion between a metafile and a metafilepict.
Definition at line 80 of file metafile.h.
owl::TMetaFilePict::TMetaFilePict | ( | HMETAFILE | handle, |
TAutoDelete | autoDelete ) |
Creates a TMetaFilePict object using the given handle argument.
Definition at line 45 of file metafile.cpp.
owl::TMetaFilePict::TMetaFilePict | ( | const TClipboard & | clipboard | ) |
Constructs a TMetaFilePict that represents the metafilepict on the clipboard.
Should be copied if metafile needs to be kept.
Definition at line 127 of file metafile.cpp.
References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and owl::TGdiBase::ShouldDelete.
owl::TMetaFilePict::TMetaFilePict | ( | const tstring & | filename | ) |
Creates a TMetaFilePict object for the metafile stored in the named file.
Definition at line 57 of file metafile.cpp.
References owl::METAFILEHEADER::bbox, owl::boLittle_Endian, owl::RECT16::bottom, CalcHeaderChecksum(), owl::METAFILEHEADER::checksum, owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, owl::METAFILEHEADER::inch, owl::METAFILEHEADER::key, owl::RECT16::left, owl::TFile::OpenExisting, owl::TFile::PermRead, owl::TXOutOfMemory::Raise(), owl::TFile::ReadOnly, owl::RECT16::right, owl::TGdiBase::ShouldDelete, owl::TFileStatus::size, and owl::RECT16::top.
Creates a TMetaFilePict object for the memory-based metafile specified by data.
The data buffer must hold a metafile of length size bytes.
Definition at line 153 of file metafile.cpp.
References owl::TGdiBase::CheckValid().
owl::TMetaFilePict::TMetaFilePict | ( | const TMetaFilePict & | src, |
LPCTSTR | fileName = nullptr ) |
Copies the metafile src to the named file.
If filename is 0 (the default), the metafile is copied to a memory-based metafile.
Definition at line 168 of file metafile.cpp.
References owl::TGdiBase::CheckValid().
owl::TMetaFilePict::TMetaFilePict | ( | const TMetaFilePict & | src, |
const tstring & | fileName ) |
String-aware overload If the filename is empty, the metafile is copied to a memory-based metafile.
Definition at line 182 of file metafile.cpp.
References owl::TGdiBase::CheckValid().
owl::TMetaFilePict::~TMetaFilePict | ( | ) |
Deletes the metafile.
Definition at line 195 of file metafile.cpp.
References owl::TGdiBase::Handle, and owl::TGdiBase::ShouldDelete.
|
protected |
BGM consider adding these, as in TDib: BGM Write(ostream& os, bool writeFileHeader = false); BGM Write(TFile& file, bool writeFileHeader = false);.
Reads the fields in the file header structure of a placeable metafile and computes a checksum value for verifying the header's integrity.
Definition at line 207 of file metafile.cpp.
Calculates target play size based on info from the metafilepict (if any) and default target size as necessary.
Definition at line 244 of file metafile.cpp.
References owl::TDC::GetDeviceCaps(), WARNX, owl::TSize::X(), and owl::TSize::Y().
Retrieves the contents of the metafile associated with this object and copies them (up to size bytes) to the data buffer.
If data is nonzero and the call succeeds, the actual number of bytes copied is returned. If data is 0, a successful call returns the number of bytes required by the buffer. A return value of 0 always indicates a failure.
Definition at line 233 of file metafile.cpp.
References owl::TGdiBase::Handle.
|
inline |
Definition at line 212 of file metafile.h.
References IsPlaceable().
|
inline |
Returns the height of the metafile.
Definition at line 256 of file metafile.h.
|
inline |
Definition at line 204 of file metafile.h.
|
inline |
Returns the mapping mode of the metafile.
Definition at line 242 of file metafile.h.
|
inline |
Returns the associated handle for the metafile object.
Definition at line 196 of file metafile.h.
Plays this metafile onto a dc, possibly using a default size if this metafile doesn't have one.
Does not save dc state.
Definition at line 292 of file metafile.cpp.
References CalcPlaySize(), owl::TDC::SetMapMode(), and owl::TDC::SetViewportExt().
Sets the mapping mode for the metafile.
Definition at line 270 of file metafile.h.
Warning: values in the bounds rectangle will be cast to unsigned int values.
Definition at line 226 of file metafile.h.
References owl::METAFILEHEADER::bbox, owl::RECT16::bottom, CalcHeaderChecksum(), owl::METAFILEHEADER::checksum, owl::METAFILEHEADER::inch, owl::METAFILEHEADER::key, owl::RECT16::left, owl::METAFILEHEADER::reserved, owl::RECT16::right, and owl::RECT16::top.
Sets the size of the metafile.
Definition at line 277 of file metafile.h.
|
inline |
Returns the size of the metafile.
Definition at line 263 of file metafile.h.
void owl::TMetaFilePict::ToClipboard | ( | TClipboard & | clipboard, |
uint | mapMode = MM_ANISOTROPIC, | ||
const TSize & | extent = TSize(0,0) ) |
Moves this metafile to the clipboard inside of a metafilepict struct.
Ownership of the metafilepict as well as the metafile is passed to the clipboard.
Definition at line 314 of file metafile.cpp.
References owl::TGdiBase::Handle, owl::TXOutOfMemory::Raise(), owl::TClipboard::SetClipboardData(), and owl::TGdiBase::ShouldDelete.
|
inline |
Returns the width of the metafile.
Definition at line 249 of file metafile.h.