preventing GDI+ from scaling images

Win32 Programming


  • 1. Win32 Halftone Functions
    Hi, I notice that print drivers, through the DDK, have access to some pretty neat halftone functions, with various halftone patters like these... HT_PATSIZE_2x2 HT_PATSIZE_2x2_M HT_PATSIZE_4x4 HT_PATSIZE_4x4_M HT_PATSIZE_6x6 HT_PATSIZE_6x6_M HT_PATSIZE_8x8 HT_PATSIZE_8x8_M HT_PATSIZE_10x10 HT_PATSIZE_10x10_M HT_PATSIZE_12x12 HT_PATSIZE_12x12_M HT_PATSIZE_14x14 HT_PATSIZE_14x14_M HT_PATSIZE_16x16 HT_PATSIZE_16x16_M HT_PATSIZE_SUPERCELL HT_PATSIZE_SUPERCELL_M HT_PATSIZE_AUTO Is it possible to access these same halftone patterns throguh the regular Win32 API or SDK? I am not writing a driver, but I am trying to add halftone capabilities to an old legacy C Win32 application, and I thought there might be a way to leverage these pre existing microsoft halftone functions in the app. Is it possible to get these same patterns through BitBlt, or StretchBlt, etc? Thanks in advance, Skeet

preventing GDI+ from scaling images

Postby ZG9jc2NobmlwcA » Sat, 20 Nov 2004 20:03:02 GMT


I am loading PNG files with the Gdiplus::Bitmap() constructor. To display 
them I create a CompatibleBitmap(). In case the resolution(DPI) of the 
bitmap/PNG does not match the resolution (DPI) of the screen context 
(accessed via Gdiplus::Graphics) the bitmaps are draw scaled. It only works 
"pixelwise" when the resolutions match.

I tried to call bitmap.SetResolution() but afterwards the 
Gdiplus::Graphics::DrawImage() function returns "InvalidParameter".

How can I make GDI+ ignoring the DPI within the file and just use pixels?

thanks for any help


RE: preventing GDI+ from scaling images

Postby ZG9jc2NobmlwcA » Sun, 21 Nov 2004 04:19:09 GMT

I'd like to add that I call this DrawImage() method:
  DrawImage(Image, dx,dy, sx,sy,sw,sh, UnitPixel);

which is the only suitable option in this case, since I need to draw only 
portions of the bitmap.


Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 2 guest