Heya guys, basically here is some code for a simple example program:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
img1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Image : TBitmap;
begin
Image := TBitmap.create;
Image.Width := 800;
Image.Height := 600;
img1.Picture.Graphic := Image;
With img1.Picture.Bitmap.Canvas
do
begin
Pen.Color := clRed;
Pen.Width := 5;
MoveTo(100,100);
LineTo(100,120);
MoveTo(95,120);
LineTo(105,120);
MoveTo(100,110);
LineTo(110,113);
MoveTo(100,110);
LineTo(90,113);
end;
end;
end.
It's basically a program which simply draws some random canvas art. Here is a picture of the program once it is run:
[IMG]http://i55.tinypic.com/24pxoqv.png[/IMG]
The problem I have is rotating this art. Rather than going the long winded way of increasing and decreasing numbers in the MoveTo and LineTo procedures is there a way I can rotate this canvas art at any angle (e.g. right now it is facing north or 0 degrees but rotating it 45 degrees would make it face north east). Now I'm not good at copying functions from the internet so if you are going to help me, please paste the additional code inside the code that I have provided above and provide a brief explanation of how it works.
Thanks guys, your awesome!