home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!cs.utexas.edu!wotan.compaq.com!twisto.eng.hou.compaq.com!sword.eng.hou.compaq.com!mccreary
- From: mccreary@sword.eng.hou.compaq.com (Ed McCreary)
- Subject: StretchDIBits and one other question...
- Message-ID: <1992Sep13.231220.686@twisto.eng.hou.compaq.com>
- Sender: news@twisto.eng.hou.compaq.com (Netnews Account)
- Organization: Compaq Computer Corp.
- Date: Sun, 13 Sep 1992 23:12:20 GMT
- Lines: 50
-
- 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.
-
- The second question is with how to store the image data in memory.
- Currently I'm using a (char huge *) pointing to a global memory.
- This is for an image processing package to it's nice to have the
- data readily available for processing and display.
-
- This works fine and I can access the data sequentially, say
-
- char huge *ptr;
- ptr = (char huge *)GlobalLock(hImageBits);
- for(i=0;i<40000;i++)
- ptr++; // for a 200x200 image.
-
- this works fine. The problem occurs when I try to access a byte
- in the middle. ptr+=20000 directly instead of moving through all of
- the data. Is this a problem with the way I'm trying to access
- the memory or do I need to rethink the way I store it.
-
- Any hints would greatly appreciated.
-
-
- --
- McCreary@sword.eng.hou.compaq.com Computers are like Old Testament gods;
- Me? Speak for Compaq? Yeah, right. lots of rules and no mercy.
- Joseph Campbell
-
-