home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4725 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.4 KB  |  56 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: Re: How do I rotate text or a bitmap?
  5. Message-ID: <1993Jan8.004357.11383@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. References: <1993Jan7.211926.11912@physics.ucla.edu>
  8. Date: Fri, 8 Jan 1993 00:43:57 GMT
  9. Lines: 45
  10.  
  11. In article <1993Jan7.211926.11912@physics.ucla.edu> mmccarri@physics.ucla.edu (Mike McCarrick) writes:
  12. >I could rotate a bitmap pixel by pixel, but it seems like a
  13. >lot of work given the various color formats.  Is there an
  14. >easier (and faster) way?
  15.     No, you can not draw rotated bitmaps in Windows 3.1.
  16.     Apparently you will be able to in Windows NT.
  17.  
  18. >Speaking of bitmaps, I am drawing a large, multi-color bitmap
  19. >(a frequeny-time spectrogram) using the Rectangle() function
  20. >to fill in each df dt block.  This also seems like too much 
  21. >work since I have to create a pen and a brush with the desired
  22. >color, select these objects, draw the rectangle, and then delete
  23. >both objects.  This is repeated 100,000 times or so and is very
  24. >slow.  I experimented with the SetPixel() function instead, but
  25. >it is even slower!  Also, SetPixel() will not dither the color
  26. >if I am running on a paletteless display.  Any suggestions?
  27.  
  28.     You missed my recent post on this subject.  I
  29.     was doing the same thing you are doing and experimented
  30.     with ways of making it faster.  Scan backwards on
  31.     your newsreader to see if the summary is still on
  32.     your machine.  I also provided the test program I
  33.     used.  mail me if you can't find the post
  34.  
  35.     What you want to do is fill your rectangles with
  36.     PatBlt, not Rectangle or FillRect.  Also, despite
  37.     the warnings about not wasting resources, you can
  38.     create quite a few brushes (just don't leave them
  39.     hanging around for very long).  I'm using 256
  40.     colours to draw a grid file.  First I create a table
  41.     of 256 hbrush values.  Then I loop through the
  42.     grid, selecting each brush and doing a PatBlt.
  43.     At the end of the whole ordeal, I just delete
  44.     the table of 256 brushes.
  45.  
  46.     SetPixel will choose the closest solid colour that
  47.     your device is capable of displaying.  If you have
  48.     a standard 16-colour VGA display, the best you
  49.     will get is 16 colours with SetPixel.  Besides,
  50.     how can it produce a dithered pattern with a
  51.     single pixel?
  52. -- 
  53. John A. Grant                        jagrant@emr1.emr.ca
  54. Airborne Geophysics
  55. Geological Survey of Canada, Ottawa
  56.