Thread: Dots versus pixels and pixel to postscript point conversion

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    Dots versus pixels and pixel to postscript point conversion

    This may be a bit out of scope for this message board, but I may gain some insights from more experienced programmers on this topic as well as their experiences with the documentation. I'm basically trying to convert from the coordinate system that a printer driver deals with to a postscript point. Basically the printer driver declares its coordinate system and dimensions in:

    DrvEnablePDEV (http://msdn.microsoft.com/en-us/library/ms793408.aspx)
    (GDIINFO is documented in http://msdn.microsoft.com/en-us/library/ms798469.aspx)
    - GDIINFO::ulHorzSize and GDIINFO::ulVertSize
    - GDIINFO::ulHorzRes and GDIINFO::ulVertRes
    - GDIINFO::ulLogPixels_ - dpi
    DrvEnableSurface (http://msdn.microsoft.com/en-us/library/ms793770.aspx)
    - SIZEL structure

    From what I understand, it appears that Microsoft Windows printer drivers intend to use dots as the dimensions. Are pixels and dots equivalent units (or am I even working with the right units from researching those documentations)? This would greatly help on the direction I should follow in the conversion.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You shouldn't care what they use. You will 'paint' your printed document to a device context in the same manner you 'paint' your window. So however you have the device context setup is how measurements/conversions are performed. There are many many ways to setup your DC and several different units of measure that Windows uses.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    Let me clarify the question since I think you misunderstood what I was asking. You were suggesting me to set up the DC in the client application in Windows. What I'm asking is about the units and the unit conversion taking place in the driver that the client application (which sets up the DC) is calling. Let me know if I'm still confusing you.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I don't know what kinds of conversions are going on in the driver. The 'driver' may just be the Windows API setting up the DC and passing the handle back to you. GDI+ is somewhat hardware accelerated but GDI is not.

    Not sure why you need this info. The Windows SDK is more than adequate to answer the question and will reveal several units of measure from twips to pixels.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 08:55 AM