Raster and Vector Graphics in Small Basic
Published Feb 12 2019 03:46 PM 668 Views
Senior Member
First published on MSDN on Feb 02, 2015

Authored by Nonki Takahashi

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.

Version history
Last update:
‎Feb 12 2019 03:46 PM
Updated by: