Raster and Vector Graphics in Small Basic


Today, I’d like to talk about raster and vector graphics for Small Basic.

Raster Graphics

Raster graphics is about digital pictures painted with colored pixels (dots).  Paint is one of most popular program to create raster graphics (or bitmap).  There are a lot of formats for raster graphics – .bmp, .gif, .jpg, .png  and so on.  In Small Basic, these files can be loaded with following operations.

  • GraphicsWindow.DrawImage
  • GraphicsWindow.DrawResizedImage
  • ImageList.LoadImage
  • Shapes.AddImage

These files are binary files, not text files.  So we can not create these files with Small Basic program.  But a .ppm (portable pixmap) format is a text file.  So we can create .ppm with Small Basic program if we write the code for it.  Unfortunately, .ppm is not supported operations listed above.  Gimp (the GNU Image Manipulation Program) can read/write (import/export) .ppm file format.

Image Color Changer 0.25b (SDH367-5) is a sample program which reads a bitmap file.

Vector Graphics

Vector graphics is about digital pictures drawn with lines and shapes.  Adobe Illustrator is one of most popular program to create vector graphics.  Following formats can represent vector graphics – .ps (PostScript), .wmf (Windows Metafile), .svg (Scalable Vector Graphics) and so on.  These file formats are not supported in Small Basic with image operations listed above.  But a .svg is a text file.  So we can read/write this format if we write code for it. 

Shapes editor can create .svg file and .sb (.smallbasic) format vector graphics.  Following sample (SLK303) is generated by Shapes editor.

Comments (3)

  1. I didn't know that your Shapes Editor makes Vector graphics! That's pretty hardcore to offer a free tool for that! Especially one made with Small Basic! I always had to use Flash or Illustrator.

    Amazing!

  2. anonymouscommenter says:

    I found detailed information about raster and vector, mentioned below :

    http://www.vectorzmedia.com/…/what-is-vector-conversion.html

    Above reference would be helpful for understanding with graphic file formats.

Skip to main content