Re:Creating Isometric Tiles from Rectangular tiles
Hi Michael,
You shouldn't use TImage directly, but rather the Image.Picture.Bitmap
property and it's canvas.
The easiest way (assuming you have a TImage component named Image):
Iso := TBitmap.Create;
try
Iso.Width := 100;
Iso.Height := 100;
with Image.Picture.Bitmap do
Iso.Canvas.CopyRect(
rectangle(0,0,Iso.Width, Iso.Height), // Rectangle to copy to
Canvas, // Source canvas
rectangle(0,0, Width, Height)); // Source rectangle
// assign Iso back to Image
Image.Picture.Assign(Iso);
finally
Iso.Free;
end;
You can also directly access the pixels with Canvas.Pixels[x, y]; but this
is hideously slow.
Code is untested! Just wrote it out here.
Nils
www.abc-view.com
Quote
Michael Pham <mph...@mediaone.net> wrote in message news:3c0b1dc7_1@dnews...
> Does anyone have example code for translating a rectangular tile to an
> isometrict tile? I'm a little lost on the math and can't seem to find a
way
> to transfer pixels from one TImage to another.
> THX