OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TMetaFilePict Class Reference

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>

Inheritance diagram for owl::TMetaFilePict:
owl::TGdiBase

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);.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TMetaFilePict() [1/6]

owl::TMetaFilePict::TMetaFilePict ( HMETAFILE handle,
TAutoDelete autoDelete )

Creates a TMetaFilePict object using the given handle argument.

Definition at line 45 of file metafile.cpp.

◆ TMetaFilePict() [2/6]

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.

◆ TMetaFilePict() [3/6]

◆ TMetaFilePict() [4/6]

owl::TMetaFilePict::TMetaFilePict ( uint size,
void * data )

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().

◆ TMetaFilePict() [5/6]

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().

◆ TMetaFilePict() [6/6]

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().

◆ ~TMetaFilePict()

owl::TMetaFilePict::~TMetaFilePict ( )

Deletes the metafile.

Definition at line 195 of file metafile.cpp.

References owl::TGdiBase::Handle, and owl::TGdiBase::ShouldDelete.

Member Function Documentation

◆ CalcHeaderChecksum()

uint16 owl::TMetaFilePict::CalcHeaderChecksum ( const METAFILEHEADER & mfHeader)
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.

◆ CalcPlaySize()

TSize owl::TMetaFilePict::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.

Definition at line 244 of file metafile.cpp.

References owl::TDC::GetDeviceCaps(), WARNX, owl::TSize::X(), and owl::TSize::Y().

◆ GetMetaFileBitsEx()

uint32 owl::TMetaFilePict::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.

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.

◆ GetPlaceableHeader()

bool owl::TMetaFilePict::GetPlaceableHeader ( METAFILEHEADER & header)
inline

Definition at line 212 of file metafile.h.

References IsPlaceable().

◆ Height()

int owl::TMetaFilePict::Height ( ) const
inline

Returns the height of the metafile.

Definition at line 256 of file metafile.h.

◆ IsPlaceable()

bool owl::TMetaFilePict::IsPlaceable ( )
inline

Definition at line 204 of file metafile.h.

◆ MappingMode()

uint owl::TMetaFilePict::MappingMode ( ) const
inline

Returns the mapping mode of the metafile.

Definition at line 242 of file metafile.h.

◆ operator HMETAFILE()

owl::TMetaFilePict::operator HMETAFILE ( ) const
inline

Returns the associated handle for the metafile object.

Definition at line 196 of file metafile.h.

◆ PlayOnto()

bool owl::TMetaFilePict::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.

Does not save dc state.

Definition at line 292 of file metafile.cpp.

References CalcPlaySize(), owl::TDC::SetMapMode(), and owl::TDC::SetViewportExt().

◆ SetMappingMode()

void owl::TMetaFilePict::SetMappingMode ( uint mm)
inline

Sets the mapping mode for the metafile.

Definition at line 270 of file metafile.h.

◆ SetPlaceableHeader()

void owl::TMetaFilePict::SetPlaceableHeader ( TRect & bounds,
uint16 unitsPerInch )
inline

◆ SetSize()

void owl::TMetaFilePict::SetSize ( const TSize & size)
inline

Sets the size of the metafile.

Definition at line 277 of file metafile.h.

◆ Size()

TSize owl::TMetaFilePict::Size ( ) const
inline

Returns the size of the metafile.

Definition at line 263 of file metafile.h.

◆ ToClipboard()

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.

◆ Width()

int owl::TMetaFilePict::Width ( ) const
inline

Returns the width of the metafile.

Definition at line 249 of file metafile.h.


The documentation for this class was generated from the following files: