How to resolve the algorithm Bitmap step by step in the Icon and Unicon programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Bitmap step by step in the Icon and Unicon 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 Icon and Unicon programming language

Source code in the icon programming language

procedure makebitmap(width,height)
   return open("bitmap", "g", "canvas=hidden",
             "size="||width||","||height)
end
procedure fillimage(w,color)
   Fg(w,color)
   FillRectangle(w)
end
procedure setpixel(w,x,y,color)
   Fg(w,color)
   DrawPixel(x,y)
end
procedure getpixel(w,x,y)
   return Pixel(w,x,y)
end


  

You may also check:How to resolve the algorithm Palindrome detection step by step in the Java programming language
You may also check:How to resolve the algorithm Count occurrences of a substring step by step in the Transd programming language
You may also check:How to resolve the algorithm Draw a pixel step by step in the RPL programming language
You may also check:How to resolve the algorithm Search a list step by step in the Prolog programming language
You may also check:How to resolve the algorithm Fast Fourier transform step by step in the JavaScript programming language