Krzysztof Mossakowski
Windows Programming
2008 - Tasks
GDI+
Rotation transform
Demonstration
(secured with demo version of
Eziriz NET Reactor
)
Description:
Translation and rotation of an image
Use this sample picture -
task06_Salvador_Dali_The_Temptation_of_St_Anthony.png
(
Salvador Dali's "The Temptation of St.Anthony"
)
Functionality:
Image loaded form the program's resources
Image is always drawn in scale 100%, default location is (10,10)
Black dashed border is drawn around the image
Red circle (radius 5px) is drawn at each corner of the image
Green circle (radius 5px), a rotation center point, is drawn at image's center by default
Rotation center point, a green one, can be moved by mouse dragging
Image can be rotated around the green point by dragging one of the red points
Rotation angle determining
Whole image, including green point, can be moved by mouse dragging
Dragging outside the window should be possible
In window's caption cursor position in image space is presented
Image space has (0,0) in left upper corner of the image always
To transform point from client rectangle space into space of an image drawn using transformation matrix M, multiple point by inverted matrix M
AntiAlias has to be used, all the drawing should be flicker-free
Hints:
Matrix class, Graphics class, Graphics.Transform.Transform property
Matrix.Clone(), Matrix.Invert(), Matrix.Translate(), Matrix.RotateAt(), Matrix.TransformPoints()
Math.Atan2(), Math.Sqrt()
DashStyle enumerator, SmoothingMode enumerator
Control.Invalidate(), Control.Capture property
Approximate points:
image drawning (from resources) with border and points [2.0]
image translation [1.0]
independent green point translation [1.5]
dragging outside the window [0.5]
image rotation [4.0]
coordinates in window's caption [1.0]
Links for uploading:
Solutions
Corrections