Article View: comp.os.ms-windows.programmer.misc
Article #2583Re: How do I rotate text or a bitmap?
From: John Grant
Date: Fri, 08 Jan 1993 00:43
Date: Fri, 08 Jan 1993 00:43
45 lines
2559 bytes
2559 bytes
In article <1993Jan7.211926.11912@physics.ucla.edu> mmccarri@physics.ucla.edu (Mike McCarrick) writes: >I could rotate a bitmap pixel by pixel, but it seems like a >lot of work given the various color formats. Is there an >easier (and faster) way? No, you can not draw rotated bitmaps in Windows 3.1. Apparently you will be able to in Windows NT. >Speaking of bitmaps, I am drawing a large, multi-color bitmap >(a frequeny-time spectrogram) using the Rectangle() function >to fill in each df dt block. This also seems like too much >work since I have to create a pen and a brush with the desired >color, select these objects, draw the rectangle, and then delete >both objects. This is repeated 100,000 times or so and is very >slow. I experimented with the SetPixel() function instead, but >it is even slower! Also, SetPixel() will not dither the color >if I am running on a paletteless display. Any suggestions? You missed my recent post on this subject. I was doing the same thing you are doing and experimented with ways of making it faster. Scan backwards on your newsreader to see if the summary is still on your machine. I also provided the test program I used. mail me if you can't find the post What you want to do is fill your rectangles with PatBlt, not Rectangle or FillRect. Also, despite the warnings about not wasting resources, you can create quite a few brushes (just don't leave them hanging around for very long). I'm using 256 colours to draw a grid file. First I create a table of 256 hbrush values. Then I loop through the grid, selecting each brush and doing a PatBlt. At the end of the whole ordeal, I just delete the table of 256 brushes. SetPixel will choose the closest solid colour that your device is capable of displaying. If you have a standard 16-colour VGA display, the best you will get is 16 colours with SetPixel. Besides, how can it produce a dithered pattern with a single pixel? -- John A. Grant jagrant@emr1.emr.ca Airborne Geophysics Geological Survey of Canada, Ottawa
Technical Details
Message-ID:
<1993Jan8.004357.11383@emr1.emr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrantReferences:
<1993Jan7.211926.11912@physics.ucla.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant From: jagrant@emr1.emr.ca (John Grant) Subject: Re: How do I rotate text or a bitmap? Message-ID: <1993Jan8.004357.11383@emr1.emr.ca> Organization: Energy, Mines, and Resources, Ottawa References: <1993Jan7.211926.11912@physics.ucla.edu> Date: Fri, 8 Jan 1993 00:43:57 GMT Lines: 45