Author Topic: Icon Factory  (Read 121 times)

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Icon Factory
« on: August 31, 2019, 05:18:06 AM »
The Icon Utility in my main graphics program "ShowPicture" has saved it's first png icon!
Shown in Ram Disk: is the IconFactory.info file.
The small window to the right is the "Icon Display Window".
It is a "Point-Click" display. When the user clicks in the window, if image1 is showing, image2 is diplayed, etc.
It also has an "Icon Menu" attached to the "Icon Display Window".


The Icon Functions in ShowPicture will also become the standalone Icon Utility called "Icon Factory"
I will be able to:
1. Open an existing "png icon" or "new icon" (glowicon) and save the images or load new ones.
    (loading new images doesn't affect the original icon file).
2. Create a new "png icon" or a new "new icon" (glowicon) by inserting images and saving the icon file.


salvatore

  • Senior Member
  • ****
  • Posts: 443
  • Karma: +2/-0
  • Jazz Frethless Bass Player
Re: Icon Factory
« Reply #1 on: August 31, 2019, 05:35:21 AM »
well man :)
Tiny Aros on Atom N270 ThinClient Full Supporting

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Re: Icon Factory
« Reply #2 on: September 01, 2019, 06:20:30 AM »
The icon image functions also work correctly with IFF images as well as PNG images.

So once "im1.dat" and "im2.dat" are exported to "Ram Disk:" the program doesn't care
whether they are PNG or IFF. They are treated the same as far as showing in the Icon Display Window
and Saving Icon Images.

The only major problem at the moment is that my function "ExportIconImages" isn't exporting images
correctly. So I must manually copy im1.dat and im2.dat to Ram Disk. ExportIconImages has to be able
to read the file signature to discern between  PNG or IFF icon files then it must export images accordingly.
I might also consider holding the images in picture datatype structures in memory rather as actual files.
Also, currently I can only save png icon files, not iff icon files. But saving both types is my ultimate goal.

With one of my other graphics programs I'm working on Color Quantizing to reduce 32bit and 24bit to 8bit.
One of the conversion functions will then Save 8bit as 5bit ILBM. So that internally it will be possible to
convert between 32bit png and 5bit iff icon images. The image quality may be sufficiently good for iff if
there aren't too many colors in the original png images and depending on the quantizing algorithm I use.
Going the other way to convert 5bit iff to 32bit png is already possible. It is a two step process. First use
ShowPicture to open the 5bitplane ilbm which then automatically gets converted to 8bit for display purposes.
Save as 8bit Png. Open the 8bit Png and convert bitdepth "8bit-32bit" and save again as Png. Conversion done!

ExportIconImages must work correctly for the icon functions to work as expected, but also I'd like to be
able to open any png or iff icon (glowicon) and save the icon images to png files or iff files for editing.

o1i

  • Newbie
  • *
  • Posts: 22
  • Karma: +1/-0
Re: Icon Factory
« Reply #3 on: September 01, 2019, 09:12:46 AM »
IFF IMG datatype can't save images. Didn't investigate any further.  PNG can.

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Re: Icon Factory
« Reply #4 on: September 01, 2019, 09:17:23 AM »
IFF IMG datatype can't save images. Didn't investigate any further.  PNG can.

Save As IFF doesn't work for you? Can you be more specific.

If you mean that the AROS ILBM Picture Datatype lacks a Save Function, yes I know.

I can save IFF images.







« Last Edit: September 01, 2019, 09:22:15 AM by miker1264 »

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Re: Icon Factory
« Reply #5 on: September 01, 2019, 10:12:35 AM »
For ExportIconImages I have two methods. If it's a png icon file I use a technique to read each png chunk till I find 'IEND'. I do that for both images then export them as separate png files. It works.

But the second method is for iff icon files. I have to study the Amiga Icon Formats for GlowIcons. To export the images I have to find the New Icon Data string that starts with "***" three asterisks. After that follows the OS 3.5 Extension. The width and height is there before the IM data. Not sure if the image data is planar with rle compression. The colormap data follows the image data. So I would have to reconstruct the iff bmhd, the cmap and copy the planar body data.

That can all be done by using a hex editor and examining some glowicons to export images. I'll have to work in reverse to actually write an iff icon by deconstructing the iff image file and writing the data in the right locations in the iff icon file. It's not that complicated. It's just very tedious work.

I'm sure this has already been done many times by other people in the past but I'd like to have the joy of discovering these techniques for myself. ;-)

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Re: Icon Factory
« Reply #6 on: September 03, 2019, 06:58:59 PM »
ExportIconImages for PNG Icons works but I'm currently using picture datatypes. I'd like to use a modified function called Copy-Data instead that will be more efficient exportion png images.

For exporting images from IFF Icon Files (GlowIcons) I may use a similar method to what Magellan uses in "icon.c" whic is GetDiskObject. The image data is all contained in do->Gadget. I'll also need a method to export the ColorMap for each IFF Icon Image. In order to Save IFF Icons the CLI proram ILBM2icon may serve as a guide but ILBM2ICON currently doesn't work - bad hunk or chunk, whatever it's called. I might modify the CLI program so it works correctly as a first step.

I spent about 8 hours on the icon functions this weekend. It may take another 4 hours to finish. Then I can use the underlying code to write a new program "Icon Factory". It might take another 16 hours to make the new program with a Zune GUI.

Whew! Lots of work to do! ;-)

salvatore

  • Senior Member
  • ****
  • Posts: 443
  • Karma: +2/-0
  • Jazz Frethless Bass Player
Re: Icon Factory
« Reply #7 on: September 03, 2019, 07:04:28 PM »
great miker ;)
Tiny Aros on Atom N270 ThinClient Full Supporting

miker1264

  • Member
  • ***
  • Posts: 157
  • Karma: +7/-1
Re: Icon Factory
« Reply #8 on: September 05, 2019, 07:11:13 AM »
First Re-Made Icon using Icon Utility and Overlay Masking to preserve the Glow Border of Second Image.
Any Icon opened becomes the Icon Template. If a PNG Icon is opened, only PNG Images can be Loaded.
To change the Icon Template, simply Load Icon. Icon can be either a PNG Icon or a IFF Icon (GlowIcon).

I'm also working on a new technique for Overlay Masking called Copy Mask. Anything under the Overlay
in the original image will be copied to the new image in the same location. This will be useful in making
composite images or composite icon images where we can copy parts of other icon images in new ones.

Satisfied that the PNG Icons are working correctly, moving on to Load, Display & Save Images for IFF's.
I will be trying to use this approach for GlowIcons.

//Get icon struct
icon = GetDiskObject(filepath);

//Get icon image pointers
image[0] = (struct Image *)icon->do_Gadget.GadgetRender;
image[1] = (struct Image *)icon->do_Gadget.SelectRender;
   
//image->Width;
//image->Height;
//image->Depth;
//image->ImageData;

Assuming that the ImageData is actually a continuous buffer of planar image data,
it would seem easier to export the ilbm images than it was to export png images.
« Last Edit: September 05, 2019, 07:42:43 AM by miker1264 »