Fill/StrokeArc support for BPicture, courtesy of Lucasz Zemczak

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19103 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-10-23 11:54:44 +00:00
parent 0c40a6370e
commit 467dbaa9e2
2 changed files with 28 additions and 4 deletions

View File

@ -102,8 +102,10 @@ static void
stroke_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
float arcTheta)
{
/*view->ConvertToScreenForDrawing(&r);
view->Window()->GetDrawingEngine()->DrawArc(r, angle, span, view->CurrentState(), false);*/
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x,
center.y + radii.y);
view->ConvertToScreenForDrawing(&rect);
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, view->CurrentState(), false);
}
@ -111,8 +113,10 @@ static void
fill_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
float arcTheta)
{
/*view->ConvertToScreenForDrawing(&r);
view->Window()->GetDrawingEngine()->DrawArc(r, angle, span, view->CurrentState(), true);*/
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x,
center.y + radii.y);
view->ConvertToScreenForDrawing(&rect);
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, view->CurrentState(), true);
}

View File

@ -2427,6 +2427,26 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
break;
}
case AS_STROKE_ARC:
case AS_FILL_ARC:
{
BRect rect;
link.Read<BRect>(&rect);
float startTheta, arcTheta;
link.Read<float>(&startTheta);
link.Read<float>(&arcTheta);
BPoint radii((rect.Width() + 1) / 2, (rect.Height() + 1) / 2);
BPoint center = rect.LeftTop() + radii;
picture->BeginOp(code == AS_FILL_ARC ? B_PIC_FILL_ARC : B_PIC_STROKE_ARC);
picture->AddCoord(center);
picture->AddCoord(radii);
picture->AddFloat(startTheta);
picture->AddFloat(arcTheta);
picture->EndOp();
break;
}
case AS_STROKE_LINE:
{
float x1, y1, x2, y2;