TABLE OF CONTENTS newicon.library/--Introduction-- newicon.library/FreeNewDiskObject newicon.library/FreeRemappedImage newicon.library/GetDefNewDiskObject newicon.library/GetNewDiskObject newicon.library/PutNewDiskObject newicon.library/RemapChunkyImage newicon.library/--Introduction-- newicon.library/--Introduction-- The goal behind newicon.library is to offer an interface for the application programmer wishing to directly support NewIcons, be it icon editors to Workbench replacements. This ensures that your product will be able to support NewIcons even if the Newicons executable isn't running. The standard procedure is to call GetNewDiskObject(), and check if any of the ndo_NormalImage or ndo_SelectedImage fields are NULL. If they are, then this icon has no newicon data, so you can use the ndo_StdObject pointer to access the regular DiskObject structure. If you have something in ndo_NormalImage and ndo_SelectedImage, then call RemapChunkyImage() on them to obtain Image structures remapped to the specified screen. If you know you're dealing with a chunky display, you might wish to handle the chunky data yourself, which would be more efficient than remapping to an Intuition Image structure and blitting back on your chunky screen. In that case, don't use RemapChunkyImage(), and handle the ndo_#?Image->ChunkyData yourself. Once you're done with your newicon, call FreeRemappedImage() on the remapped images to free them up (if you used RemapChunkyImage()). After that, call FreeNewDiskObject() on your NewDiskObject structure (even if you only used the DiskObject pointer from it!) to free it. newicon.library/FreeNewDiskObject newicon.library/FreeNewDiskObject NAME FreeNewDiskObject() -- Free all memory allocated in a NewDiskObject. SYNOPSIS FreeNewDiskObject(newdiskobj) A0 VOID FreeNewDiskObject(struct NewDiskObject *); FUNCTION Pretty much like the standard icon.library FreeDiskObject() call. It will deallocate any memory allocated for a NewDiskObject, and the object itself. This is the ONLY way to deallocate a NewDiskObject structure that has been allocated by GetNewDiskObject(). INPUTS newdiskobj -- A pointer to a NewDiskObject structure. RESULT None. SEE ALSO newicon.library/GetNewDiskObject(), icon.library/FreeDiskObject() newicon.library/FreeRemappedImage newicon.library/FreeRemappedImage NAME FreeRemappedImage() -- Frees a remapped image and its pens. SYNOPSIS FreeRemappedImage(image, screen) A0 A1 VOID FreeRemappedImage(struct Image *, struct Screen *) FUNCTION This function frees a remapped image and also frees its pens. Therefore you must call it only after you are done with the image: if you call it while it is still displayed on the screen, your image could see its colors mangled since the pens would be freed. You must supply a screen argument. It must either be the same passed to RemapChunkyImage, or NULL if the screen has been closed in the meantime, so the pens don't need to be released. INPUTS image -- A pointer to a remapped Image structure. screen -- A pointer to the Screen for which your ChunkyData was remapped, or NULL if the screen has been closed since then. RESULT None. SEE ALSO newicon.library/RemapChunkyImage() newicon.library/GetDefNewDiskObject newicon.library/GetDefNewDiskObject NAME GetDefNewDiskObject - read default disk object, with NewIcons support. (V40) SYNOPSIS newdiskobj = GetDefNewDiskObject(def_type) D0 D0 struct NewDiskObject *GetDefNewDiskObject(LONG); FUNCTION Pretty much like the standard icon.library GetDiskObject() call. In fact, it merely calls it, embedding the returned disk object in a NewDiskObject structure, with the NewIcons imagery if the default disk object had any. The valid def_types can be found in workbench/workbench.h and currently include WBDISK thru WBGARBAGE. If the call fails, it will return zero. The reason for the failure may be obtained via IoErr(). INPUTS def_type - default icon type (WBDISK thru WBKICK). Note that the define 'WBDEVICE' is not currently supported. RESULTS newdiskobj -- the default Workbench disk object in question SEE ALSO icon.library/GetDefDiskObject() newicon.library/GetNewDiskObject newicon.library/GetNewDiskObject NAME GetNewDiskObject() -- Read a disk object, with NewIcons support. SYNOPSIS newdiskobj = GetNewDiskObject(name) D0 A0 struct NewDiskObject *GetNewDiskObject(char *); FUNCTION Pretty much like the standard icon.library GetDiskObject() call. It will read the Workbench disk object specified in the name parameter, adding the ".info" suffix itself, and return a filled NewDiskObject structure. If the call fails, it returns zero. The reason for the failure can be obtained by calling IoError(). This routine can be used if you wish to obtain a standard diskobject, with separate pointers to NewIcons chunky data if there's NewIcons imageries present in the loaded disk object. No further processing is done (i.e. the chunky data aren't remapped, etc...) Once finished with it, you must use FreeNewDiskObject() to free the memory that was allocated for it. INPUTS name -- The name (char *) of the object (without the ".info" suffix). RESULT newdiskobj -- a filled NewDiskObject structure. You must call FreeNewDiskObject() once you're done with it. SEE ALSO newicon.library/FreeNewDiskObject(), newicon.library/RemapChunkyData(), icon.library/GetDiskObject() newicon.library/PutNewDiskObject newicon.library/PutNewDiskObject NAME PutNewDiskObject() -- write a NewDiskObject to disk. SYNOPSIS status = PutNewDiskObject(name, newdiskobj) D0 A0 A1 BOOL PutNewDiskObject(char *, struct NewDiskObject *); FUNCTION Pretty much like the standard icon.library PutDiskObject() call. This routine will write a NewDiskObject structure and its related information to disk as a standard icon, encoding the chunky data (if present in the structure) as NewIcons tooltypes in the process. The filename of the info file is specified as the name parameter, which will automaticaly get the ".info" suffix added. If the call fails, it returns zero. The reason for the failure can be obtained by calling IoError(). INPUTS name -- The name (* char) of the object (without the ".info" suffix). newdiskobj -- A pointer to a NewDiskObject structure. RESULT status -- TRUE if the call was successfull, else FALSE. SEE ALSO newicon.library/FreeNewDiskObject(), newicon.library/GetNewDiskObject(), icon.library/PutDiskObject() newicon.library/RemapChunkyImage newicon.library/RemapChunkyImage NAME RemapChunkyImage() -- Remaps a chunky image to be displayed on screen SYNOPSIS image = RemapChunkyImage(chunkyimage, screen) D0 A0 A1 struct Image *RemapChunkyImage(struct ChunkyImage *, struct Screen *); FUNCTION Remaps a ChunkyImage to be displayed on a screen. Caller must either be the owner of the screen, or have locked it. Under KS 3.0 (V39) and up, it will use ObtainBestPen() if screen has shareable pens. Otherwise will use the available colors. The image is returned as an Intuition Image structure, remapped so chunky data palette match as closely as possible with the target screen's palette, depending on the precision setting chosen by the user in the NewIconsPrefs editor, and the available pens. Once done with your image, you should call FreeRemappedImage() to free it and any allocated pens. INPUTS chunkydata -- A pointer to a ChunkyImage structure. screen -- A pointer to the destination Screen. RESULT Image -- An Intuition Image structure, or NULL if it fails. NOTES If the user has enabled the RTG Mode in the NewIconsPrefs, then the remapped image will be in Fast RAM (if there's any, else it will try to allocate Chip RAM instead). SEE ALSO newicon.library/FreeRemappedImage() .