0

I would swear that I read somewhere that there's a way to cause GDI calls to treat x,y coordinates differently than the default. For instance, instead of x,y=0,0 being upper left, you could put 0,0 in the lower left, or any other corner.

I've tried digging through my books, and it's too slippery to google effectively, at least with any of the words I've brought to bear. Anyone have any ideas how to do this?

JustJeff
  • 12,640
  • 5
  • 49
  • 63

2 Answers2

2

Use SetMapMode to change this, MM_TEXT is closer to pixel coordinates, MM_METRIC, MM_LOMETRIC etc... are closer to paper coordinates and have an inverted y axis.

See also GDI mapping modes explained

SmacL
  • 22,555
  • 12
  • 95
  • 149
  • 1
    Your link is broken I think. you can also setviewportorgex() to remap the origin from (0,0) to another point. – Alex K. Jun 15 '11 at 10:53
  • This approach seems mainly about translation and scaling, i.e., sliding the origin around, and telling windows your GDI is talking pixel units or inches or mm, etc. Inverting Y is getting closer to what I'm after, but I thought there was a more general way. – JustJeff Jun 16 '11 at 23:52
  • JustJeff, SetWorldTransform() would also do the trick as you say, but I haven't used it as I'm already carrying out 3d transforms prior to hitting the GDI. This also makes the code more portable to other rendering situations. Re mapping models, look up MM_ANISOTROPIC, http://www.codeguru.com/forum/showthread.php?t=145167 – SmacL Jun 17 '11 at 07:45
0

You're probably thinking about the SetViewportOrgEx function.

GSerg
  • 76,472
  • 17
  • 159
  • 346