home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_2.iso / files / 651.lha / fixicon / fixicon.doc.pp / fixicon.doc
Text File  |  1992-07-05  |  4KB  |  73 lines

  1.  
  2. FixIcon by Robert Lang 15th June 1991.
  3. ~~~~~~~
  4.  
  5. WB2 allows users to do what many PD utilities have been doing sometime, and
  6. that is to set more than 4 colours on the workbench.  Its quite impressive
  7. to see 8 and 16 colour icons about the place, and if its a luxury you can
  8. use, why not ?
  9.  
  10. The problem is, some icons which look great under 4 colour workbench, but show
  11. garbage colours over the top of themselves when used on more bitplanes.
  12.  
  13. After some messing about, I found the source of the problem, and a small
  14. explanation follows :
  15.  
  16. Images use a neat trick when displaying planes, a trick that can save a lot
  17. of image data through the use of two elements of the Image Structure, called
  18. PlanePick and PlaneOnOff.
  19.  
  20. You supply data to the image, in the form of planes according to the size of
  21. the image.  The PlanePick has flags to indicate which planes on the screen
  22. your data will go to.
  23.  
  24. For example : if PlanePick has the lower bits 00101, then your first image
  25. of data will go into Plane 0 of the screen it is being shown on, since that
  26. 1 is on for that plane, and the second image of data will go to Plane 2 of the
  27. screen, since Plane 1's bit is OFF, and the next ON bit is Plane 2.
  28.  
  29. So how does it know what to do with Plane 1 ?  The corresponding bit of
  30. PlaneOnOff is checked, and if it is 1, then all the bits in that plane are set
  31. to 1, otherwise they are set to 0.  Hence we can set whole planes on or off
  32. without having to include their space-wasting image data...very clever !
  33.  
  34. So whats the problem ?  Perhaps its obvious to some already, but some icons
  35. when created by questionable means (PD utilities ???) end up with PlanePick
  36. as 255 (all 1's) and PlaneOnOff as 0 (all 0's).  Hence ALL the data must be
  37. included for the image.  But what if we have made a 2 bit plane image and they
  38. are using a 3 bit plane screen ?  Bad luck, the icon library is only doing what
  39. it is told, after all.
  40.  
  41. So all my program does is check that PlanePick matches the depth of the icon.
  42. Hence if the icon has depth 2, I reset the PlanePick to depth 2 and the other
  43. planes will be set to 1 or 0 depending on the PlaneOnOff field.  Note that this
  44. could cause extra problems, but my program was initially setting these to zero
  45. and I found some people were taking advantage of the trick to set the plane to
  46. 1 and hence I was losing my image. (My Shell icon, the standard Commodore WB2
  47. one, does this...neato !)  Hence I removed this from the program, and haven't
  48. found a problem yet, although it could easily be fixed if found.
  49.  
  50. I've included the source, since there's not much to it, really.  The sweat was
  51. spilt in locating the cause of the problem, not fixing it.  The source should
  52. provide a good example of accessing icon data, since once the DiskObject is
  53. loaded (Note that WBObjects are obsolete from WB2, so use DiskObjects) you have
  54. access to all information like tool lists, image data, the works !  You could
  55. easily write a stat program to tell you the size of an image in pixels.
  56.  
  57. FixIcon may redistributed for NO PROFIT more than PD charges as per Megadisc
  58. current prices, and only if this doc file, the source, and the executable are
  59. together and UNALTERED.  I hold all copyrights to this work, but give you
  60. permission to read and learn from the source, and to distribute it freely.
  61. (ie. for FREE).
  62.  
  63. If you have any comments, questions, hints, tips, or large sums of spendable
  64. money, write to :
  65.  
  66.             Robert Lang
  67.             P.O. Box 127
  68.             CARDIFF NSW 2285
  69.             AUSTRALIA
  70.  
  71. Enjoy !
  72.  
  73.