Author Topic: Icon Factory  (Read 229 times)

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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

  • Guest
Re: Icon Factory
« Reply #1 on: August 31, 2019, 05:35:21 AM »
well man :)

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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: 23
  • 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

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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

  • Guest
Re: Icon Factory
« Reply #7 on: September 03, 2019, 07:04:28 PM »
great miker ;)

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-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 »

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-1
Re: Icon Factory
« Reply #9 on: September 23, 2019, 08:04:56 AM »
I have received a reply from Fredrik Wikstrom about how to get an instance of image1 and image2 using INFO.datatype for IFF Icon Files.

Maybe I can use the datatype for PNG Icon Files

So now I can continue with Icon Factory for AROS.

salvatore

  • Guest
Re: Icon Factory
« Reply #10 on: September 23, 2019, 08:24:06 AM »
well miker :)

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-1
Re: Icon Factory
« Reply #11 on: October 15, 2019, 04:54:21 AM »
My work continues slowly on Icon Factory. I'm working on opening, loading and saving IFF Icon Files. PNG Icon Files already work.

I can now give a name to the icon style used here. It's called "Long Shadow Flat Icon". Notice a shadow on bottom of the icon?

These types of icons could easily be converted to 5 bitplane IFF Icons with a standard palette of 32 colors. But it's really only 16 primary colors and 16 shadow colors, similar to Amiga Format EHB.

In the future when AROS runs on touchscreen tablets these flat icons may be very popular.
« Last Edit: October 15, 2019, 01:47:37 PM by miker1264 »

wawa

  • Member
  • ***
  • Posts: 165
  • Karma: +0/-0
Re: Icon Factory
« Reply #12 on: October 15, 2019, 03:00:20 PM »
@miker
it doesnt look bad. it should though even convert to 2 plane 4 colors. ;P

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-1
Re: Icon Factory
« Reply #13 on: October 15, 2019, 03:29:22 PM »
These icons are very conducive to low color count palettes for IFF Icons or RGB for PNG Icons. I have another Flat Icon that I may use for another one of my proposed projects "Brazier ISO Burner" based on Brasero.

It's a pastel orange color. Having a predefined palette of 16 pastel colors makes it easier for making new icons. We start with the Pastel Square of our choice. Once we have a way to make and insert the white stencil and shadow we could quickly make several of these icons.

A window full of Flat Icons wouldn't look bad. If we had a feature for Wanderer such as Icon Text Wrap they would all stack nicely since they're all squares. Here's the other icon I'm working on.

miker1264

  • Senior Member
  • ****
  • Posts: 265
  • Karma: +11/-1
Re: Icon Factory
« Reply #14 on: October 15, 2019, 04:27:12 PM »
Amiga 3.1 had a Blue-Grey Theme going. If we only used a Blue-Grey background and then varied the white stencil the icon could conceivably fit nicely in a 4 color Amiga-Friendly color palette.

I'm working out a way to apply the stencil. Since the stencil in the middle can be thought of as a binary mask such as white on a black background a function that I use in ShowPicture on the Overlay Menu such as "Copy Stencil" will copy the white pixel mask into the background image. Just place the stencil mask in Ram Disk and select the menu toggle "Mask". That should work.

As far as making the stencil itself graphics programs like Photoshop have sets of black and white clip-art "shapes" that can be used for the stencils. But we may also need a function called "Invert Mask" which is on the ShowPicture Overlay Menu.
« Last Edit: October 15, 2019, 04:55:56 PM by miker1264 »