Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
2 user(s) are online (1 user(s) are browsing Forum)

Members: 1
Guests: 1

miker, more...

Browsing this Thread:   1 Anonymous Users



« 1 2 3 4 (5)


Re: ShowPicture Image Viewer/Converter

Joined:
2006/4/7 1:34
Group:
Member
Posts: 632
Offline
Thank you, MikeR, very interesting read! I think that documentation could also be used in the Aros Dev Docs.

Posted on: 11/25 1:23
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
Save_ILBM and SaveBitmapPic are working now with ILBM images of 8 bitplanes and below. Next I'll work on SaveRGBPic.

I have an idea! What if it were possible to use Picture DataTypes to save 24 bit PNG, JPG, BMP, etc directly to HAM8 as well as the option to save as a 24 bit ILBM? We would need some "switch" to indicate to the datatype which format to save. A 24 bit image has a bitDepth of 24 and numcolors is zero because there's no colorMap. But for HAM8 the bitDepth is 24 and numcolors is 64, because it has a colorMap. For 24 bit dataypes if we set the datatype numcolors to 64 instead of zero the Save_ILBM function will interpret that to mean that we'd like to save to HAM8. There's no color data present so we wiil have to generate a HAM8 colorMap, but there are plenty of samples available to save 24 bit as HAM8!

We could use the same technique with Save_ILBM by comparing bitDepth to numcolors to use SaveBitmapPic to save EHB images (Extra Half-Bright).

Saving directly to HAM8 is just an idea at the moment. I haven't tested it yet. But I'm encouraged to pursue that because if you notice the picture of Gigi, the colorful HAM girl with the red and yellow scarf. Wouldn't it be great to free Gigi from the monotony of 24 bit JPG, PNG or BMP and restore her to her former HAM8 glory!? That would be freaking awesome!!

Posted on: 11/28 15:07

Edited by miker on 2017/11/29 10:53:20
Edited by miker on 2017/11/29 11:26:37
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
Now that I have completed the first pass at SaveILBM, SaveBitmapPic and SaveRGBPic I've decided to add a nice menu system to the image viewer, but that's not an easy task. But I'll get it sorted out.

Posted on: 2017/12/6 10:49
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
I've looked at a few examples of AROS menu systems but they aren't working for my image viewer. Instead I'd like to put together a GadTools menu system using NewMenus.

Posted on: 2017/12/7 9:28
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
2009/3/15 4:41
Group:
Member
Posts: 616
Offline
buffer[offset] = (UBYTE)((val >> 24) & 0xFF);
buffer[offset 1] = (UBYTE)((val >> 16) & 0xFF);
buffer[offset 2] = (UBYTE)((val >> 8) & 0xFF);
buffer[offset 3] = (UBYTE)(val 0xFF);


well I would recommend unions:

union 
{
   
unsigned long;
   
unsigned char byte[4];
ARGBlong2char;


  
ARGBlong2char.long val;

  
buffer[offset++] = ARGBlong2char.byte[0];
  
buffer[offset++] = ARGBlong2char.byte[1];
  
buffer[offset++] = ARGBlong2char.byte[2];
  
buffer[offset++] = ARGBlong2char.byte[3];

// or better

union 
{
   
unsigned long;
   
unsigned char byte[4];
ARGBlong2char[buffersize];



There are two simple reasons for the use of union here:

1st
The compile can ddecide if he uses '>>' together with '& 0xff' ore something better for the byte access.

2nd
You can switch to other byte orderings faster without thinking where to shift what ...

Posted on: 2017/12/7 12:20
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
union
{
unsigned long;
unsigned char byte[4];
} ARGBlong2char;


ARGBlong2char.long = val;

buffer[offset++] = ARGBlong2char.byte[0];
buffer[offset++] = ARGBlong2char.byte[1];
buffer[offset++] = ARGBlong2char.byte[2];
buffer[offset++] = ARGBlong2char.byte[3];

>There are two simple reasons for the use of union here:

>1st
The compile can ddecide if he uses '>>' together with '& 0xff' ore something better for the byte access.

>2nd
You can switch to other byte orderings faster without thinking where to shift what ...

I like the idea of using a union. I would still have to declare unsigned char buffer[4]; and I would have to return the buffer[]. I'd like to use it as a helper function so that it can be re-used. I'll try that.

Posted on: 2017/12/7 13:13
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
Now my Image Viewer has a working GadTools NewMenu System! It is a very simplistic menu system, but it works for me. Other than the menu item array struct most of the important action takes place in a function called "ShowImage" that handles the menu.

The difficulty I'm having at the moment deals with the 'Active Window' and Intuition. When I have more than one window open at a time, only the most recently opened window will have a functioning menu that responds to Intuition Messages. The other windows, even when I click to activate them also have menus but the items are inactive and the messages get queued. After the most recently (last) opened widow is closed then the next one in line (next to last opened) executes its queued menu commands. MultiView functionality using a similar NewMenu system allows selecting a window to make it and its menu active which then allows it to respond to the current set of Intuition messages.

Once I figure out Intuition Messages for the Active Window I will need a function to get fullpath using the Active Window Title and a filePathBuffer. Then I will be able to Save As, Save As IFF, and Save As PNG. The first Image Viewer will have limited capability to convert between image types. But the more advanced 'ShowPicture' will be fully functional as far as image conversions, modifications, and transformations.

Posted on: 2017/12/9 11:39
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 162
Offline
The Image Viewer continues to evolve, in a positive way, day by day!

There's no real secret to Intuition Messages. Whenever an application creates a window Intuition acts as messenger allowing the application to communicate with the window and its gadgets and menu system.

In the case of menus whenever the user selects a menu item Intuition sends a message to the window's message port where the application is listening, waiting to get a coded message. For menu systems msg->code consists of a number that corresponds to the menu number, item number, and/or subitem number. Such as "menu(0), item(1)". That allows the application to interpret which menu item was selected. Similar messages are generated for other IDCMP such as CloseGadget, NewSize, etc. as well as MenuPick.

There is another type of window that also has a message port. An AppWindow apparently creates a drop target for drag-n-drop operations. When an icon or file is dragged into the AppWindow among the messages Intuition sends is the filename. The application then decides what to do. An AppWindow, when used with x y mouse coords could be useful for graphics applications to display icon images or thumbnail images. That might be used with a PNG Icon Editor. I'll explore that method later.

The menu system for the image viewer is now working well.

Posted on: 2017/12/12 10:22
Transfer the post to other applications Transfer



« 1 2 3 4 (5)



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4365
2 magorium
magorium
4095
3 phoenixkonsole
phoenixkonsole
3893
4 nikolaos
nikolaos
3694
5 deadwood
deadwood
2923
6 ncafferkey
ncafferkey
2648
7 mazze
mazze
2214
8 clusteruk
clusteruk
2111
9 Kalamatee
Kalamatee
2024
10 damocles
damocles
1789
© 2004-2017 AROS Exec