FX_BOOL CFDE_GdiDevice::FillPolygon(IFDE_Brush* pBrush, const CFX_PointsF& points, const CFX_Matrix* pMatrix) { Gdiplus::Brush* pGdiBrush = CreateGdiBrush(pBrush); if (pGdiBrush == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->FillPolygon( pGdiBrush, (const Gdiplus::PointF*)points.GetData(), points.GetSize()); RestoreMatrix(pMatrix); ReleaseGdiBrush(pGdiBrush); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::FillRectangle(IFDE_Brush* pBrush, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { Gdiplus::Brush* pGdiBrush = CreateGdiBrush(pBrush); if (pGdiBrush == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->FillRectangle( pGdiBrush, rect.left, rect.top, rect.width, rect.height); RestoreMatrix(pMatrix); ReleaseGdiBrush(pGdiBrush); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::DrawRectangle(IFDE_Pen* pPen, FX_FLOAT fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { Gdiplus::Pen* pGdiPen = CreateGdiPen(pPen, fPenWidth); if (pGdiPen == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->DrawRectangle(pGdiPen, rect.left, rect.top, rect.width, rect.height); RestoreMatrix(pMatrix); ReleaseGdiPen(pGdiPen); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::DrawPolygon(IFDE_Pen* pPen, FX_FLOAT fPenWidth, const CFX_PointsF& points, const CFX_Matrix* pMatrix) { Gdiplus::Pen* pGdiPen = CreateGdiPen(pPen, fPenWidth); if (pGdiPen == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->DrawPolygon( pGdiPen, (const Gdiplus::PointF*)points.GetData(), points.GetSize()); RestoreMatrix(pMatrix); ReleaseGdiPen(pGdiPen); return ret == Gdiplus::Ok; }
HRESULT KModelSFXLineGrass::Render() { SetMatrix(); KModel::SetMaterial(0); g_pd3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE,TRUE); float F = 1.0f; g_pd3dDevice->SetStreamSource( 0, m_lpVBuf,0, sizeof( LINE ) ); g_pd3dDevice->SetFVF( LINE_FVF ); g_pd3dDevice->DrawPrimitive ( D3DPT_POINTLIST , 0 , m_nNumFaces ); g_pd3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE,FALSE); RestoreMatrix(); return S_OK; }
FX_BOOL CFDE_GdiDevice::FillClosedCurve(IFDE_Brush* pBrush, const CFX_PointsF& points, FX_FLOAT fTension, const CFX_Matrix* pMatrix) { Gdiplus::Brush* pGdiBrush = CreateGdiBrush(pBrush); if (pGdiBrush == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->FillClosedCurve( pGdiBrush, (const Gdiplus::PointF*)points.GetData(), points.GetSize(), Gdiplus::FillModeAlternate, fTension); RestoreMatrix(pMatrix); ReleaseGdiBrush(pGdiBrush); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::DrawLine(IFDE_Pen* pPen, FX_FLOAT fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_Matrix* pMatrix) { Gdiplus::Pen* pGdiPen = CreateGdiPen(pPen, fPenWidth); if (pGdiPen == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->DrawLine(pGdiPen, pt1.x, pt1.y, pt2.x, pt2.y); RestoreMatrix(pMatrix); ReleaseGdiPen(pGdiPen); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::FillPath(IFDE_Brush* pBrush, const IFDE_Path* pPath, const CFX_Matrix* pMatrix) { CFDE_GdiPath* pGdiPath = (CFDE_GdiPath*)pPath; if (pGdiPath == NULL) { return FALSE; } Gdiplus::Brush* pGdiBrush = CreateGdiBrush(pBrush); if (pGdiBrush == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->FillPath(pGdiBrush, &pGdiPath->m_Path); RestoreMatrix(pMatrix); ReleaseGdiBrush(pGdiBrush); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::DrawPath(IFDE_Pen* pPen, FX_FLOAT fPenWidth, const IFDE_Path* pPath, const CFX_Matrix* pMatrix) { CFDE_GdiPath* pGdiPath = (CFDE_GdiPath*)pPath; if (pGdiPath == NULL) { return FALSE; } Gdiplus::Pen* pGdiPen = CreateGdiPen(pPen, fPenWidth); if (pGdiPen == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->DrawPath(pGdiPen, &pGdiPath->m_Path); RestoreMatrix(pMatrix); ReleaseGdiPen(pGdiPen); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::FillPie(IFDE_Brush* pBrush, const CFX_RectF& rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix* pMatrix) { startAngle = FX_RAD2DEG(startAngle); sweepAngle = FX_RAD2DEG(sweepAngle); Gdiplus::Brush* pGdiBrush = CreateGdiBrush(pBrush); if (pGdiBrush == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->FillPie(pGdiBrush, rect.left, rect.top, rect.width, rect.height, startAngle, sweepAngle); RestoreMatrix(pMatrix); ReleaseGdiBrush(pGdiBrush); return ret == Gdiplus::Ok; }
FX_BOOL CFDE_GdiDevice::DrawPie(IFDE_Pen* pPen, FX_FLOAT fPenWidth, const CFX_RectF& rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix* pMatrix) { startAngle = FX_RAD2DEG(startAngle); sweepAngle = FX_RAD2DEG(sweepAngle); Gdiplus::Pen* pGdiPen = CreateGdiPen(pPen, fPenWidth); if (pGdiPen == NULL) { return FALSE; } ApplyMatrix(pMatrix); Gdiplus::Status ret = m_pGraphics->DrawPie(pGdiPen, rect.left, rect.top, rect.width, rect.height, startAngle, sweepAngle); RestoreMatrix(pMatrix); ReleaseGdiPen(pGdiPen); return ret == Gdiplus::Ok; }
HRESULT KModelBelt::Render() { SetMatrix(); D3DXMATRIX MatCur = m_Matrix; g_pd3dDevice->GetTransform( D3DTS_WORLD , &MatCur); D3DXVECTOR3 A,B; D3DXVec3TransformCoord(&A,&m_BaseLine.A,&MatCur); D3DXVec3TransformCoord(&B,&m_BaseLine.B,&MatCur); m_CurLine.A = A; m_CurLine.B = B; if( m_bGotOne ) //初始化飘带 { InitialBelt(m_CurLine); m_bGotOne = FALSE; } /* if(!m_bShow) //非运动时飘带的状态 { SRCLINE LineA = m_SrcLineList.front(); UpdateAtRest(m_CurLine); UpdateExtend(); LineA = m_SrcLineList.front(); int j = 0; } else //运动时飘带的状态 { AddLine(m_CurLine); } */ // AddLine(m_CurLine); // UpdateAtRest(m_CurLine); AddLine(m_CurLine); if(m_bExtend) { UpdateExtend(); } D3DXMATRIX MatId; D3DXMatrixIdentity(&MatId); g_pd3dDevice->SetTransform( D3DTS_WORLD , &MatId); UpdateVertices(); KModel::SetMaterial(0); g_pd3dDevice->SetStreamSource( 0, m_lpVBuf,0, sizeof( VFormat::FACES_DIFFUSE_TEXTURE1 ) ); g_pd3dDevice->SetFVF( D3DFVF_Faces_Diffuse_Texture1 ); // g_pd3dDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME); g_pd3dDevice->DrawPrimitive ( D3DPT_TRIANGLESTRIP , 0 , m_nNumFaces); // SRCLINE LineK = m_vecSrcLine[0]; RestoreMatrix(); return S_OK; }