void openFrameworksDevice::Arc( float left, float top, float right, float bottom, float startX, float startY, float endX, float endY ) { const float midX = (left + right) * 0.5f; const float midY = (top + bottom) * 0.5f; const float width = right - left; const float height = bottom - top; const float fromRadians = CoordToRadian( startX - midX, startY - midY ); const float toRadians = CoordToRadian( endX - midX, endY - midY ); ofPath path; path.arc(left, top, width, height, fromRadians, toRadians, true); path.setFilled(true); path.draw(); }
void CairoDevice::Arc( float left, float top, float right, float bottom, float startX, float startY, float endX, float endY ) { const float midX = (left + right) * 0.5f; const float midY = (top + bottom) * 0.5f; const float width = right - left; const float height = bottom - top; // - Draw const float angle1 = CoordToRadian( startX - midX, startY - midY ); const float angle2 = CoordToRadian( endX - midX, endY - midY ); cairo_save (fNativeDevice); cairo_translate (fNativeDevice, midX + width / 2., midY + height / 2.); cairo_scale (fNativeDevice, width / 2., height / 2.); cairo_arc (fNativeDevice, midX, midY, angle1, angle2, 0); cairo_restore (fNativeDevice); cairo_set_source_rgba (fNativeDevice, c2cc(fPenColor.mRed), c2cc(fPenColor.mGreen), c2cc(fPenColor.mBlue), c2cc(fPenColor.mAlpha)); cairo_stroke (fNativeDevice); }