Hi,

During the heavy documentation update (nearly every method in GUI.xs has now
been documented) I noticed some confusing things regarding these:
Win32::GUI::CloseEnhMetaFile(HANDLE)
Win32::GUI::CreateEnhMetaFile(FILENAME, [DESCRIPTION])
Win32::GUI::DeleteEnhMetaFile(HANDLE)
Win32::GUI::PlayEnhMetaFile(FILENAME)
Win32::GUI::PlayWinMetaFile(FILENAME)

Now, CreateEnhMetaFile creates a DC for an Enhanced Meta File and returns a
*handle* to it. While I've secretly extended "new Win32::GUI::DC(...)" to
accept a numeric DC handle as well as a device string or window, I think
that returning a handle rather than a DC object from CreateEnhMetaFile is
counter-intuitive.

With my mod to the Win32::GUI::DC constructor, it is possible to do:

$metadc = new Win32::GUI::DC(CreateEnhMetaFile("hello.emf","test 123"));
$metadc->FillRect(0,0,100,100);
Win32::GUI::CloseEnhMetaFile($metadc);

I think this is still pretty damn nasty, and it would be nice to be able to
do:

$metadc = Win32::GUI::CreateEnhMetaFile("hello.emf","test 123");
$metadc->FillRect(0,0,100,100);
$metadc->CloseEnhMetaFile;

Basically, from a documentation point of view, I don't want to have to tell
the reader "Ok, this function returns a handle to a DC, which is not the
same as a DC object, so when dealing with the handle to the DC you must use
all DC functions in class form like
Win32::GUI::DC::FillRect($handle,$left,$top,$right,$bottom)" because that's
REALLY confusing and makes no sense.

Do you think it's safe to mod CreateEnhMetaFile so it returns a blessed DC
object instead of just a handle? Will this break anything? Opinions
please...

Steve



Reply via email to