2014-01-12 4 views
0

SlimDX 및 VB.net을 사용하는 사변형에 Direct2D의 이미지를 렌더링하려고 시도하는 프로그램이 있습니다.SlimDX Geometry (VB.NET)에 BitmapBrush를 통한 비트 맵 그리기

프로그램은 이미지를 렌더링해야하는 사변형 인 서버에서 4 포인트의 배열을 가져옵니다. (예를 들어)

점은 다음과 같습니다

points(0) = 20,10 <--Top left, where the geometry starts from 
points(1) = 40,10 <-- Top right 
points(2) = 40,40 <-- Bottom right 
points(3) = 20,40 <-- Bottom left 

...로드 및 비트 맵 미세 렌더링 할 수 있습니다 때 BitmapBrush가 구성되어 있지만, 사각형에 렌더링 할 때, 난 단지 (그것을 얻을 보인다 ...) 일부는 오른쪽 하단 구석. 참고로

: 여기 그릴 노력하고있어 이미지 : 여기 http://i.imgur.com/Dt3iHQ3.png

그리고 내가 (이미지를 그리는)를 사용하기 위해 노력하고있어 코드입니다. R은 포인트 목록이며 (위 참조) RenderBrush는 해당 이미지의 20x30 버전에서 만든 BitmapBrush입니다.

Private Sub DrawPoly(R() As PointF, ByRef RenderBrush As SlimDX.Direct2D.BitmapBrush) 
    'Create the geometry 
    Dim Path As PathGeometry 
    Path = New PathGeometry(factoryD2D) 
    Console.Clear() 
    'Get a handle to the Geometry 
    Dim Geometry = Path.Open() 
    'Set UP Geometry 
    Geometry.BeginFigure(R(0), FigureBegin.Filled) 
    Geometry.AddLines(R) 
    Geometry.EndFigure(FigureEnd.Closed) 
    Geometry.Close() 

    'Render 
    D2DRenderTarget.FillGeometry(Path, RenderBrush) 
    'and GC 
    Geometry.Dispose() 
    Path.Dispose() 
End Sub 

미리 도움을 청하십시오!

+0

난 아직 확실하지 않다, 브러시는 그리기하지 않는 것 ... –

답변

0

나는 그것을 알아 냈다. 이 형상에 그릴 얻으려면, 당신과 같이 변환 행렬을 설정해야합니다

Matrix3x2.Multiply(Matrix3x2.Translation(Point_To_Move_To), Matrix3x2.Rotation(Rotation, Point_To_Rotate_Around))