home *** CD-ROM | disk | FTP | other *** search
-
- FixIcon by Robert Lang 15th June 1991.
- ~~~~~~~
-
- WB2 allows users to do what many PD utilities have been doing sometime, and
- that is to set more than 4 colours on the workbench. Its quite impressive
- to see 8 and 16 colour icons about the place, and if its a luxury you can
- use, why not ?
-
- The problem is, some icons which look great under 4 colour workbench, but show
- garbage colours over the top of themselves when used on more bitplanes.
-
- After some messing about, I found the source of the problem, and a small
- explanation follows :
-
- Images use a neat trick when displaying planes, a trick that can save a lot
- of image data through the use of two elements of the Image Structure, called
- PlanePick and PlaneOnOff.
-
- You supply data to the image, in the form of planes according to the size of
- the image. The PlanePick has flags to indicate which planes on the screen
- your data will go to.
-
- For example : if PlanePick has the lower bits 00101, then your first image
- of data will go into Plane 0 of the screen it is being shown on, since that
- 1 is on for that plane, and the second image of data will go to Plane 2 of the
- screen, since Plane 1's bit is OFF, and the next ON bit is Plane 2.
-
- So how does it know what to do with Plane 1 ? The corresponding bit of
- PlaneOnOff is checked, and if it is 1, then all the bits in that plane are set
- to 1, otherwise they are set to 0. Hence we can set whole planes on or off
- without having to include their space-wasting image data...very clever !
-
- So whats the problem ? Perhaps its obvious to some already, but some icons
- when created by questionable means (PD utilities ???) end up with PlanePick
- as 255 (all 1's) and PlaneOnOff as 0 (all 0's). Hence ALL the data must be
- included for the image. But what if we have made a 2 bit plane image and they
- are using a 3 bit plane screen ? Bad luck, the icon library is only doing what
- it is told, after all.
-
- So all my program does is check that PlanePick matches the depth of the icon.
- Hence if the icon has depth 2, I reset the PlanePick to depth 2 and the other
- planes will be set to 1 or 0 depending on the PlaneOnOff field. Note that this
- could cause extra problems, but my program was initially setting these to zero
- and I found some people were taking advantage of the trick to set the plane to
- 1 and hence I was losing my image. (My Shell icon, the standard Commodore WB2
- one, does this...neato !) Hence I removed this from the program, and haven't
- found a problem yet, although it could easily be fixed if found.
-
- I've included the source, since there's not much to it, really. The sweat was
- spilt in locating the cause of the problem, not fixing it. The source should
- provide a good example of accessing icon data, since once the DiskObject is
- loaded (Note that WBObjects are obsolete from WB2, so use DiskObjects) you have
- access to all information like tool lists, image data, the works ! You could
- easily write a stat program to tell you the size of an image in pixels.
-
- FixIcon may redistributed for NO PROFIT more than PD charges as per Megadisc
- current prices, and only if this doc file, the source, and the executable are
- together and UNALTERED. I hold all copyrights to this work, but give you
- permission to read and learn from the source, and to distribute it freely.
- (ie. for FREE).
-
- If you have any comments, questions, hints, tips, or large sums of spendable
- money, write to :
-
- Robert Lang
- P.O. Box 127
- CARDIFF NSW 2285
- AUSTRALIA
-
- email until end-of-1992 : c8908461@jupiter.newcastle.edu.au
-
- Enjoy !
-
-