How to resolve the algorithm Bitmap step by step in the FreeBASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Bitmap step by step in the FreeBASIC programming language

Table of Contents

Problem Statement

Show a basic storage type to handle a simple RGB raster graphics image, and some primitive associated functions. If possible provide a function to allocate an uninitialised image, given its width and height, and provide 3 additional functions:

(If there are specificities about the storage or the allocation, explain those.) These functions are used as a base for the articles in the category raster graphics operations, and a basic output function to check the results is available in the article write ppm file.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Bitmap step by step in the FreeBASIC programming language

Source code in the freebasic programming language

Screenres 320, 240, 8
Dim Shared As Integer w, h
Screeninfo w, h
Const As Ubyte cyan    = 3
Const As Ubyte red     = 4

Sub rellenar(c As Integer)
    Line (0,0) - (w/3, h/3), red, BF
End Sub

Sub establecePixel(x As Integer, y As Integer, c As Integer)
    Pset (x,y), cyan
End Sub

rellenar(12)
establecePixel(10,10, cyan)
Locate 12
Print "pixel 10,10 es " & Point(10,10)
Print "pixel 20,20 es " & Point(20,10)

Bsave "FreeBASIC_bitmap.bmp", 0
Sleep

  

You may also check:How to resolve the algorithm Truncatable primes step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Test a function step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Self-describing numbers step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Boyer-Moore string search step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Jump anywhere step by step in the FreeBASIC programming language