void Charge::Draw(CHwndRenderTarget* renderTarget, CRect& /*rect*/) const { // draw the charge D2D1_POINT_2F point; point.x = static_cast<float>(position.X * theApp.options.distanceUnitLength); point.y = static_cast<float>(position.Y * theApp.options.distanceUnitLength); CD2DSolidColorBrush *pBrush = new CD2DSolidColorBrush(renderTarget, charge > 0 ? theApp.options.positiveChargeColor : theApp.options.negativeChargeColor); CD2DSizeF size; size.height = theApp.options.chargeRadius; size.width = theApp.options.chargeRadius; renderTarget->FillEllipse(CD2DEllipse(point, size), pBrush); delete pBrush; }
virtual void FillEllipse(float x, float y, float width, float height) { m_pRenderTarget->FillEllipse(CD2DEllipse(CD2DRectF(x, y, x + width, y + height)), m_pFillBrush); }
virtual void DrawEllipse(float x, float y, float width, float height) { m_pRenderTarget->DrawEllipse(CD2DEllipse(CD2DRectF(x, y, x + width, y + height)), m_pLineBrush, m_lineWidth); }