home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!hm329sc@duc220.uni-duisburg.de
- From: hm329sc@unidui.uni-duisburg.de (Scheunemann)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: StretchDIBits and one other question...
- Date: 14 Sep 1992 18:15:08 +0200
- Organization: Universitaet Duisburg GH
- Lines: 43
- Distribution: world
- Message-ID: <hm329sc.716483147@duc220>
- References: <1992Sep13.231220.686@twisto.eng.hou.compaq.com>
- NNTP-Posting-Host: unidui.uni-duisburg.de
-
- In <1992Sep13.231220.686@twisto.eng.hou.compaq.com> mccreary@sword.eng.hou.compaq.com (Ed McCreary) writes:
-
- >I'm having an odd problem with StretchDIBits (and SetDIBitsToDevice also.)
-
- >I'm using it do display grey scale images but for some reason it
- >doesn't seem to work with certain dimensions. Here's a code fragment:
-
- > lpbmi = (LPBITMAPINFO)GlobalLock(hbmi);
- > lpImageBits = (char huge *)GlobalLock(hImageBits);
-
-
- > i=StretchDIBits(hdc, 0, 0,
- > nZoomFactor*nImageWidth,
- > nZoomFactor*nImageHeight,
- > 0, 0, nImageWidth, nImageHeight,
- > lpImageBits, lpbmi,
- > DIB_RGB_COLORS, SRCCOPY);
-
- >nZoomFactor is an integer used to perform a quick and dirty zoom on
- >the image. The rest should be self explanatory. Now it works fine with
- >images with dimensions of 200x200 and 800x800, but when I try 130x130
- >or 255x210 it fails. It returns 0 meaning 0 lines displayed.
-
- >I've checked all of the variables right before the function is called,
- >and they all are correct, yet it still fails!! I'd appreciate any
- >hints.
-
- I had the same problem using StrectDIBits. For certain dimensions the
- function just returned 0. In my case the reason for this was, that each
- line of the image had to be expanded to a multiple of 4 byte (adding some
- zero bytes if neccessary). Somehow StretchDIBits seems to check the size
- of the image (which is in the BITMAPINFO) against a value which it calculates
- itself and if it finds a difference it apparently does nothing.
-
- Hope this helps
- Thomas Scheunemann
-
-
-
-
-
-
-
-