Welcome, Guest. Please login or register.

Author Topic: Retrieve RGB screen data on Picasso96 screen  (Read 6308 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thomas

Re: Retrieve RGB screen data on Picasso96 screen
« on: February 22, 2019, 02:11:56 PM »
1. you must not use &screen->BitMap. Read the comments in intuition/screens.h about it. You should use screen->RastPort.BitMap instead.

2. your program deadlocks because you try to write text to the screen while the screen's bitmap is locked. The text routine waits for the bitmap to become unlocked but your program waits for the text to be printed -> deadlock.

3. you should not lock the bitmap at all. As you only want RGB data from the screen, you should use the function which reads RGB data from the screen.

Here is a complete example which writes the screen contents to a file:

« Last Edit: February 22, 2019, 02:13:40 PM by Thomas »
 

Offline Thomas

Re: Retrieve RGB screen data on Picasso96 screen
« Reply #1 on: February 22, 2019, 03:29:23 PM »
I don't see where I write to the screen. It's just 'printf'.

printf prints text to the console window and the console window is on the Workbench screen, isn't it?


Quote
I understood that while I read or copy the screen bitmap it can change. That's why the lock.

That's correct. What I wanted to point out is that you should not go the route of locking and directly accessing the bitmap data if there is a function which does the whole job for you. If you lock the bitmap and access the bitmap data directly, you have to be aware of all the possible pixel formats, 15bit, 16bit, 24bit, 32bit, each in big endian or little endian order. With the ReadPixelArray function you can choose that you want to receive 24bit RGB data. With direct bitmap access you have to do all the conversion yourself.


By the way, if your target platform is not limited to OS4 only, you should consider to use Cybergraphics API instead of Picasso96. Because CGX programs work on both CGX and P96, your program will work on all RTG systems on all AmigaOS flavours, even MorphOS and AROS. With P96 you limit the user base to AmigaOS4 users and the part of the AmigaOS3 users which use P96.

Offline Thomas

Re: Retrieve RGB screen data on Picasso96 screen
« Reply #2 on: February 23, 2019, 01:53:09 PM »
Wait a moment.
You're saying when I use Cybergraphics API this will work on classic (with either CGX and P96) and also other Amiga flavours?

Yes. CGX API is common to CGX and P96. 68K software works on OS4 and MOS. Only AROS needs a recompile, but the API is available.