Rabu, 25 Maret 2020

SMALL BASIC: Determining color of a pixel is it white or not

Hi, Welcome Small Basic Programmer.

In this tutorial we will learn about how to determine color of a pixel is it white or not using small basic.

The image will be traveled or traced up and down not to the right.

This code is the simplest way, you can use hex to decimal converter if you want.


GraphicsWindow.DrawImage("C:\Users\Totardo\testing.png",0,0)
For i = 0 To 200
  For j = 0 To 200
    TextWindow.WriteLine("i : " + i + ", j : " + j)
    pc = GraphicsWindow.GetPixel(i,j)
    GraphicsWindow.FillEllipse(i,j,10,10)
    If pc <> "#000000" Then
      TextWindow.WriteLine("It's not black i.e. it is white")
    Else
      TextWindow.WriteLine("It is black")
    EndIf
    Program.Delay(1000)
  EndFor
EndFor
  

Tidak ada komentar:

Posting Komentar