tags:

views:

277

answers:

1

I have some C++/GDI drawing code that uses the isotropic mapping mode. I have a large object model with lots of drawing code that I'm trying to reuse in a C# project to draw to an in memory bitmap. I'm having problems setting up the System.Graphics object properly to produce the same picture. Is there any way of setting up the equivalent of the MM_ISOTROPIC mapping mode in a System.Graphics object?

Here is the relevant code from C++/GDI that prepares the mapping mode.

CDC* pDC = ...
pDC->SetMapMode(MM_ISOTROPIC); 
pDC->SetWindowExt(24, 24); 
pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));
A: 

There's nothing special about MM_ISOTROPIC, it just makes sure that the X- and Y-scaling is identical, even if you give it conflicting values with SetViewportExt() and SetWindowExt(). Which you don't. I don't think there's any hardware left that doesn't have square pixels.

Anyhoo, just make sure you pass equal values to Graphics.ScaleTransform().

Hans Passant
When was there hardware without square pixels?
bobobobo
When they were rectangular.
danbystrom