Point(x,y) returns wrong collor

Linux specific forum
dibor
Enthusiast
Enthusiast
Posts: 125
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Point(x,y) returns wrong collor

Post by dibor »

Hello.
Point(x,y) returns right color under Windows, but wrong color under Linux and Mac OS
From same source - under Windows I got C0C0C0 color ,under Linux - 3C0000.
x,y coordinates is doesn't matter.

Best Wishes.

// Moved from "Bugs - Linux" to "Linux" (Kiffi)
Mac Studio M1Max, PB 6.03Arm64 and x64.
Macbook Air M2, PB 6.03Arm64 and x64.
Windows 10, PB 6.03 x64 and x86.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Point(x,y) returns wrong collor

Post by IdeasVacuum »

Hello dibor

Windows defaults to RGB format. Perhaps Linux and MAC are using a different format/colour space?

Edit: Apple's own colour picker has issues (or at least confusion):
https://apple.stackexchange.com/questio ... oose-color
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
dibor
Enthusiast
Enthusiast
Posts: 125
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Point(x,y) returns wrong collor

Post by dibor »

Hi.
Tnx for answer.
I am do not care about color formats.
Compiler mast to care.
Point function supported by ALL OS's, so I do not need to do any manipulation for getting pixel color in any OS

Code: Select all

  If StartDrawing(WindowOutput(#Window_MainWindow)) ; 
    WinBackColor = Point(0,0)
    Debug WinBackColor
    StopDrawing()
  EndIf 
May be I am wrong or do not understand something :(
Mac Studio M1Max, PB 6.03Arm64 and x64.
Macbook Air M2, PB 6.03Arm64 and x64.
Windows 10, PB 6.03 x64 and x86.
User avatar
Bisonte
Addict
Addict
Posts: 1233
Joined: Tue Oct 09, 2007 2:15 am

Re: Point(x,y) returns wrong collor

Post by Bisonte »

in this case ... you have to "eat" all events on Linux and Mac, if this "GetWindowColor" is directly after Windowcreation !

Only after the events from the creation process are done, you can read the color. On windows you don't need it, but on the other os.

Code: Select all

  While WindowEvent() : Wend
  If StartDrawing(WindowOutput(#Window_MainWindow)) ;
    WinBackColor = Point(0,0)
    Debug WinBackColor
    StopDrawing()
  EndIf
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
dibor
Enthusiast
Enthusiast
Posts: 125
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Point(x,y) returns wrong collor

Post by dibor »

Bisonte wrote:i, if this "GetWindowColor" is directly after Windowcreation !
Sure, I am take windows color and put it as background color of the canvas buttons.
Mac Studio M1Max, PB 6.03Arm64 and x64.
Macbook Air M2, PB 6.03Arm64 and x64.
Windows 10, PB 6.03 x64 and x86.
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Point(x,y) returns wrong collor

Post by infratec »

That's not what Bisonte wrote.

On Linux and OSX you have to wait until the window creation is complete before you can read the color.
So you have to add a short delay and wait until all (first) window events are finished, like Bisonte wrote in his example.
Last edited by infratec on Wed Jul 08, 2020 12:35 pm, edited 1 time in total.
dibor
Enthusiast
Enthusiast
Posts: 125
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Point(x,y) returns wrong collor

Post by dibor »

Thank you are Bisonte and infratec
Will try to do so, hope this hepls :)
Mac Studio M1Max, PB 6.03Arm64 and x64.
Macbook Air M2, PB 6.03Arm64 and x64.
Windows 10, PB 6.03 x64 and x86.
dibor
Enthusiast
Enthusiast
Posts: 125
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Point(x,y) returns wrong collor

Post by dibor »

Thank you again to Bisonte and infratec

Code: Select all

While WindowEvent() : Wend
Did it !!! :)

So this is not a bug this is unknowing programming under Linux and OSX(and Windows also) :(
I am amateur in the programming.
Thank you are again :)
Mac Studio M1Max, PB 6.03Arm64 and x64.
Macbook Air M2, PB 6.03Arm64 and x64.
Windows 10, PB 6.03 x64 and x86.
User avatar
Kiffi
Addict
Addict
Posts: 1362
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Point(x,y) returns wrong collor

Post by Kiffi »

@dibor: No problem. But in the future you should always have bugs confirmed by others before posting them in the bug forum.

Greetings ... Peter
Hygge
Post Reply