English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 25 March 2024, 07:02   #1
BSzili
old chunk of coal
 
BSzili's Avatar
 
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
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.
BSzili is offline  
Old 25 March 2024, 08:17   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,995
Quote:
Originally Posted by BSzili View Post
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.
Well, this should not be true in general.

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.
thomas is offline  
Old 25 March 2024, 18:07   #3
BSzili
old chunk of coal
 
BSzili's Avatar
 
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
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.
BSzili is offline  
Old 26 March 2024, 05:47   #4
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,165
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.
Karlos is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:53.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08157 seconds with 15 queries