Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DrawArcCommand Class Reference

#include <DrawCommand.h>

Inheritance diagram for DrawArcCommand:
DrawCommand

Public Member Functions

 DrawArcCommand (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
 
void execute (SkCanvas *canvas) const override
 
bool render (SkCanvas *canvas) const override
 
void toJSON (SkJSONWriter &writer, UrlDataManager &urlDataManager) const override
 
- Public Member Functions inherited from DrawCommand
 DrawCommand (OpType opType)
 
virtual ~DrawCommand ()
 
bool isVisible () const
 
void setVisible (bool toggle)
 
virtual void execute (SkCanvas *) const =0
 
virtual bool render (SkCanvas *canvas) const
 
virtual void toJSON (SkJSONWriter &writer, UrlDataManager &urlDataManager) const
 
OpType getOpType () const
 

Additional Inherited Members

- Public Types inherited from DrawCommand
enum  OpType {
  kBeginDrawPicture_OpType , kClear_OpType , kClipPath_OpType , kClipRegion_OpType ,
  kClipRect_OpType , kClipRRect_OpType , kClipShader_OpType , kResetClip_OpType ,
  kConcat_OpType , kConcat44_OpType , kDrawAnnotation_OpType , kDrawBitmap_OpType ,
  kDrawBitmapRect_OpType , kDrawDRRect_OpType , kDrawImage_OpType , kDrawImageLattice_OpType ,
  kDrawImageRect_OpType , kDrawImageRectLayer_OpType , kDrawOval_OpType , kDrawArc_OpType ,
  kDrawPaint_OpType , kDrawPatch_OpType , kDrawPath_OpType , kDrawPoints_OpType ,
  kDrawRect_OpType , kDrawRRect_OpType , kDrawRegion_OpType , kDrawShadow_OpType ,
  kDrawTextBlob_OpType , kDrawVertices_OpType , kDrawAtlas_OpType , kDrawDrawable_OpType ,
  kDrawEdgeAAQuad_OpType , kDrawEdgeAAImageSet_OpType , kEndDrawPicture_OpType , kRestore_OpType ,
  kSave_OpType , kSaveLayer_OpType , kSetMatrix_OpType , kSetM44_OpType ,
  kLast_OpType = kSetM44_OpType
}
 
- Static Public Member Functions inherited from DrawCommand
static void WritePNG (const SkBitmap &bitmap, SkWStream &out)
 
static const char * GetCommandString (OpType type)
 
static void MakeJsonColor (SkJSONWriter &, const SkColor color)
 
static void MakeJsonColor4f (SkJSONWriter &, const SkColor4f &color)
 
static void MakeJsonPoint (SkJSONWriter &, const SkPoint &point)
 
static void MakeJsonPoint (SkJSONWriter &, SkScalar x, SkScalar y)
 
static void MakeJsonPoint3 (SkJSONWriter &, const SkPoint3 &point)
 
static void MakeJsonRect (SkJSONWriter &, const SkRect &rect)
 
static void MakeJsonIRect (SkJSONWriter &, const SkIRect &)
 
static void MakeJsonMatrix (SkJSONWriter &, const SkMatrix &)
 
static void MakeJsonMatrix44 (SkJSONWriter &, const SkM44 &)
 
static void MakeJsonPath (SkJSONWriter &, const SkPath &path)
 
static void MakeJsonRegion (SkJSONWriter &, const SkRegion &region)
 
static void MakeJsonSampling (SkJSONWriter &, const SkSamplingOptions &sampling)
 
static void MakeJsonPaint (SkJSONWriter &, const SkPaint &paint, UrlDataManager &urlDataManager)
 
static void MakeJsonLattice (SkJSONWriter &, const SkCanvas::Lattice &lattice)
 
static void flatten (const SkFlattenable *flattenable, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
static bool flatten (const SkImage &image, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
static bool flatten (const SkBitmap &bitmap, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
- Static Public Attributes inherited from DrawCommand
static const int kOpTypeCount = kLast_OpType + 1
 

Detailed Description

Definition at line 398 of file DrawCommand.h.

Constructor & Destructor Documentation

◆ DrawArcCommand()

DrawArcCommand::DrawArcCommand ( const SkRect oval,
SkScalar  startAngle,
SkScalar  sweepAngle,
bool  useCenter,
const SkPaint paint 
)

Definition at line 1448 of file DrawCommand.cpp.

1453 : INHERITED(kDrawArc_OpType) {
1454 fOval = oval;
1455 fStartAngle = startAngle;
1456 fSweepAngle = sweepAngle;
1457 fUseCenter = useCenter;
1458 fPaint = paint;
1459}
const Paint & paint
Definition: color_source.cc:38
SkRect oval
Definition: SkRecords.h:249
SkScalar startAngle
Definition: SkRecords.h:250
SkScalar sweepAngle
Definition: SkRecords.h:251

Member Function Documentation

◆ execute()

void DrawArcCommand::execute ( SkCanvas canvas) const
overridevirtual

Implements DrawCommand.

Definition at line 1461 of file DrawCommand.cpp.

1461 {
1462 canvas->drawArc(fOval, fStartAngle, fSweepAngle, fUseCenter, fPaint);
1463}
void drawArc(const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
Definition: SkCanvas.cpp:2728

◆ render()

bool DrawArcCommand::render ( SkCanvas canvas) const
overridevirtual

Reimplemented from DrawCommand.

Definition at line 1465 of file DrawCommand.cpp.

1465 {
1466 canvas->clear(0xFFFFFFFF);
1467 canvas->save();
1468
1469 xlate_and_scale_to_bounds(canvas, fOval);
1470
1471 SkPaint p;
1472 p.setColor(SK_ColorBLACK);
1473 p.setStyle(SkPaint::kStroke_Style);
1474
1475 canvas->drawArc(fOval, fStartAngle, fSweepAngle, fUseCenter, p);
1476 canvas->restore();
1477
1478 return true;
1479}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void restore()
Definition: SkCanvas.cpp:461
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194

◆ toJSON()

void DrawArcCommand::toJSON ( SkJSONWriter writer,
UrlDataManager urlDataManager 
) const
overridevirtual

Reimplemented from DrawCommand.

Definition at line 1481 of file DrawCommand.cpp.

1481 {
1482 INHERITED::toJSON(writer, urlDataManager);
1484 MakeJsonRect(writer, fOval);
1485 writer.appendFloat(DEBUGCANVAS_ATTRIBUTE_STARTANGLE, fStartAngle);
1486 writer.appendFloat(DEBUGCANVAS_ATTRIBUTE_SWEEPANGLE, fSweepAngle);
1487 writer.appendBool(DEBUGCANVAS_ATTRIBUTE_USECENTER, fUseCenter);
1489 MakeJsonPaint(writer, fPaint, urlDataManager);
1490}
#define DEBUGCANVAS_ATTRIBUTE_STARTANGLE
#define DEBUGCANVAS_ATTRIBUTE_SWEEPANGLE
#define DEBUGCANVAS_ATTRIBUTE_PAINT
Definition: DrawCommand.cpp:73
#define DEBUGCANVAS_ATTRIBUTE_USECENTER
#define DEBUGCANVAS_ATTRIBUTE_COORDS
Definition: DrawCommand.cpp:69
static void MakeJsonPaint(SkJSONWriter &, const SkPaint &paint, UrlDataManager &urlDataManager)
virtual void toJSON(SkJSONWriter &writer, UrlDataManager &urlDataManager) const
static void MakeJsonRect(SkJSONWriter &, const SkRect &rect)
void appendFloat(float value)
Definition: SkJSONWriter.h:241
void appendBool(bool value)
Definition: SkJSONWriter.h:229
void appendName(const char *name)
Definition: SkJSONWriter.h:90

The documentation for this class was generated from the following files: