How to resolve the algorithm Color of a screen pixel step by step in the REXX programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Color of a screen pixel step by step in the REXX programming language

Table of Contents

Problem Statement

Get color information from an arbitrary pixel on the screen, such as the current location of the mouse cursor.
The mouse cursor may or may not have to be active in a GUI created by your program. These functions are OS related.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Color of a screen pixel step by step in the REXX programming language

Source code in the rexx programming language

/*REXX program obtains the cursor position (within it's window) and displays it's color.*/
parse value  cursor()  with  r  c  .             /*get cursor's location in DOS screen. */

hue=scrRead(r, c, 1, 'A')                        /*get color of the cursor's location.  */
if hue=='00'x  then color= 'black'               /*or dark grey, dark gray.             */
if hue=='01'x  then color= 'darkblue'
if hue=='02'x  then color= 'darkgreen'
if hue=='03'x  then color= 'darkturquoise'       /*or dark cyan.                        */
if hue=='04'x  then color= 'darkred'             /*or maroon.                           */
if hue=='05'x  then color= 'darkmagenta'         /*or dark pink.                        */
if hue=='06'x  then color= 'orange'              /*or dark yellow, orage, brown.        */
if hue=='07'x  then color= 'gray'                /*or grey, gray, dark white.           */
if hue=='08'x  then color= 'gray'                /*or grey, gray, dark white.           */
if hue=='09'x  then color= 'blue'                /*or bright blue.                      */
if hue=='0A'x  then color= 'green'               /*or bright green.                     */
if hue=='0B'x  then color= 'turquoise'           /*or bright turquoise, cyan, britecyan.*/
if hue=='0C'x  then color= 'red'                 /*or bright red.                       */
if hue=='0D'x  then color= 'magenta'             /*or bright magenta, pink, brite pink. */
if hue=='0E'x  then color= 'yellow'              /*or bright yellow.                    */
if hue=='0F'x  then color= 'white'               /*or bright, brite white.              */
say 'screen location ('r","c') color is:' color  /*display color of char at row, column.*/


  

You may also check:How to resolve the algorithm Sorting algorithms/Gnome sort step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Self numbers step by step in the Standard ML programming language
You may also check:How to resolve the algorithm 4-rings or 4-squares puzzle step by step in the PL/M programming language
You may also check:How to resolve the algorithm Ordered words step by step in the Gambas programming language
You may also check:How to resolve the algorithm Zhang-Suen thinning algorithm step by step in the Raku programming language