25 March 2024, 07:02 | #1 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,318
|
ObtainPen on high/true color RTG screens
I'd like to use graphics.library line drawing functions, like Move + Draw on 16-bit or 32-bit RTG screens, but I don't know how to pick a color using R,G,B values that's not in the 4 color Workbench palette set for the screen.
FindColor and ObtainBestPenA only picks from these 4 colors, ObtainPen with or without the PEN_EXCLUSIVE flag always returns -1 if the color isn't in the colormap already. I tried these both on the Workbench public screen and a custom screen, but it didn't seem to make any difference. If there's any other way to do this please let me know I'm using Picasso96 2.0 as my RTG system. |
25 March 2024, 08:17 | #2 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
Quote:
Remove any patches like FullPalette. Make sure that in Prefs/ScreenMode you moved Depth to the maximum number or colors. If you open your own screen make sure to activate pen sharing. And set depth to at least 8. The number of free pens on a screen still depends on the depth setting, even if the pixels can show many more colors. Normally, if the depth of the screen's bitmap is larger than 8, you call ObtainPen with PEN_EXCLUSIVE once and then set the RGB value of that pen to the value you want to draw with. You can reuse the pen and set different RGB values as long as you need it. When done don't forget to release the pen. The advantage is that you need only one pen for all drawings because the drawn pixels keep their color even if the pen color changes. |
|
25 March 2024, 18:07 | #3 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,318
|
That makes sense, thanks for the explanation. This rules out public screens, as I'd be at the mercy of the depth setting in the prefs. Since both the CGFX and P96 APIs have rect fill functions that take a direct color value, I can use this as a workaround, at least for horizontal and vertical lines.
|
26 March 2024, 05:47 | #4 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,865
|
Be careful. My experience with this is that on the hardware I had, Draw - which was hardware accelerated on the Permedia2 was slower than doing it myself, in software with a bitmap lock and a good Bresenam implementation. It wasn't until I fixed line drawing in an unrelated P2 68K Warp3D driver that I realised it wasn't an RTG problem. On that hardware, arbitrary line drawing is just slow, because reasons. It was literally faster to fake it using a 1 pixel wide triangle pair, but the results were not always ideal.
Of course, you need to be drawing a reasonable number of lines in a bitmap lock for software plotting to be worth it too. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Chunk True Color 4 pixels | remz | Coders. Asm / Hardware | 31 | 08 June 2022 13:04 |
OS4 crash with UAEGFx High Color | @UAE | support.WinUAE | 1 | 26 August 2021 11:48 |
Disable filters for RTG screens | CCRider | support.FS-UAE | 0 | 10 November 2017 22:03 |
speed up the rtg screens ??? | turrican3 | support.WinUAE | 2 | 09 May 2011 02:00 |
ISO true color to 256 color algorithm | Lord Riton | Coders. General | 19 | 15 April 2011 17:49 |
|
|