New BMPX Picture DataType

miker1264 · 2468

AMIGASYSTEM

  • Member
  • ***
    • Posts: 191
    • Karma: +4/-0
Reply #30 on: December 13, 2019, 12:41:36 PM
miker will there also be a 32-bit and 68k version?



paolone

  • Moderator
  • Senior Member
  • *****
    • Posts: 340
    • Karma: +6/-0
Reply #31 on: December 13, 2019, 02:06:42 PM
paolone

I will send the current version of BMP Datatype to you later today to be included in version 2.3.0 if it isn't too late. The save functions work on Icaros 32bit but not yet 64bit. I'm still working on 64bit.

Thanks for your patience and for your hard work.


Don't worry. You're not late at all. Development cycle for 2.3.0 will still be quite long, as we're adding a completely new way to use Icaros Desktop.


AMIGASYSTEM

  • Member
  • ***
    • Posts: 191
    • Karma: +4/-0
Reply #32 on: December 13, 2019, 03:05:36 PM
I forgot miker "BMP Datatype_092519.zip" works well on my AROS One 32Bit, also saving in BMP works, only problem encountered on a BMP image that is seen doubled and distorted, on Windows and OS3 the image is seen well.



miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #33 on: December 13, 2019, 04:06:52 PM
AMIGASYSTEM

Thank you for the feedback. I'll take a look at the problem with skewing. I've seen it before. It may be a problem with reading padding bytes in the original BMP load function. Thanks for the samples.

What bit depth is the black and white image? What is the width and height of the image? That will help me to duplicate the error to fix it. Thanks.

The 32bit and 64bit versions use exactly the same code. So now it's easier to update both.

I've noticed that 8bit BMP files that are an odd width such as 789x562 get skewed because of incorrect padding bytes in the older BMP Load function that existed before I added the BMP Save function. There are also colormap issues with 1bit and 4bit BMP files. They appear black. I will go back and correct these problems in the BMP Load function.

Then it should be very functional. Thanks.
« Last Edit: December 14, 2019, 09:56:30 PM by miker1264 »



miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #34 on: December 15, 2019, 02:18:51 AM
I found the problem with 1bpp and 4bpp BMP files displaying as black because of a colormap issue. The problem was that BMP Load function was using biClrUsed which for 8bpp is usually defined, but for 1bpp and 4bpp biClrUsed is set to 0. Using biClrUsed is not optimal because these values are not required. So I used numcolors instead and based that on biBitCount. For 1bpp numcolors = 2 and for 4bpp numcolors = 16. So now these images display correctly with true colors.

For my BMP Save function I'm using a different method to calculate padding bytes than the method used in BMP Load. Now I will have to reconcile the two methods to find the best solution for BMP Load so that the padding bytes are handled correctly. For 8bit images if they are an odd size such as 789x562 they will be skewed.

Fixing the padding bytes issue is next then the new BMP Datatype will be complete. The next major revision will include Alpha Transparency for 32bit BMPX files. :-)
« Last Edit: December 15, 2019, 04:53:21 AM by miker1264 »



miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #35 on: December 15, 2019, 05:44:28 PM
In addition to the ColorMap problem for 1bpp & 4bpp caused by using biClrUsed there was also an Offset error caused by something similar as seen below:

/* skip offset */
    bfOffBits = bfOffBits - 14 - 40 - biClrUsed*4;

If biClrUsed is set to zero, the last set of numbers will also be zero which gives a bad offset. So I changed biClrUsed to numcolors to correct the offset error.



miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #36 on: December 15, 2019, 05:47:09 PM
After making the correction to resolve the offset error the result looked very good for 1bpp & 4bpp that previously had a split screen because of the offset error.

There is one more slight error in BMP Load that affects some 24bit images that have an odd width. This is caused by an error in calculating the padding bytes.

AMIGASYSTEM,

For the "Baggio.bmp" image I'm trying to reproduce the error based on Width & Bit Depth so I can calculate the padding bytes to find the skewing error. Is it 24bit with an odd width?



« Last Edit: December 15, 2019, 06:47:12 PM by miker1264 »



miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #37 on: December 15, 2019, 06:53:05 PM
AMIGASYSTEM

I noticed that your screenshot was 800x600. Based on that I measured the size of the "Baggio.bmp" window to be about 310x250.
I did some quick calculations based on that assuming 24bit. That fits with the padding bytes error I've noticed due to a bad formula.

310x250

310%4 = 312
312*3= 936

(310*3)%4 = 932
932/3 = 310.6667

I have a bmp image that I resized to 310x250 at 24bit to test. I used the same size 310x250 image at 4bpp as a control sample.
The reslult was that the 24bit image with similar dimensions to your "Baggio.bmp" shows a definite skewing error due to padding bytes. Now I can fix that error as well.

Thank you for your feedback. That has helped narrow down this skewing problem.



AMIGASYSTEM

  • Member
  • ***
    • Posts: 191
    • Karma: +4/-0
Reply #38 on: December 16, 2019, 11:10:13 AM
If it can serve you I enclose the image of Baggio.bmp (drawn by my son on PC with Paint)



salvo

  • Legendary Member
  • *****
    • Posts: 539
    • Karma: +7/-0
  • Invalid Civil
    • Youtube Music Channel
Reply #39 on: April 13, 2020, 08:38:01 PM
miker it is possible to have the new bmpDT for my distribution :)

TinyAros on Lenovo M70 intel dual core 3.20 Ghz, SSD 120 Gb, 4 Gb Ram DDR3, Nvidia Geforce 8400 GS 512 Mb DDR3


miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #40 on: April 13, 2020, 09:44:33 PM
Yes. I will compile the newest one for 32bit.



salvo

  • Legendary Member
  • *****
    • Posts: 539
    • Karma: +7/-0
  • Invalid Civil
    • Youtube Music Channel
Reply #41 on: April 13, 2020, 10:36:27 PM
thank you miker

TinyAros on Lenovo M70 intel dual core 3.20 Ghz, SSD 120 Gb, 4 Gb Ram DDR3, Nvidia Geforce 8400 GS 512 Mb DDR3


miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #42 on: April 14, 2020, 03:42:00 AM
This should be the latest 32bit version. Let me know if it works or if you have problems with it.



salvo

  • Legendary Member
  • *****
    • Posts: 539
    • Karma: +7/-0
  • Invalid Civil
    • Youtube Music Channel
Reply #43 on: April 14, 2020, 02:56:28 PM
well miker, but raystorm :-\

TinyAros on Lenovo M70 intel dual core 3.20 Ghz, SSD 120 Gb, 4 Gb Ram DDR3, Nvidia Geforce 8400 GS 512 Mb DDR3


miker1264

  • Senior Member
  • ****
    • Posts: 422
    • Karma: +14/-1
Reply #44 on: April 14, 2020, 04:25:31 PM
I haven't been doing much lately but trying to survive the plague.