Krzysztof Mossakowski
Windows Programming
2005 - Tasks
GDI+
Version B
Splines
Demonstration
Functionality:
draw curve using points set by the user
selected point drawn as red rectangle
points drawn as green rectangles
splines drawn using white pen with width set in menu
user interface:
Left mouse button click - adds new point
Left mouse button drag - moves selected point
Delete key - removes the last point
Escape - removes all points
settings of drawing, available in menu (use checkmarks as in the demonstration):
Bezier or cardinal splines
Bezier splines will be visible when the number of points is 4, 7, 10, 13, 16 etc.
using antialiasing
width of pen for drawing splines (values: 1.0, 5.0, 10.0)
curve tension for drawing cardinal splines (values: 0.0, 0.5, 1.0, 2.0, 5.0)
Technical requirements:
scale the scene properly after window's resizing
do not let to flicker (during drawing, moving the point and resizing the window)
maximum number of points: 2000
Hints:
Bitmap class
Graphics methods:
FromImage(), DrawImage(),
ScaleTransform(), TransformPoints()
DrawCurve(), DrawBeziers(), DrawRectangle(),
SetSmoothingMode()
CheckMenuItem(), CheckMenuRadioItem()
Approximate points:
drawing, mouse and keyboard processing: 3.0
scaling the scene: 2.5
no flickering: 2.5
changing settings: 2.0