EasyBMP C++ Bitmap Library

EasyBMP Extensions: Geometry

Geometry is an extension to EasyBMP to draw anti-aliased lines and circular arcs (including full circles) of thickness one pixel. With modification, it could be used to draw thicker lines and circles. If you have need for such modifications, please contact support.

Click here to download the extension. (Contained in the extensions package)

Here are the main functions:

 void DrawArc( BMP &Image , double CenterX, double CenterY , double Radius,
  double FromTheta, double ToTheta , RGBApixel Color )

This function draws a 2x anti-aliased circular arc of thickness one with center at (CenterX,CenterY) of radius Radius from the angle of FromTheta to the angle of ToTheta. The color is Color. Notice that all angles are measured in the counterclockwise direction from the rightward direction.

 void DrawLine( BMP &Image, int FromX, int FromY, int ToX, int ToY,
  RGBApixel Color)

This function draws a 4x anti-aliased line of thickness 1 from pixel (FromX,FromY) to pixel (ToX,ToY) with color Color.

 void DrawFastLine( BMP &Image, int FromX, int FromY,
  int ToX, int ToY, RGBApixel Color);

This algorithm does precisely the same thing as the previous, but using the fast Bresenham algorithm. Note that the result will not be anti-aliased.