How to resolve the algorithm Colour pinstripe/Display step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Colour pinstripe/Display step by step in the XPL0 programming language
Table of Contents
Problem Statement
The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.
The pinstripes should either follow the system palette sequence, or a sequence that includes: black, red, green, blue, magenta, cyan, yellow, and white:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Colour pinstripe/Display step by step in the XPL0 programming language
Source code in the xpl0 programming language
code ChIn=7, Point=41, SetVid=45;
int X, Y, W, C;
[SetVid($13); \set 320x200 graphics mode in 256 colors
for Y:= 0 to 200-1 do \for all the scan lines...
[W:= Y/50 + 1; \width of stripe = 1, 2, 3, 4
C:= 0; \set color to black so first pixel becomes blue
for X:= 0 to 320-1 do \for all the pixels on a scan line...
[if rem(X/W) = 0 then C:= C+1; \cycle through all system colors
Point(X, Y, C); \set pixel at X,Y to color C
];
];
X:= ChIn(1); \wait for keystroke
SetVid(3); \restore normal text mode display
]
You may also check:How to resolve the algorithm Find limit of recursion step by step in the Axe programming language
You may also check:How to resolve the algorithm Exceptions step by step in the PHL programming language
You may also check:How to resolve the algorithm Count in octal step by step in the MATLAB / Octave programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the Julia programming language