![]() |
![]() |
#1 |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
SetAPen returns wrong color.
Hi,
I am a bit confused and can't figure it out. So when I am checking the WB colors in the Prefs->Palette I see these colors: 0 - grey, 1-black, 2-white, 3-blue, 4-red, 5-green etc.. ![]() In my program I would like to use for example PEN 4 and 5 to draw red or green rectangle. So I am using in my code: Code:
SetAPen(&APP_pubscreen->RastPort, 4); RectFill(APP_window->RPort, 0, 0, arg_win_size_x, arg_win_size_y); Code:
APP_pubscreen = LockPubScreen(NULL); APP_window = OpenWindowTags(NULL, WA_Left, arg_win_pos_x, WA_Top, arg_win_pos_y, WA_Width, window_width, WA_Height, window_height, WA_PubScreen, (ULONG)APP_pubscreen, WA_Flags, WFLG_ACTIVATE, WA_IDCMP, IDCMP_REFRESHWINDOW, WA_Gadgets, (ULONG)G_gadgets[GID_GADGETS_LIST], TAG_END); ![]() For example when I am testing color 0-3 the result are OK - I mean I got grey, black, white and blue rectangles. The numbers above 3 are mismatch. My goal is to let user select a pen color for online and offline status (by TOOLTYPES). So as the every user can have different settings I thought this is the best way to do it. But that PEN numbers are mismatch. |
![]() |
![]() |
#2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,085
|
Been a while since I did any of that, but this might help:
Code:
// intuition/screens.h #define DETAILPEN (0x0000) /* compatible Intuition rendering pens */ #define BLOCKPEN (0x0001) /* compatible Intuition rendering pens */ #define TEXTPEN (0x0002) /* text on background */ #define SHINEPEN (0x0003) /* bright edge on 3D objects */ #define SHADOWPEN (0x0004) /* dark edge on 3D objects */ #define FILLPEN (0x0005) /* active-window/selected-gadget fill */ #define FILLTEXTPEN (0x0006) /* text over FILLPEN */ #define BACKGROUNDPEN (0x0007) /* always color 0 */ #define HIGHLIGHTTEXTPEN (0x0008) /* special color text, on background */ /* New for V39, only present if DRI_VERSION >= 2: */ #define BARDETAILPEN (0x0009) /* text/detail in screen-bar/menus */ #define BARBLOCKPEN (0x000A) /* screen-bar/menus fill */ #define BARTRIMPEN (0x000B) /* trim under screen-bar */ ... struct DrawInfo* p_info = GetScreenDrawInfo(p_screen); UBYTE pen_x = p_info->dri_Pens[SHADOWPEN]; SetAPen(p_rport,pen_x); |
![]() |
![]() |
#3 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,041
|
Quote:
You always have to use the same RastPort. Use that of the window. The screen is taboo (except for reading). |
|
![]() |
![]() |
#4 | |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
Quote:
![]() But after correction: Code:
SetAPen(APP_window->RPort, 4); RectFill(APP_window->RPort, 0, 0, arg_win_size_x, arg_win_size_y); But instead I get some DEEP BLUE color. If I set PEN=5 then I got MAROON color that is not even in this palette.. Its like my window have different color map, but it is just a window on public WB screen so I think it should share its palette ![]() |
|
![]() |
![]() |
#5 |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
ps.
I also noticed in another application called ScreenTime if I set there a PEN=4 it also gives that DEEP BLUE color instead of red. So maybe this is a System issue? But I tested on AOS3.2, 3.1 - I dont know so maybe its the way it works. ObtainBestPen work good in this case actually it can be a replacement or aditional option. |
![]() |
![]() |
#6 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,041
|
Palette prefs sets the colors of the first four and the last four pens of the screen, not the first eight pens. So in order to get what Palette prefs suggests, you have to set the depth of your Workbench screen to 3 (8 colors).
|
![]() |
![]() |
#7 | |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
Quote:
![]() |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
shenandoah returns!!! | starlord | project.aGTW | 103 | 20 March 2024 17:22 |
Color Saturation and Color Tint/Hue | Retro-Nerd | support.WinUAE | 22 | 02 August 2018 10:38 |
Color wrong | mritter0 | Coders. C/C++ | 8 | 02 April 2014 16:15 |
Printing in color with WinUAE on color laser | source | support.Apps | 7 | 14 April 2013 00:32 |
ISO true color to 256 color algorithm | Lord Riton | Coders. General | 19 | 15 April 2011 17:49 |
|
|