Login
Username:

Password:

Remember me



Lost Password?

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

Members: 2
Guests: 1

amiga, mordesku, more...

Browsing this Thread:   1 Anonymous Users



« 1 2 3 (4)


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 134
Offline
More progress on ShowPicture. I successfully converted HAM8 ILBM images to 24bit PNG. I also successfully converted an ILBM with 5bitplanes (32 colors) to an 8bit PNG image file.

My reasoning was that the picture datatype for IFF loads all the pixel data into the planar bitmap (bm). The bitmap, I believe, has bm->Planes[8] where each Plane is a pointer to a UBYTE array of bitplane data. Because there are 8 planes (8bit) ReadPixelArray can easily turn that into an 8bit chunky buffer as when loading an 8bit standard image (PNG, BMP, etc). Then the image can be saved as any supported image type!

Posted on: 11/13 18: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: 134
Offline
Now that I can Load a 5 bitplane ILBM image and save it as an 8 bit standard image the next step is to display it as a 8 bit image using WriteLutPixelArray and a ULONG CTable. My ultimate goal in the next week or two is to write the Save ILBM function for the IFF Datatype. It isn't necessary to display an ILBM in order to write the save function, but it seems like the logical next step.

Writing Save ILBM will most likely come in three steps. First I will write the code to save an 8 bitplane ILBM (Save_Bitmap_Pic). Then I will expand that to include RGB and ARGB images (Save_RGB_Pic). Lastly I will modify Save_Bitmap_Pic to allow saving images less than 8 planes. The very last step, after several rounds of testing, will be to make slight modifications and insert it into the IFF Dataype. After compiling the new datatype there will be more testing, but that's the exciting part.

As an update: I have successfully displayed the ILBM images (5 bitplanes) at 8 bits per pixel. I started writing the Save_ILBM function and all is going well. I'm using my C# SaveILBM function as a guide. I'm having a little trouble with ConvertLongToBytes_BigEndian. I wonder if there is an AROS helper function somewhere to do this for me?

Posted on: 11/19 18:22

Edited by miker on 2017/11/20 2:19:56
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 134
Offline
I'm not sure that I have enough on my plate! Since I'm making good progress on picture datatypes, concurrently while working on Save_ILBM I'd like to start two new functions in my image viewer/test program: Load_TGA and Save_TGA. Hopefully, if all goes well, after the IFF Dataype is complete we can add TARGA (TGA) Datatype, and later maybe TIFF.

Posted on: 11/20 9:14
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
2008/6/2 2:28
Group:
Member
Posts: 252
Offline
Thanks for updating to datatypes

Posted on: 11/21 1:24
Transfer the post to other applications Transfer


Re: ShowPicture Image Viewer/Converter

Joined:
5/2 17:15
From California, United States
Group:
Member
Posts: 134
Offline
While writing the Save_ILBM function for the IFF datatype I needed some helper functions. I already wrote Save_ILBM a few years ago, but it was in CSharp. The nice thing is that I can just translate CSharp into C code because it is very similar. That's what I did. If I can do that with the remaining sections of code I'll be finished with Save_ILBM sooner than expected.

//Write File Size [WriteBytesBigEndian].
offset = 4;
length = 4;
LONG fileSize = 35394;
unsigned char *FileSize;
FileSize = WriteBytesBigEndian(fileSize, 0);
WriteBytes(fileHandle, FileSize, offset, length);

******************************************

//C sharp
public static void WriteBytesBigEndian(uint val, byte[] buffer, int offset)
{
buffer[offset] = (byte)((val >> 24) & 0xFF);
buffer[offset + 1] = (byte)((val >> 16) & 0xFF);
buffer[offset + 2] = (byte)((val >> 8) & 0xFF);
buffer[offset + 3] = (byte)(val & 0xFF);
}

******************************************

//C code
unsigned char *WriteBytesBigEndian(LONG val, int offset)
{
unsigned char *buffer;
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);
return buffer;
}

******************************************

/* Prepare BMHD information. */
//Set_BMHD.

/* Write BMHD information. */
//Write BMHD.

/* Prepare ColorMap information. */
//Set_CMAP.

/* Write ColorMap and CAMG information. */
//Write CMAP.
//Write CAMG.

/* Prepare BODY information. */
//Set_BODY.

/* Write BODY information. */
//Write BODY.

Posted on: 11/21 14:58
Transfer the post to other applications Transfer



« 1 2 3 (4)



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
4359
2 magorium
magorium
4095
3 phoenixkonsole
phoenixkonsole
3892
4 nikolaos
nikolaos
3693
5 deadwood
deadwood
2923
6 ncafferkey
ncafferkey
2646
7 mazze
mazze
2214
8 clusteruk
clusteruk
2109
9 Kalamatee
Kalamatee
2024
10 damocles
damocles
1789
© 2004-2017 AROS Exec