Color of a screen pixel: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Changed to Wren S/H |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 679:
=={{header|FutureBasic}}==
Tracks color information of the pixel under the current mouse x/y coordinates.
<syntaxhighlight lang="futurebasic">
_window = 1
begin enum 1
_view
_colorWell
_imageView
end enum
void local fn BuildWindow
window _window, @"ColorUnderMouse", (0,0,500,400), NSWindowStyleMaskTitled + NSWindowStyleMaskClosable▼
view subclass _view, (0,0,500,300)▼
▲window _window, @"ColorUnderMouse", (0,0,500,400), NSWindowStyleMaskTitled + NSWindowStyleMaskClosable
colorwell _colorWell, YES, fn ColorWhite, ( 410, 310, 70, 70 ), NO, _window▼
▲view subclass _view, (0,0,500,300)
▲colorwell _colorWell, YES, fn ColorWhite, ( 410, 310, 70, 70 ), NO, _window
end fn
void local fn DrawRect
CFArrayRef array = @[fn ColorRed, fn ColorOrange, fn ColorYellow, fn ColorGreen, fn ColorBlue, fn ColorWithRGB(0,0.29,0.51,1), fn ColorWithRGB(0.58,0.0,0.83,1)]▼
GradientRef grad = fn GradientWithColors( array )▼
▲CFArrayRef array = @[fn ColorRed, fn ColorOrange, fn ColorYellow, fn ColorGreen, fn ColorBlue, fn ColorWithRGB(0,0.29,0.51,1), fn ColorWithRGB(0.58,0.0,0.83,1)]
GradientDrawInRect( grad, fn ViewFrame(_view), 0 )▼
▲GradientRef grad = fn GradientWithColors( array )
▲GradientDrawInRect( grad, fn ViewFrame(_view), 0 )
end fn
void local fn DoMouse( tag as NSInteger )
CGPoint pt = fn EventLocationInView( tag )
ColorWellSetColor( _colorWell, color )▼
▲ColorWellSetColor( _colorWell, color )
cls : printf @"%.0fx, %.0fy, %@", pt.x, pt.y, color▼
▲cls : printf @"%.0fx, %.0fy, %@", pt.x, pt.y, color
end fn
void local fn DoDialog( ev as long, tag as long )
select ( tag )▼
case _view▼
▲select ( tag )
select ( ev )▼
▲case _view
case _viewDrawRect : fn DrawRect▼
▲select ( ev )
▲case _viewDrawRect : fn DrawRect
end select▼
▲case _viewMouseDragged : fn DoMouse( tag )
end select
▲end select
select ( ev )▼
case _windowWillClose : end▼
▲select ( ev )
end select▼
▲case _windowWillClose : end
▲end select
end fn
Line 1,224 ⟶ 1,220:
</pre>
=={{header|RPL}}==
RPL was designed for black-and-white LCD screens. The <code>PIX?</code> instruction returns 1 if the designated pixel is black - actually dark gray or blue, depending on the model - and 0 if it's not.
(10,10) PIX?
<code>PIX?</code> was introduced in 1990 with the HP-48. On previous machines (HP-28C/S), the only way to test a pixel was to convert the status of the 131x32 LCD matrix into a 548-character string using the <code>LCD→</code> command, and then test the appropriate bit of the appropriate character.
=={{header|Ruby}}==
This example requires ImageMagick >= 6.2.10 (works on X11, unsure about other platforms).
Line 1,293 ⟶ 1,292:
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="
import "graphics" for Canvas, Color
import "input" for Mouse
Line 1,341 ⟶ 1,340:
{{omit from|Blast}}
{{omit from|Brainf***}}
{{omit from|EasyLang}}
{{omit from|GUISS}}
{{omit from|Lilypond}}
|