[comp.sys.apple] custom icons question

hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) (06/01/89)

Question about IIGS toolbox programming:  How does one generate and use
custom icons in a program?  I have some fairly small (maybe 15 by 25 pixels)
shapes that I want to draw in a desktop program.  I tried plotting them point
by point but that is much too slow, so I guess using icons would probably be
the fastest way.  What I need to know is, after I generate the hex
representation, (from the icon editor IconEd), how do I actually make an icon
out of it, and then how do I print that icon on the screen?  Or would it be
easier to somehow read the icons in from a standard icon file?  I don't know.

I'm using TML Pascal so Pascal examples would be greatly appreciated, although
I also know C.  Thanks very much for any help.

-- Jeff Hartkopf

dlyons@Apple.COM (David Lyons) (06/02/89)

In article <9134@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) writes:
>[..] How does one generate and use
>custom icons in a program?  I have some fairly small (maybe 15 by 25 pixels)
>shapes that I want to draw in a desktop program.  I tried plotting them point
>by point but that is much too slow, so I guess using icons would probably be
>the fastest way.  What I need to know is, after I generate the hex
>representation, (from the icon editor IconEd), how do I actually make an icon
>out of it, and then how do I print that icon on the screen? [...]

The DrawIcon function in the QuickDraw Auxiliary toolset is one way.  I'm not
familiar with the output ("Save as Source"?) from IconEd, but DrawIcon takes
a pointer to the icon data, an x and y location, and a code specifying how to
color the icon & how to draw it (8 choices, corresponding to what the Finder
displays for selected/not selected, online/offline, and open/closed, in all
combinations).

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

mel@pro-pac.cts.com (Mel Miyaji) (06/03/89)

Network Comment: to #8734 by pnet01!crash!boulder.colorado.edu!tramp!hartkopf

Jeffrey,
        Have you heard of a program called "The Icon Editor" or TIE?
It can be found on GEnie or CompuServe it's a shareware pgm.  You can look at
the icons you have in your system and edit it or build your own icons and copy
it back into your system icon file.  It also edits in several colors.  I have
a copy if you'er interested if I can figure out how to upload it on this
system.
                                        Mel

jstich@pro-avalon.cts.com (Jonah Stich) (06/15/89)

hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes:
>for a DrawIcon icon) now, so if someone would be so kind as to summarize
>for me what it says on page 17-3 of Volume 2, I would be VERY grateful.

Okay, here goes (please excuse any typos, it's kinda late, and this seems to
be a noisy line). Page 17-3, section entitled "QuickDraw II Auxiliary icon
record" reads:

An icon is a small graphic object that is usually symbolic of an operation or
of a larger entity, such as a document. The QuickDraw II Auxiliary icon recore
indicates whether the icon is icolor or black and white, the size of the icon,
the height and width od the icon, the icon image, andthe mosk controlling the
appearance of the icon, as shown in Figure 17-1.

Note: At the time of publication, this record had not been included in the APW
interface file.

Offset  Field
$0 & $1 IconType        Word - Bit 15 set to 1 = color icon
                                      set to 0 = black and white icon
$2 & $3 IconSize        Word - INTEGER; number of bytes in icon image
$4 & $5 IconHeight      Word - INTEGER; height of icon in pixels
$6 & $7 IconWidth       Word - INTEGER; width of icon in pixels
$8 - $x IconImage       x Bytes - Icon image; IconsSize bytes long, each row
                                  of pixels is 1+ (IconWidth - 1)/2 bytes wide
$x - $y IconMask        (Same as above)

That's all there is on 17-3, 17-4 goes on to talk about how the displayMode,
hich controls how the iconMask is applied. Hope this has been of some help.

Jonah

-- jstich@pro-avalon

UUCP: crash!pro-nsfmat!pro-avalon!jstich
ARPA: crash!pro-nsfmat!pro-avalon!jstich@nosc.mil
INET: jstich@pro-avalon.cts.com