问题描述:

I am looking to load multiple DDS files onto a form but not sure on where to start.

I have looked at Asphyre Sphinx 3 and the DX11_JSB headers for Delphi, but im not sure XE6 is the right environment for this.

Very little documentation for XE6 and Direct X.

I can't post any source code, because i don't know where to begin.

What would be the best way to load these DDS files onto my form (kind of like a Map Viewer / Editor where i could zoom in and out, etc)

const

caly_00 = 'E:\Delphi Projects\OpenP\Maps\map_cal_0.dds';

caly_01 = 'E:\Delphi Projects\OpenP\Maps\map_cal_1.dds';

caly_02 = 'E:\Delphi Projects\OpenP\Maps\map_cal_2.dds';

caly_03 = 'E:\Delphi Projects\OpenP\Maps\map_cal_3.dds';

caly_04 = 'E:\Delphi Projects\OpenP\Maps\map_cal_4.dds';

caly_05 = 'E:\Delphi Projects\OpenP\Maps\map_cal_5.dds';

procedure TForm2.FormPaint(Sender: TObject);

var

cvs: TDirect2DCanvas;

iBitmapBrush: ID2D1BitmapBrush;

iBitmap_Caly_0, iBitmap_Caly_1, iBitmap_Caly_2, iBitmap_Caly_3, iBitmap_Caly_4, iBitmap_Caly_5: ID2D1Bitmap;

Size0, Size1, Size2, Size3, Size4, Size5: TD2DSizeF;

i: integer;

begin

cvs := TDirect2DCanvas.Create(Canvas, ClientRect);

iBitmap_Caly_0 := GetD2D1Bitmap(cvs.RenderTarget, Caly_00);

iBitmap_Caly_0.GetSize(Size0);

iBitmap_Caly_1 := GetD2D1Bitmap(cvs.RenderTarget, Caly_01);

iBitmap_Caly_1.GetSize(Size1);

iBitmap_Caly_2 := GetD2D1Bitmap(cvs.RenderTarget, Caly_05);

iBitmap_Caly_2.GetSize(Size2);

iBitmap_Caly_3 := GetD2D1Bitmap(cvs.RenderTarget, Caly_04);

iBitmap_Caly_3.GetSize(Size3);

iBitmap_Caly_4 := GetD2D1Bitmap(cvs.RenderTarget, Caly_03);

iBitmap_Caly_4.GetSize(Size4);

iBitmap_Caly_5 := GetD2D1Bitmap(cvs.RenderTarget, Caly_02);

iBitmap_Caly_5.GetSize(Size5);

cvs.BeginDraw;

cvs.RenderTarget.SetTransform(TD2DMatrix3x2F.Translation(0, 0));

cvs.RenderTarget.DrawBitmap(iBitmap_Caly_0, nil, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, nil);

cvs.RenderTarget.SetTransform(TD2DMatrix3x2F.Translation(Size0.Height, 0));

cvs.RenderTarget.DrawBitmap(iBitmap_Caly_1, nil, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, nil);

cvs.RenderTarget.SetTransform(TD2DMatrix3x2F.Translation(Size1.Height, Size2.Width));

cvs.RenderTarget.DrawBitmap(iBitmap_Caly_2, nil, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, nil);

cvs.RenderTarget.SetTransform(TD2DMatrix3x2F.Translation(0, Size0.Width));

cvs.RenderTarget.DrawBitmap(iBitmap_Caly_3, nil, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, nil);

cvs.EndDraw;

cvs.Free;

end;

So this will load the images properly to the form, but now i want to zoom in and out, and when i hold down left mouse button you can drag to another position on the image map.

相关阅读:
Top