AROS Picture DataTypes

miker1264 · 1611

miker1264

  • Senior Member
  • ****
    • Posts: 342
    • Karma: +12/-1
Reply #75 on: September 22, 2019, 10:19:15 PM
ok thank's

Sure! But I'm done yet.

Load_ BMP (though it wasn't written by me) doesn't meet my three main criteria for picture datatypes:

It should be "Coherent, Concise & Effective".

It isn't Coherent with Buffered Read Operations that are difficult to follow if there's a problem. There is definitely a problem here!

It is Concise. Other than "Buffered Reads" it has the minimal amount of code for the desired effects.

It's not effective because it's not "inclusive". Saying "if( depth != 24 )" //get colormap isn't effective. What if depth is 32? Instead it shoud say "if( depth <= 8 )" //get colormap. That's more effective. Reading one scanline at a time is a Buffered Read. That's enough for C code that is already fast.

Having said all that, I do admire the style in which Load_ILBM is written for the ILBM datatype. Its Coherent, Concise, Well-Organized, Effective & All-Inclusive.  ;)

With that in mind I will re-write the entire Load_BMP function with Direct Read Methods which I have already proven to be effective with Alpha Transparency for BMPX files.

(Sorry - salvatore didn't get the last word again) 😛
« Last Edit: September 22, 2019, 10:54:44 PM by miker1264 »



Samurai_Crow

  • Newbie
  • *
    • Posts: 48
    • Karma: +0/-0
  • Hobby coder
Reply #76 on: September 23, 2019, 12:59:55 AM
The reversed byte ordering probably means you're running big endian code on a little endian PC.  There should be a macro in the developer kit with byte swapping.  That way it only takes a BSWAP opcode on 486.



miker1264

  • Senior Member
  • ****
    • Posts: 342
    • Karma: +12/-1
Reply #77 on: September 23, 2019, 05:16:51 AM
The reversed byte ordering probably means you're running big endian code on a little endian PC.  There should be a macro in the developer kit with byte swapping.  That way it only takes a BSWAP opcode on 486.

That's a very good point.

I thought perhaps there was a problem in Load_BMP but that may not be the case.

Here is the situation:
I re-wrote Load_BMP to read the file directly. But the Alpha bytes are still 0xFF. I'm back to my original suspicion that READPIXELARRAY works fine when the PBPAFMT of source matches destination such as PNG stored as ARGB and read as ARGB. But BMPX is RGBA.

When I Save BMPX from PNG the soure pixel format for PNG is ARGB. That works fine.

When using the datatype in my graphics program I must use READPIXELARRAY with PBPAFMT_ARGB. So the datatypes system (READPIXELARRAY) is forced to convert RGBA to ARGB. Something happens in the conversion process and the Alpha in RGBA doesn't get copied from source to destination.

I may be going far out on a limb making assumptions without enough information. But it seems very strange that the initial values in READPIXELARRAY are: r=0, g=0, b=0, a=0xff. I'll keep testing the datatype. The problem with RGBA converting Alpha bytes to 0xff seems to be internal. I will direct my question to the Developers Mailing List to see if anyone there has an idea as to why alpha bytes are not being copied correctly from the source to the destination byte arrays.

The Endianess should be handled when the bytes are swapped around. But I'll consider that also as a probable cause.


« Last Edit: September 23, 2019, 07:13:33 AM by miker1264 »



salvatore

  • Guest
Reply #78 on: September 23, 2019, 08:38:50 AM
good job miker :)



miker1264

  • Senior Member
  • ****
    • Posts: 342
    • Karma: +12/-1
Reply #79 on: September 26, 2019, 07:14:48 PM
I am currently working on Save_ILBM for the ILBM datatype. Note: I am not altering the Load_ILBM. I'm just adding save functions so we can finally save as iff in MuliView.

I'm working on Save_BitMapPic first to save ILBM images of 8 bitplanes and below.
« Last Edit: September 28, 2019, 08:04:37 AM by miker1264 »



miker1264

  • Senior Member
  • ****
    • Posts: 342
    • Karma: +12/-1
Reply #80 on: September 28, 2019, 08:13:38 AM
I'm revising the SaveBitMapPic code to be used in the ilbm datatype. I'm testing it on Icaros Desktop Native.