Draw a rotating line on a canvas


This is a hard one.

I am drawing the TCanva of a form using "Pixels [x, y] := MyColor;"

For example:
- Drawing area is 400x400 pixel starting at position 0,0.
- Draw a line from the center of the area (pos:200,200).
- Line length is half of area size 200 pixels (so it will never touch the corners...)
- Line width is always 1 pixel
Where it gets hard:
- The line color is diferent for each pixel
- The drawing area can change size
- I want to draw the line using radians
- I want to draw the line from center outward (so if the line is 200 pixels, pixel #1 is on center and #200 is at the end of the line)

Radians, pixel number, and color values come from a database. but for the purpouse of this project lets just assign a random value.

Hope you guys can help..
Who is Participating?
etiennedemersAuthor Commented:
X=Radius * COS(angle)
Y=Radius * SIN(angle)

The rest is self explanatory...
etiennedemersAuthor Commented:
Just to be cleared:

I want to call a function like

DrawAngleLine( RadValue)
Could also be in degrees, id doesn't mather
The tough part is figuring which pixels are to be drawn at a given angle...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.