B4J Question Pixel Color

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All

I am trying to get a pixel color and I used this command

B4X:
Sub Button13_Click
    
    
    Log(rbt.ScreenPixelColorGetAt(2595,631))
    Log(fx.Colors.From32Bit(rbt.ScreenPixelColorGetAt(2595,631)))
    
    GetARGB(rbt.ScreenPixelColorGetAt(2595,632))
    
    
    
    
    
End Sub

Sub GetARGB(Color As Int) As Int()
    Dim res(4) As Int
    res(0) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff000000), 24)
    res(1) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff0000), 16)
    res(2) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff00), 8)
    res(3) = Bit.And(Color, 0xff)
    
    Log(res(0))
    Log(res(1))
    Log(res(2))
    Log(res(3))
    
    
    Return res
End Sub


it does not matter which color I put on that pixel but always give me the same result

Picked up _JAVA_OPTIONS: -Xmx1024m
-16777216
0x000000ff
255
0
0
0

Any ideas Please

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
What is rbt?
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
After trying different options, I decided to try read a pixel on my Primary Screen and it worked. If seems like that even with the capabilities of moving the mouse to the secondary screen it does not allow for reading a pixel color.

Have you had the same experience ?
 
Upvote 0
Top