Is it possible for ReadPixel to work outside the Hollywood window?
Posted: Sat Apr 13, 2019 2:12 am
I'm trying to write a program to display the mouse position and the colour of the pixel it's over and display the info in the windows titlebar but if the mouse is outside the window I get a "Specified pixel is out of range!" requester.
This is on Amiga OS4 and I'm assuming that under the hood it's using the graphics.library ReadPixel() and the windows RastPort instead of the screens. It's a pity it doesn't use ReadPixelColor() which doesn't use Rastports as you just pass the x an y coordinates.
Here's my source, can anyone suggest a way round the problem?
@DISPLAY{Title = "Colour:$000000 X=0000 Y=0000", X = 0, Y = 0, Width = 400, Height = 1, NoModeSwitch = TRUE}
CtrlCQuit(TRUE)
EscapeQuit(TRUE)
Function p_Update(msg)
SetTitle("Colour:$" + HexStr(ReadPixel(msg.x, msg.y)) + " X=" + msg.x + " Y=" + msg.y +" ")
EndFunction
InstallEventHandler({OnMouseMove = p_Update})
Repeat
WaitEvent
Forever
Another little niggle is I can't set the window height to 0 so I'd only get the titlebar and none of the bottom borders.
This is on Amiga OS4 and I'm assuming that under the hood it's using the graphics.library ReadPixel() and the windows RastPort instead of the screens. It's a pity it doesn't use ReadPixelColor() which doesn't use Rastports as you just pass the x an y coordinates.
Here's my source, can anyone suggest a way round the problem?
@DISPLAY{Title = "Colour:$000000 X=0000 Y=0000", X = 0, Y = 0, Width = 400, Height = 1, NoModeSwitch = TRUE}
CtrlCQuit(TRUE)
EscapeQuit(TRUE)
Function p_Update(msg)
SetTitle("Colour:$" + HexStr(ReadPixel(msg.x, msg.y)) + " X=" + msg.x + " Y=" + msg.y +" ")
EndFunction
InstallEventHandler({OnMouseMove = p_Update})
Repeat
WaitEvent
Forever
Another little niggle is I can't set the window height to 0 so I'd only get the titlebar and none of the bottom borders.