How to resolve the algorithm Pinstripe/Display step by step in the Delphi programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Pinstripe/Display step by step in the Delphi programming language
Table of Contents
Problem Statement
The task is to demonstrate the creation of a series of vertical pinstripes across the entire width of the display.
c.f. Colour_pinstripe/Display
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Pinstripe/Display step by step in the Delphi programming language
Source code in the delphi programming language
procedure DrawVerticalStripes(Image: TImage; PenWidth,Top,Bottom: integer);
{Draw vertical stripes across full width of image}
{Top/Bottom Control the position of the band of stripes}
{PenWidth controls width of the line drawn}
var X,X2,Y: integer;
begin
Image.Canvas.Pen.Width:=PenWidth;
for X:=0 to (Image.Width div PenWidth)-1 do
begin
if (X mod 2)=0 then Image.Canvas.Pen.Color:=clWhite
else Image.Canvas.Pen.Color:=clBlack;
X2:=X * PenWidth;
Image.Canvas.MoveTo(X2,Top);
Image.Canvas.LineTo(X2,Bottom);
end;
end;
procedure ShowVerticalStripes(Image: TImage);
{Draw all four bands of stripes}
var SHeight: integer;
var I: integer;
begin
SHeight:=Image.Height div 4;
for I:=0 to 4-1 do
begin
DrawVerticalStripes(Image,I+1,SHeight*I,SHeight*(I+1));
end;
end;
You may also check:How to resolve the algorithm Anti-primes step by step in the Racket programming language
You may also check:How to resolve the algorithm Gaussian primes step by step in the Python programming language
You may also check:How to resolve the algorithm Infinity step by step in the Fortran programming language
You may also check:How to resolve the algorithm Abundant, deficient and perfect number classifications step by step in the VBScript programming language
You may also check:How to resolve the algorithm Priority queue step by step in the Elixir programming language