Login
Username:

Password:

Remember me



Lost Password?

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

Members: 0
Guests: 15

more...

Browsing this Thread:   1 Anonymous Users





AROS, AmigaOS 3.1 and RGB Images.

Joined:
2007/12/27 18:39
From Arizona, USA
Group:
Member
Posts: 103
Offline

Well, some years ago I grabbed a Blackjack game off of Aminet and upgraded it to 24 bit graphics. Years later (now) I've finally got it to compile for AROS. Yea, I've had a lot of distractions since then. ;) The AROS version runs fine, at least as far as I can tell, however, the graphics are color shifted. White is yellow. Red is green and so on... the AROS version looks like this:
Jack 3.1

The Amiga OS 3.1 version looks exactly as it should, so I'm assuming this has something to do with Cybergraphics, or perhaps byte alignment on RGB or the color palette being used.

Clues on where to look to narrow this down would be appreciated. Thanks in advance.

Ed.


Posted on: 2013/1/6 17:53
Transfer the post to other applications Transfer


Re: AROS, AmigaOS 3.1 and RGB Images.

Joined:
2011/6/30 19:50
Group:
Member
Posts: 2998
Offline
Quote:
EDanaToo wrote:
The Amiga OS 3.1 version looks exactly as it should, so I'm assuming this has something to do with Cybergraphics, or perhaps byte alignment on RGB or the color palette being used.

From the dev wiki here here and here.


Quote:
To draw RGB pixels on truecolors screens you can use cybergraphics.library/WritePixelArray(rectfmt = RECTFMT_RGB or RECTFMT_ARGB or RECTFMT_RGBA).

RGB = R8 G8 B8 R8 G8 B8 ... ARGB = A8 R8 G8 B8 A8 R8 G8 B8 ... ...

in memory, independent of endianess of computer.

The pixel buffer will be converted to the destination bitmap pixel format automatically but this conversion may be slow as we have only one general slow conversion routine.

Better would be to use RECTFMT_RAW which means same pixel format as destination bitmap. Then you would have to do the conversion yourself before calling WritePixelArray(RECTFMT_RAW).


Quote:
Pixel and rectformats in AROS cybergraphics always refer to the layout in memory. So RECTFMT_ARGB means 0xAA 0xRR 0xGG 0xBB. And this is so no matter if running on big endian or little endian machine. This is important to know for when running on little endian (x86) machine, because then if you have an ULONG pixel array/buffer where you write ARGB pixels into it using pixel (ULONG) accesses then in memory it will look like 0xBB 0xGG 0xRR 0xAA and you would need to use RECTFMT_BGRA.


Quote:
This is an endianess thing. On AROS big endian it's exactly the same as in AOS/MOS. Because pixel access/component access/memory layout on big endian machine does not make a difference. If you write a 0xAARRGGBB ULONG to memory it will be 0xAA 0xRR 0xGG 0xBB in memory, too. Same thing. No problem.

On little endian machine it was something of a design decision whether the RECTFMTs/PIXFMTs should reflect pixel access based meaning (unit == pixel) or memory layout based meaning (unit == byte or component). Because RECTFMT_ARGB does not mean that one by force always uses ULONG pixel buffers and only ULONG pixel accesses. One may also use byte/component access. Or read/write such pixel buffers to/from disk.


Would that be suffice for help ?

Posted on: 2013/1/6 19:40
Transfer the post to other applications Transfer


Re: AROS, AmigaOS 3.1 and RGB Images.

Joined:
2007/12/27 18:39
From Arizona, USA
Group:
Member
Posts: 103
Offline
That was more than sufficient, Magorium. That was exactly what I needed. Switching from RECTFMT_ARGB to RECTFMT_BGRA32 gives me exactly the colors I needed.

Thank for the assist. It's appreciated.

Ed.

Posted on: 2013/1/7 15:46
Transfer the post to other applications Transfer






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
3667
2 nikolaos
nikolaos
3467
3 phoenixkonsole
phoenixkonsole
3037
4 magorium
magorium
2998
5 deadwood
deadwood
2342
6 ncafferkey
ncafferkey
2070
7 mazze
mazze
2068
8 clusteruk
clusteruk
2050
9 damocles
damocles
1769
10 Kalamatee
Kalamatee
1714
© 2004-2014 AROS Exec