2017-07-28 19:18:29 +00:00
SkCanvas Reference
===
2018-05-16 11:07:07 +00:00
# <a name='Canvas'>Canvas</a>
# <a name='SkCanvas'>Class SkCanvas</a>
< a href = '#Canvas' > Canvas< / a > provides an interface for drawing, and how the drawing is clipped and transformed.
< a href = '#Canvas' > Canvas< / a > contains a stack of < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > values.
< a href = '#Canvas' > Canvas< / a > and < a href = 'SkPaint_Reference#Paint' > Paint< / a > together provide the state to draw into < a href = 'SkSurface_Reference#Surface' > Surface< / a > or < a href = 'undocumented#Device' > Device< / a > .
Each < a href = '#Canvas' > Canvas< / a > draw call transforms the geometry of the object by the concatenation of all
< a href = '#Matrix' > Matrix< / a > values in the stack. The transformed geometry is clipped by the intersection
of all of < a href = '#Clip' > Clip< / a > values in the stack. The < a href = '#Canvas' > Canvas< / a > draw calls use < a href = 'SkPaint_Reference#Paint' > Paint< / a > to supply drawing
state such as < a href = 'SkColor_Reference#Color' > Color< / a > , < a href = 'undocumented#Typeface' > Typeface< / a > , text size, stroke width, < a href = 'undocumented#Shader' > Shader< / a > and so on.
To draw to a pixel-based destination, create < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > or < a href = 'undocumented#GPU_Surface' > GPU Surface< / a > .
Request < a href = '#Canvas' > Canvas< / a > from < a href = 'SkSurface_Reference#Surface' > Surface< / a > to obtain the interface to draw.
< a href = '#Canvas' > Canvas< / a > generated by < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > draws to memory visible to the CPU.
< a href = '#Canvas' > Canvas< / a > generated by < a href = 'undocumented#GPU_Surface' > GPU Surface< / a > uses Vulkan or OpenGL to draw to the GPU.
2018-06-27 15:00:21 +00:00
To draw to a document, obtain < a href = '#Canvas' > Canvas< / a > from < a href = 'undocumented#Canvas' > SVG Canvas< / a > , < a href = 'undocumented#PDF' > Document PDF< / a > , or < a href = 'undocumented#Picture_Recorder' > Picture Recorder< / a > .
2018-05-30 13:21:49 +00:00
< a href = 'undocumented#Document' > Document< / a > based < a href = '#Canvas' > Canvas< / a > and other < a href = '#Canvas' > Canvas< / a > < a href = 'undocumented#Subclasses' > Subclasses< / a > reference < a href = 'undocumented#Device' > Device< / a > describing the
2017-08-03 21:14:08 +00:00
destination.
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > can be constructed to draw to < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > without first creating < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > .
2018-01-04 21:11:51 +00:00
This approach may be deprecated in the future.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
## Overview
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Constant' > Constants</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > enum and enum class, and their const values</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Constructor' > Constructors</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > functions that construct < a href = '#SkCanvas' > SkCanvas</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Member_Function' > Functions</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > global and class member functions</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Related_Function' > Related Functions</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > similar member functions grouped together</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Struct' > Struct Declarations</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > embedded struct members</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Typedef' > Typedef Declarations</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > types defined by other types</ td >
< / tr >
< / table >
## <a name='Related_Function'>Related Function</a>
SkCanvas global, < code > struct< / code > , and < code > class< / code > related member functions share a topic.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Clip' > Clip</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > stack of clipping < a href = 'SkPath_Reference#Path' > Paths</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw' > Draw</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws into < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw_Image' > Draw Image</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkImage_Reference#Image' > Image</ a > to < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw_Image_Lattice' > Draw Image Lattice</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > divides < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > or < a href = 'SkImage_Reference#Image' > Image</ a > into a rectangular grid</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw_Text' > Draw Text</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text into < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Layer' > Layer</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > temporary < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > to draw into</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Layer_SaveLayerRec' > Layer SaveLayerRec</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > contains the state used to create the < a href = '#Layer' > Layer</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Matrix' > Matrix</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > coordinate transformation</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Pixels' > Pixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > read and write pixel values</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Property' > Property</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > metrics and attributes</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#State_Stack' > State Stack</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > stack of state for hierarchical drawing</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Utility' > Utility</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > rarely called management functions</ td >
< / tr >
< / table >
## <a name='Constant'>Constant</a>
SkCanvas related constants are defined by < code > enum< / code > , < code > enum class< / code > , < code > #define< / code > , < code > const< / code > , and < code > constexpr< / code > .
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_ColorBehavior_kLegacy' > ColorBehavior::kLegacy</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > placeholder</ td >
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_ColorBehavior' > ColorBehavior</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > exists for Android framework only</ td >
< / tr >
2018-06-27 15:00:21 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_PointMode' > PointMode</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets < a href = '#SkCanvas_drawPoints' > drawPoints</ a > options</ td >
< / tr >
2018-06-27 15:00:21 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_SaveLayerFlagsSet' > SaveLayerFlagsSet</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec</ a > options</ td >
< / tr >
2018-06-27 15:00:21 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets < a href = '#SkCanvas_drawImageRect' > drawImageRect</ a > options</ td >
< / tr >
2018-06-27 15:00:21 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sample outside bounds; faster</ td >
< / tr >
2018-06-27 15:00:21 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kInitWithPrevious_SaveLayerFlag' > kInitWithPrevious SaveLayerFlag</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > initializes with previous contents</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kLines_PointMode' > kLines PointMode</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draw each pair of points as a line segment</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kPoints_PointMode' > kPoints PointMode</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draw each point separately</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kPolygon_PointMode' > kPolygon PointMode</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draw the array of points as a open polygon</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kPreserveLCDText_SaveLayerFlag' > kPreserveLCDText SaveLayerFlag</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates < a href = '#Layer' > Layer</ a > for LCD text</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sample only inside bounds; slower</ td >
< / tr >
< / table >
## <a name='Struct'>Struct</a>
SkCanvas uses C++ structs to declare the public data structures and interfaces.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_Lattice' > Lattice</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > divides < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > or < a href = 'SkImage_Reference#Image' > Image</ a > into a rectangular grid</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > contains the state used to create the < a href = '#Layer' > Layer</ a ></ td >
< / tr >
< / table >
## <a name='Typedef'>Typedef</a>
SkCanvas < code > typedef< / code > define a data type.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > options for < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec</ a ></ td >
< / tr >
< / table >
## <a name='Constructor'>Constructor</a>
Create the desired type of < a href = 'SkSurface_Reference#Surface' > Surface< / a > to obtain its < a href = '#Canvas' > Canvas< / a > when possible. Useful
when no < a href = 'SkSurface_Reference#Surface' > Surface< / a > is required, and some helpers implicitly create < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > .
SkCanvas can be constructed or initialized by these functions, including C++ class constructors.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates from < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo</ a > and < a href = 'undocumented#Storage' > Pixel Storage</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_MakeRasterDirectN32' > MakeRasterDirectN32</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates from image data and < a href = 'undocumented#Storage' > Pixel Storage</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_empty_constructor' > SkCanvas()</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates with no < a href = 'SkSurface_Reference#Surface' > Surface</ a > , no dimensions</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_copy_const_SkBitmap' > SkCanvas(const SkBitmap& bitmap)</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > uses existing < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_const_SkBitmap' > SkCanvas(const SkBitmap& bitmap, ColorBehavior behavior)</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > exists for Android framework only</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps' > SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props)</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > uses existing < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > and < a href = 'undocumented#Surface_Properties' > Surface Properties</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_int_int_const_SkSurfaceProps_star' > SkCanvas(int width, int height, const SkSurfaceProps* props = nullptr)</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates with no < a href = 'SkSurface_Reference#Surface' > Surface</ a > , set dimensions, < a href = 'undocumented#Surface_Properties' > Surface Properties</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_makeSurface' > makeSurface</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates < a href = 'SkSurface_Reference#Surface' > Surface</ a > matching < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo</ a > and < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_destructor' > ~SkCanvas()</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws saved < a href = '#Layer' > Layers</ a > , frees resources</ td >
< / tr >
< / table >
## <a name='Member_Function'>Member Function</a>
SkCanvas member functions read and modify the structure properties.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates from < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo</ a > and < a href = 'undocumented#Storage' > Pixel Storage</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_MakeRasterDirectN32' > MakeRasterDirectN32</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates from image data and < a href = 'undocumented#Storage' > Pixel Storage</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_accessTopLayerPixels' > accessTopLayerPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel access if available</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_accessTopRasterHandle' > accessTopRasterHandle</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns context that tracks < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_androidFramework_setDeviceClipRestriction' > androidFramework setDeviceClipRestriction</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > exists for use by Android framework</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clear' > clear</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkColor_Reference#Color' > Color</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clipPath' > clipPath</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > combines < a href = '#Clip' > Clip</ a > with < a href = 'SkPath_Reference#Path' > Path</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clipRRect' > clipRRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > combines < a href = '#Clip' > Clip</ a > with < a href = 'SkRRect_Reference#RRect' > Round Rect</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clipRect' > clipRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > combines < a href = '#Clip' > Clip</ a > with < a href = 'SkRect_Reference#Rect' > Rect</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clipRegion' > clipRegion</ a ></ td >
2018-08-10 17:09:13 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > combines < a href = '#Clip' > Clip</ a > with < a href = 'SkRegion_Reference#Region' > Region</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_concat' > concat</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > multiplies < a href = '#Matrix' > Matrix</ a > by < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_discard' > discard</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > makes < a href = '#Canvas' > Canvas</ a > contents undefined</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAnnotation' > drawAnnotation</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > associates a < a href = 'SkRect_Reference#Rect' > Rect</ a > with a key-value pair</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawArc' > drawArc</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Arc' > Arc</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas' > drawAtlas</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws sprites using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawBitmap' > drawBitmap</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > at (x, y) position</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws proportionally stretched < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Nine_Patch' > Nine Patch</ a > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap</ a > , source < a href = 'SkRect_Reference#Rect' > Rect</ a > to destination < a href = 'SkRect_Reference#Rect' > Rect</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawCircle' > drawCircle</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Circle' > Circle</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawColor' > drawColor</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkColor_Reference#Color' > Color</ a > and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDRRect' > drawDRRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws double < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > stroked or filled</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDrawable' > drawDrawable</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Drawable' > Drawable</ a > , encapsulated drawing commands</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawIRect' > drawIRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkIRect_Reference#IRect' > IRect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawImage' > drawImage</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkImage_Reference#Image' > Image</ a > at (x, y) position</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawImageLattice' > drawImageLattice</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws proportionally stretched < a href = 'SkImage_Reference#Image' > Image</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawImageNine' > drawImageNine</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Nine_Patch' > Nine Patch</ a > < a href = 'SkImage_Reference#Image' > Image</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawImageRect' > drawImageRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkImage_Reference#Image' > Image</ a > , source < a href = 'SkRect_Reference#Rect' > Rect</ a > to destination < a href = 'SkRect_Reference#Rect' > Rect</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawLine' > drawLine</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws line segment between two points</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawOval' > drawOval</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Oval' > Oval</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPaint' > drawPaint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPatch' > drawPatch</ a ></ td >
2018-06-14 16:28:14 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Coons_Patch' > Coons Patch</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPath' > drawPath</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkPath_Reference#Path' > Path</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture' > drawPicture</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkPicture_Reference#Picture' > Picture</ a > using < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoint' > drawPoint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws point at (x, y) position</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoints' > drawPoints</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws array as points, lines, polygon</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPosText' > drawPosText</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at array of (x, y) positions</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPosTextH' > drawPosTextH</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at x positions with common baseline</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRRect' > drawRRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRect' > drawRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRect_Reference#Rect' > Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRegion' > drawRegion</ a ></ td >
2018-08-10 17:09:13 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRegion_Reference#Region' > Region</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRoundRect' > drawRoundRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawString' > drawString</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws null terminated string at (x, y) using font advance</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawText' > drawText</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at (x, y), using font advance</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextBlob' > drawTextBlob</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text with arrays of positions and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text following < a href = 'SkPath_Reference#Path' > Path</ a > contour</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextOnPathHV' > drawTextOnPathHV</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text following < a href = 'SkPath_Reference#Path' > Path</ a > with offsets</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text with array of < a href = 'undocumented#RSXform' > RSXform</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices' > drawVertices</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Vertices' > Vertices</ a > , a triangle mesh</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_flush' > flush</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > triggers execution of all pending draw operations</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns size of base < a href = '#Layer' > Layer</ a > in global coordinates</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkIRect_Reference#IRect' > IRect</ a > bounds of < a href = '#Clip' > Clip</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getGrContext' > getGrContext</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'undocumented#GPU_Context' > GPU Context</ a > of the < a href = 'undocumented#GPU_Surface' > GPU Surface</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = '#Clip' > Clip</ a > bounds in source coordinates</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getMetaData' > getMetaData</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > associates additional data with the canvas</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getProps' > getProps</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies < a href = 'undocumented#Surface_Properties' > Surface Properties</ a > if available</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getSaveCount' > getSaveCount</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns depth of stack containing < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getTotalMatrix' > getTotalMatrix</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_imageInfo' > imageInfo</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > for < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_isClipEmpty' > isClipEmpty</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Clip' > Clip</ a > is empty</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_isClipRect' > isClipRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Clip' > Clip</ a > is < a href = 'SkRect_Reference#Rect' > Rect</ a > and not empty</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_makeSurface' > makeSurface</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > creates < a href = 'SkSurface_Reference#Surface' > Surface</ a > matching < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo</ a > and < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_peekPixels' > peekPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Canvas' > Canvas</ a > has direct access to its pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_quickReject' > quickReject</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = 'SkRect_Reference#Rect' > Rect</ a > is outside < a href = '#Clip' > Clip</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_readPixels' > readPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts rectangle of pixels from < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_resetMatrix' > resetMatrix</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > resets < a href = '#Matrix' > Matrix</ a > to identity</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_restore' > restore</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > restores changes to < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > , pops save stack</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_restoreToCount' > restoreToCount</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > restores changes to < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > to given depth</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_rotate' > rotate</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > rotates < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_save' > save</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > saves < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > on stack</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_saveLayer' > saveLayer</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > saves < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > on stack; creates < a href = '#Layer' > Layer</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > saves < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > on stack; creates < a href = '#Layer' > Layer</ a > ; sets opacity</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > saves < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a > on stack; creates < a href = '#Layer' > Layer</ a > for LCD text</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_scale' > scale</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > scales < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_setMatrix' > setMatrix</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_skew' > skew</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > skews < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_translate' > translate</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > translates < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_writePixels' > writePixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts rectangle of pixels to < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< / table >
< a name = 'SkCanvas_MakeRasterDirect' > < / a >
2017-07-28 19:18:29 +00:00
## MakeRasterDirect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
static std::unique_ptr< < a href = '#SkCanvas' > SkCanvas< / a > > < a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & info, void* pixels,
2017-11-27 15:44:06 +00:00
size_t rowBytes,
2018-05-16 11:07:07 +00:00
const < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > * props = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Allocates raster < a href = '#Canvas' > Canvas< / a > that will draw directly into < a href = '#SkCanvas_MakeRasterDirect_pixels' > pixels< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > is returned if all parameters are valid.
2017-08-03 21:14:08 +00:00
Valid parameters include:
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > dimensions are zero or positive;
< a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > contains < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > supported by < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > ;
< a href = '#SkCanvas_MakeRasterDirect_pixels' > pixels< / a > is not nullptr;
< a href = '#SkCanvas_MakeRasterDirect_rowBytes' > rowBytes< / a > is zero or large enough to contain < a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > width < a href = '#SkCanvas_MakeRasterDirect_pixels' > pixels< / a > of < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Pass zero for < a href = '#SkCanvas_MakeRasterDirect_rowBytes' > rowBytes< / a > to compute < a href = '#SkCanvas_MakeRasterDirect_rowBytes' > rowBytes< / a > from < a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > width and size of pixel.
If < a href = '#SkCanvas_MakeRasterDirect_rowBytes' > rowBytes< / a > is greater than zero, it must be equal to or greater than
< a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > width times bytes required for < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > .
2017-08-24 16:59:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > buffer size should be < a href = '#SkCanvas_MakeRasterDirect_info' > info< / a > height times computed < a href = '#SkCanvas_MakeRasterDirect_rowBytes' > rowBytes< / a > .
< a href = '#Pixels' > Pixels< / a > are not initialized.
To access < a href = '#SkCanvas_MakeRasterDirect_pixels' > pixels< / a > after drawing, call < a href = '#SkCanvas_flush' > flush< / a > or < a href = '#SkCanvas_peekPixels' > peekPixels< / a > .
2017-08-03 21:14:08 +00:00
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_MakeRasterDirect_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , < a href = 'undocumented#Color_Space' > Color Space< / a > , of < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > ;
2017-08-03 21:14:08 +00:00
width, or height, or both, may be zero< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirect_pixels' > < code > < strong > pixels< / strong > < / code > < / a > < / td >
< td > pointer to destination < a href = '#SkCanvas_MakeRasterDirect_pixels' > pixels< / a > buffer< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirect_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > interval from one < a href = 'SkSurface_Reference#Surface' > Surface< / a > row to the next, or zero< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirect_props' > < code > < strong > props< / strong > < / code > < / a > < / td >
< td > LCD striping orientation and setting for device independent fonts;
2017-11-27 15:44:06 +00:00
may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > if all parameters are valid; otherwise, nullptr
2017-07-28 19:18:29 +00:00
### Example
2017-11-27 15:44:06 +00:00
< div > < fiddle-embed name = "525285073aae7e53eb8f454a398f880c" > < div > Allocates a three by three bitmap, clears it to white, and draws a black pixel
2018-03-05 18:26:16 +00:00
in the center.
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
---
-x-
---
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirectN32' > MakeRasterDirectN32< / a > < a href = 'SkSurface_Reference#SkSurface_MakeRasterDirect' > SkSurface::MakeRasterDirect< / a >
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_MakeRasterDirectN32' > < / a >
2017-07-28 19:18:29 +00:00
## MakeRasterDirectN32
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
static std::unique_ptr< < a href = '#SkCanvas' > SkCanvas< / a > > < a href = '#SkCanvas_MakeRasterDirectN32' > MakeRasterDirectN32< / a > (int width, int height, < a href = 'SkColor_Reference#SkPMColor' > SkPMColor< / a > * pixels,
2017-07-28 19:18:29 +00:00
size_t rowBytes)
< / pre >
2018-05-16 11:07:07 +00:00
Allocates raster < a href = '#Canvas' > Canvas< / a > specified by inline image specification. Subsequent < a href = '#Canvas' > Canvas< / a >
calls draw into < a href = '#SkCanvas_MakeRasterDirectN32_pixels' > pixels< / a > .
< a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is set to < a href = 'SkImageInfo_Reference#kN32_SkColorType' > kN32_SkColorType< / a > .
< a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > is set to < a href = 'SkImageInfo_Reference#kPremul_SkAlphaType' > kPremul_SkAlphaType< / a > .
To access < a href = '#SkCanvas_MakeRasterDirectN32_pixels' > pixels< / a > after drawing, call < a href = '#SkCanvas_flush' > flush< / a > or < a href = '#SkCanvas_peekPixels' > peekPixels< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > is returned if all parameters are valid.
2017-08-03 21:14:08 +00:00
Valid parameters include:
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirectN32_width' > width< / a > and < a href = '#SkCanvas_MakeRasterDirectN32_height' > height< / a > are zero or positive;
< a href = '#SkCanvas_MakeRasterDirectN32_pixels' > pixels< / a > is not nullptr;
< a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > is zero or large enough to contain < a href = '#SkCanvas_MakeRasterDirectN32_width' > width< / a > < a href = '#SkCanvas_MakeRasterDirectN32_pixels' > pixels< / a > of < a href = 'SkImageInfo_Reference#kN32_SkColorType' > kN32_SkColorType< / a > .
2017-08-24 16:59:48 +00:00
2018-05-16 11:07:07 +00:00
Pass zero for < a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > to compute < a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > from < a href = '#SkCanvas_MakeRasterDirectN32_width' > width< / a > and size of pixel.
If < a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > is greater than zero, it must be equal to or greater than
< a href = '#SkCanvas_MakeRasterDirectN32_width' > width< / a > times bytes required for < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > buffer size should be < a href = '#SkCanvas_MakeRasterDirectN32_height' > height< / a > times < a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > .
2017-08-03 21:14:08 +00:00
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_MakeRasterDirectN32_width' > < code > < strong > width< / strong > < / code > < / a > < / td >
< td > pixel column count on < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > created; must be zero or greater< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirectN32_height' > < code > < strong > height< / strong > < / code > < / a > < / td >
< td > pixel row count on < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > created; must be zero or greater< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirectN32_pixels' > < code > < strong > pixels< / strong > < / code > < / a > < / td >
< td > pointer to destination < a href = '#SkCanvas_MakeRasterDirectN32_pixels' > pixels< / a > buffer; buffer size should be < a href = '#SkCanvas_MakeRasterDirectN32_height' > height< / a >
times < a href = '#SkCanvas_MakeRasterDirectN32_rowBytes' > rowBytes< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_MakeRasterDirectN32_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > interval from one < a href = 'SkSurface_Reference#Surface' > Surface< / a > row to the next, or zero< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > if all parameters are valid; otherwise, nullptr
2017-07-28 19:18:29 +00:00
### Example
2018-07-12 12:40:13 +00:00
< div > < fiddle-embed name = "4cacf302830e644234d522f6e2f8f580" > < div > Allocates a three by three bitmap, clears it to white, and draws a black pixel
2018-03-05 18:26:16 +00:00
in the center.
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
---
-x-
---
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = 'SkSurface_Reference#SkSurface_MakeRasterDirect' > SkSurface::MakeRasterDirect< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_MakeN32Premul' > SkImageInfo::MakeN32Premul< / a > < sup > < a href = 'SkImageInfo_Reference#SkImageInfo_MakeN32Premul_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_empty_constructor' > < / a >
2017-07-28 19:18:29 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkCanvas' > SkCanvas< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Creates an empty < a href = '#Canvas' > Canvas< / a > with no backing device or pixels, with
2017-08-24 16:59:48 +00:00
a width and height of zero.
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
empty < a href = '#Canvas' > Canvas< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-03-05 18:26:16 +00:00
< div > < fiddle-embed name = "903451d6c93bf69e2833747a3e8cc8f7" > < div > Passes a placeholder to a function that requires one.
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint draws text left to right
paint draws text top to bottom
paint draws text top to bottom
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = 'undocumented#SkRasterHandleAllocator_MakeCanvas' > SkRasterHandleAllocator::MakeCanvas< / a > < a href = 'SkSurface_Reference#SkSurface_getCanvas' > SkSurface::getCanvas< / a > < a href = 'undocumented#SkCreateColorSpaceXformCanvas' > SkCreateColorSpaceXformCanvas< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_int_int_const_SkSurfaceProps_star' > < / a >
2017-07-28 19:18:29 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkCanvas' > SkCanvas< / a > (int width, int height, const < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > * props = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Creates < a href = '#Canvas' > Canvas< / a > of the specified dimensions without a < a href = 'SkSurface_Reference#Surface' > Surface< / a > .
2018-05-30 13:21:49 +00:00
Used by < a href = 'undocumented#Subclasses' > Subclasses< / a > with custom implementations for draw member functions.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_int_int_const_SkSurfaceProps_star_props' > props< / a > equals nullptr, < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > are created with
< a href = 'undocumented#Legacy_Font_Host' > Surface Properties Legacy Font Host< / a > settings, which choose the pixel striping
2017-09-14 15:25:39 +00:00
direction and order. Since a platform may dynamically change its direction when
the device is rotated, and since a platform may have multiple monitors with
different characteristics, it is best not to rely on this legacy behavior.
2017-08-03 21:14:08 +00:00
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_int_int_const_SkSurfaceProps_star_width' > < code > < strong > width< / strong > < / code > < / a > < / td >
< td > zero or greater< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_int_int_const_SkSurfaceProps_star_height' > < code > < strong > height< / strong > < / code > < / a > < / td >
< td > zero or greater< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_int_int_const_SkSurfaceProps_star_props' > < code > < strong > props< / strong > < / code > < / a > < / td >
< td > LCD striping orientation and setting for device independent fonts;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > placeholder with dimensions
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "ce6a5ef2df447970b4453489d9d67930" >
#### Example Output
~~~~
canvas is empty
~~~~
< / fiddle-embed > < / div >
2017-08-03 21:14:08 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > < a href = 'undocumented#SkPixelGeometry' > SkPixelGeometry< / a > < a href = 'undocumented#SkCreateColorSpaceXformCanvas' > SkCreateColorSpaceXformCanvas< / a >
2017-08-03 21:14:08 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_copy_SkBaseDevice' > < / a >
2017-07-28 19:18:29 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
explicit < a href = '#SkCanvas' > SkCanvas< / a > (< a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'undocumented#SkBaseDevice' > SkBaseDevice< / a > > device)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Deprecated.
2018-02-06 14:41:53 +00:00
soon
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_copy_const_SkBitmap' > < / a >
2017-07-28 19:18:29 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
explicit < a href = '#SkCanvas' > SkCanvas< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Constructs a canvas that draws into < a href = '#SkCanvas_copy_const_SkBitmap_bitmap' > bitmap< / a > .
2018-05-16 11:07:07 +00:00
Sets < a href = 'undocumented#SkSurfaceProps_kLegacyFontHost_InitType' > SkSurfaceProps::kLegacyFontHost InitType< / a > in constructed < a href = 'SkSurface_Reference#Surface' > Surface< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > is copied so that subsequently editing < a href = '#SkCanvas_copy_const_SkBitmap_bitmap' > bitmap< / a > will not affect
constructed < a href = '#Canvas' > Canvas< / a > .
2017-08-03 21:14:08 +00:00
May be deprecated in the future.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_copy_const_SkBitmap_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and pixel
storage of < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > that can be used to draw into < a href = '#SkCanvas_copy_const_SkBitmap_bitmap' > bitmap< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "dd92db963af190e849894038f39b598a" > < div > The actual output depends on the installed fonts.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
-----
2017-08-29 21:36:51 +00:00
---x-
---x-
---x-
---x-
---x-
---x-
2017-07-28 19:18:29 +00:00
-----
2017-08-29 21:36:51 +00:00
---x-
---x-
2017-07-28 19:18:29 +00:00
-----
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = 'undocumented#SkRasterHandleAllocator_MakeCanvas' > SkRasterHandleAllocator::MakeCanvas< / a > < a href = 'SkSurface_Reference#SkSurface_getCanvas' > SkSurface::getCanvas< / a > < a href = 'undocumented#SkCreateColorSpaceXformCanvas' > SkCreateColorSpaceXformCanvas< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='SkCanvas_ColorBehavior'>Enum SkCanvas::ColorBehavior</a>
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum class < a href = '#SkCanvas_ColorBehavior' > ColorBehavior< / a > {
< a href = '#SkCanvas_ColorBehavior_kLegacy' > kLegacy< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_ColorBehavior_kLegacy' >< code > SkCanvas::ColorBehavior::kLegacy</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Is a placeholder to allow specialized constructor; has no meaning.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< / table >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_const_SkBitmap' > < / a >
2017-08-03 21:14:08 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkCanvas' > SkCanvas< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, < a href = '#SkCanvas_ColorBehavior' > ColorBehavior< / a > behavior)
2017-08-03 21:14:08 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
For use by Android framework only.
2018-05-16 11:07:07 +00:00
2017-08-03 21:14:08 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_const_SkBitmap_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > specifies a < a href = '#SkCanvas_const_SkBitmap_bitmap' > bitmap< / a > for the canvas to draw into< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_const_SkBitmap_behavior' > < code > < strong > behavior< / strong > < / code > < / a > < / td >
< td > specializes this constructor; value is unused< / td >
2017-08-03 21:14:08 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > that can be used to draw into < a href = '#SkCanvas_const_SkBitmap_bitmap' > bitmap< / a >
2017-08-03 21:14:08 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_const_SkBitmap_const_SkSurfaceProps' > < / a >
2017-07-28 19:18:29 +00:00
## SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkCanvas' > SkCanvas< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > & props)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Constructs a canvas that draws into < a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps_bitmap' > bitmap< / a > .
2018-05-16 11:07:07 +00:00
Use < a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps_props' > props< / a > to match the device characteristics, like LCD striping.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps_bitmap' > bitmap< / a > is copied so that subsequently editing < a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps_bitmap' > bitmap< / a > will not affect
constructed < a href = '#Canvas' > Canvas< / a > .
2017-08-03 21:14:08 +00:00
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_const_SkBitmap_const_SkSurfaceProps_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > ,
and pixel storage of < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_const_SkBitmap_const_SkSurfaceProps_props' > < code > < strong > props< / strong > < / code > < / a > < / td >
< td > order and orientation of RGB striping; and whether to use
2017-08-03 21:14:08 +00:00
device independent fonts< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > that can be used to draw into < a href = '#SkCanvas_const_SkBitmap_const_SkSurfaceProps_bitmap' > bitmap< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-03-05 18:26:16 +00:00
< div > < fiddle-embed name = "c26cfae4c42cb445240335cc12a50235" > < div > The actual output depends on the installed fonts.
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
-----
---x-
---x-
---x-
---x-
---x-
---x-
-----
---x-
---x-
-----
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = 'undocumented#SkRasterHandleAllocator_MakeCanvas' > SkRasterHandleAllocator::MakeCanvas< / a > < a href = 'SkSurface_Reference#SkSurface_getCanvas' > SkSurface::getCanvas< / a > < a href = 'undocumented#SkCreateColorSpaceXformCanvas' > SkCreateColorSpaceXformCanvas< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_destructor' > < / a >
2017-07-28 19:18:29 +00:00
## ~SkCanvas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
virtual < a href = '#SkCanvas_destructor' > ~SkCanvas< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Draws saved < a href = '#Layer' > Layers< / a > , if any.
Frees up resources used by < a href = '#Canvas' > Canvas< / a > .
2017-07-28 19:18:29 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "b7bc91ff16c9b9351b2a127f35394b82" > < div > < a href = '#Canvas' > Canvas< / a > < a href = '#Layer' > Layer< / a > draws into bitmap. < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > sets up an additional
drawing surface that blends with the bitmap. When < a href = '#Layer' > Layer< / a > goes out of
2018-05-30 13:21:49 +00:00
scope, < a href = '#Layer' > Layer< / a > < a href = 'undocumented#Destructor' > Destructor< / a > is called. The saved < a href = '#Layer' > Layer< / a > is restored, drawing
2018-03-05 18:26:16 +00:00
transparent letters.
< / div > < / fiddle-embed > < / div >
2017-08-03 21:14:08 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#State_Stack' > State Stack< / a >
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Property'>Property</a>
2018-02-07 12:27:09 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns size of base < a href = '#Layer' > Layer</ a > in global coordinates</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getGrContext' > getGrContext</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'undocumented#GPU_Context' > GPU Context</ a > of the < a href = 'undocumented#GPU_Surface' > GPU Surface</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getMetaData' > getMetaData</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > associates additional data with the canvas</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_getProps' > getProps</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies < a href = 'undocumented#Surface_Properties' > Surface Properties</ a > if available</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_imageInfo' > imageInfo</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > for < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_isClipEmpty' > isClipEmpty</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Clip' > Clip</ a > is empty</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_isClipRect' > isClipRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Clip' > Clip</ a > is < a href = 'SkRect_Reference#Rect' > Rect</ a > and not empty</ td >
< / tr >
< / table >
< a name = 'SkCanvas_getMetaData' > < / a >
2017-07-28 19:18:29 +00:00
## getMetaData
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'undocumented#SkMetaData' > SkMetaData< / a > & < a href = '#SkCanvas_getMetaData' > getMetaData< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2017-08-24 16:59:48 +00:00
Returns storage to associate additional data with the canvas.
2018-05-16 11:07:07 +00:00
The storage is freed when < a href = '#Canvas' > Canvas< / a > is deleted.
2017-07-28 19:18:29 +00:00
### Return Value
2017-08-03 21:14:08 +00:00
storage that can be read from and written to
2017-07-28 19:18:29 +00:00
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "1598396056045e8d0c583b748293d652" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
before: (null)
during: Hello!
after: (null)
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkMetaData' > SkMetaData< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_imageInfo' > < / a >
2017-07-28 19:18:29 +00:00
## imageInfo
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > < a href = '#SkCanvas_imageInfo' > imageInfo< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > for < a href = '#Canvas' > Canvas< / a > . If < a href = '#Canvas' > Canvas< / a > is not associated with < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > or
< a href = 'undocumented#GPU_Surface' > GPU Surface< / a > , returned < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is set to < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
dimensions and < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > of < a href = '#Canvas' > Canvas< / a >
2017-07-28 19:18:29 +00:00
### Example
2017-08-03 21:14:08 +00:00
< div > < fiddle-embed name = "d93389d971f8084c4ccc7a66e4e157ee" >
#### Example Output
~~~~
emptyInfo == canvasInfo
~~~~
< / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > < a href = '#SkCanvas_MakeRasterDirect' > MakeRasterDirect< / a > < a href = '#SkCanvas_makeSurface' > makeSurface< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getProps' > < / a >
2017-07-28 19:18:29 +00:00
## getProps
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_getProps' > getProps< / a > (< a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > * props) const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Copies < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > , if < a href = '#Canvas' > Canvas< / a > is associated with < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > or
< a href = 'undocumented#GPU_Surface' > GPU Surface< / a > , and returns true. Otherwise, returns false and leave < a href = '#SkCanvas_getProps_props' > props< / a > unchanged.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_getProps_props' > < code > < strong > props< / strong > < / code > < / a > < / td >
< td > storage for writable < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > was copied
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "0fbf2dedc2619bbfbf173c9e3bc1a508" >
#### Example Output
~~~~
isRGB:0
isRGB:1
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > < a href = '#SkCanvas_makeSurface' > makeSurface< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Utility'>Utility</a>
2018-02-07 12:27:09 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_accessTopLayerPixels' > accessTopLayerPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel access if available</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_accessTopRasterHandle' > accessTopRasterHandle</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns context that tracks < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_discard' > discard</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > makes < a href = '#Canvas' > Canvas</ a > contents undefined</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_flush' > flush</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > triggers execution of all pending draw operations</ td >
< / tr >
< / table >
< a name = 'SkCanvas_flush' > < / a >
2017-07-28 19:18:29 +00:00
## flush
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_flush' > flush< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-01-04 21:11:51 +00:00
Triggers the immediate execution of all pending draw operations.
2018-05-16 11:07:07 +00:00
If < a href = '#Canvas' > Canvas< / a > is associated with < a href = 'undocumented#GPU_Surface' > GPU Surface< / a > , resolves all pending GPU operations.
If < a href = '#Canvas' > Canvas< / a > is associated with < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > , has no effect; raster draw
2017-11-02 21:49:34 +00:00
operations are never deferred.
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_peekPixels' > peekPixels< / a > < a href = 'SkSurface_Reference#SkSurface_flush' > SkSurface::flush()< / a > < a href = 'undocumented#GrContext_flush' > GrContext::flush()< / a > < a href = 'SkSurface_Reference#SkSurface_prepareForExternalIO' > SkSurface::prepareForExternalIO< / a > GrContext::abandonContext()
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getBaseLayerSize' > < / a >
2017-07-28 19:18:29 +00:00
## getBaseLayerSize
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
virtual < a href = 'undocumented#SkISize' > SkISize< / a > < a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Gets the size of the base or root < a href = '#Layer' > Layer< / a > in global canvas coordinates. The
origin of the base < a href = '#Layer' > Layer< / a > is always (0,0). The area available for drawing may be
smaller (due to clipping or < a href = '#SkCanvas_saveLayer' > saveLayer< / a > ).
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
integral width and height of base < a href = '#Layer' > Layer< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "374e245d91cd729eca48fd20e631fdf3" >
#### Example Output
~~~~
clip=10,30
size=20,30
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > < sup > < a href = '#SkCanvas_getDeviceClipBounds_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_makeSurface' > < / a >
2017-07-28 19:18:29 +00:00
## makeSurface
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkSurface_Reference#SkSurface' > SkSurface< / a > > < a href = '#SkCanvas_makeSurface' > makeSurface< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & info, const < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a > * props = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Creates < a href = 'SkSurface_Reference#Surface' > Surface< / a > matching < a href = '#SkCanvas_makeSurface_info' > info< / a > and < a href = '#SkCanvas_makeSurface_props' > props< / a > , and associates it with < a href = '#Canvas' > Canvas< / a > .
2017-08-03 21:14:08 +00:00
Returns nullptr if no match found.
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_makeSurface_props' > props< / a > is nullptr, matches < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > in < a href = '#Canvas' > Canvas< / a > . If < a href = '#SkCanvas_makeSurface_props' > props< / a > is nullptr and < a href = '#Canvas' > Canvas< / a >
does not have < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > , creates < a href = 'SkSurface_Reference#Surface' > Surface< / a > with default < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_makeSurface_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and < a href = 'undocumented#Color_Space' > Color Space< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_makeSurface_props' > < code > < strong > props< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Surface_Properties' > Surface Properties< / a > to match; may be nullptr to match < a href = '#Canvas' > Canvas< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
< a href = 'SkSurface_Reference#Surface' > Surface< / a > matching < a href = '#SkCanvas_makeSurface_info' > info< / a > and < a href = '#SkCanvas_makeSurface_props' > props< / a > , or nullptr if no match is available
2017-07-28 19:18:29 +00:00
### Example
2018-07-03 05:29:30 +00:00
< div > < fiddle-embed name = "1ce28351444b41ab2b8e3128a4b9b9c2" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
compatible != nullptr
size = 3, 4
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkSurface_Reference#SkSurface' > SkSurface< / a > < a href = 'SkSurface_Reference#SkSurface_makeSurface' > SkSurface::makeSurface< / a > < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > < a href = 'undocumented#SkSurfaceProps' > SkSurfaceProps< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getGrContext' > < / a >
2017-07-28 19:18:29 +00:00
## getGrContext
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
virtual < a href = 'undocumented#GrContext' > GrContext< / a > * < a href = '#SkCanvas_getGrContext' > getGrContext< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'undocumented#GPU_Context' > GPU Context< / a > of the < a href = 'undocumented#GPU_Surface' > GPU Surface< / a > associated with < a href = '#Canvas' > Canvas< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#GPU_Context' > GPU Context< / a > , if available; nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-09 05:28:19 +00:00
< div > < fiddle-embed name = "c4ea949e5fa5a0630dcb6b0204bd498f" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#GrContext' > GrContext< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_accessTopLayerPixels' > < / a >
2017-07-28 19:18:29 +00:00
## accessTopLayerPixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void* < a href = '#SkCanvas_accessTopLayerPixels' > accessTopLayerPixels< / a > (< a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > * info, size_t* rowBytes, < a href = 'SkIPoint_Reference#SkIPoint' > SkIPoint< / a > * origin = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns the pixel base address, < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > , < a href = '#SkCanvas_accessTopLayerPixels_rowBytes' > rowBytes< / a > , and < a href = '#SkCanvas_accessTopLayerPixels_origin' > origin< / a > if the pixels
2017-08-03 21:14:08 +00:00
can be read directly. The returned address is only valid
2018-05-16 11:07:07 +00:00
while < a href = '#Canvas' > Canvas< / a > is in scope and unchanged. Any < a href = '#Canvas' > Canvas< / a > call or < a href = 'SkSurface_Reference#Surface' > Surface< / a > call
2017-07-28 19:18:29 +00:00
may invalidate the returned address and other returned values.
2018-05-16 11:07:07 +00:00
If pixels are inaccessible, < a href = '#SkCanvas_accessTopLayerPixels_info' > info< / a > , < a href = '#SkCanvas_accessTopLayerPixels_rowBytes' > rowBytes< / a > , and < a href = '#SkCanvas_accessTopLayerPixels_origin' > origin< / a > are unchanged.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_accessTopLayerPixels_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > storage for writable pixels' < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > ; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_accessTopLayerPixels_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > storage for writable pixels' row bytes; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_accessTopLayerPixels_origin' > < code > < strong > origin< / strong > < / code > < / a > < / td >
< td > storage for < a href = '#Canvas' > Canvas< / a > top < a href = '#Layer' > Layer< / a > < a href = '#SkCanvas_accessTopLayerPixels_origin' > origin< / a > , its top-left corner;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-30 12:58:10 +00:00
address of pixels, or nullptr if inaccessible
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "38d0d6ca9bea146d31bcbec197856359" > < / fiddle-embed > < / div >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "a7ac9c21bbabcdeeca00f72a61cd0f3e" > < div > Draws "" on the device. Then draws "" in < a href = '#Layer' > Layer< / a > , and reads
< a href = '#Layer' > Layer< / a > to add a large dotted "". Finally blends < a href = '#Layer' > Layer< / a > with the
2018-01-04 21:11:51 +00:00
device.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
The < a href = '#Layer' > Layer< / a > and blended result appear on the CPU and GPU but the large dotted
2018-03-05 18:26:16 +00:00
"" appear only on the CPU.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > < a href = 'SkPixmap_Reference#SkPixmap' > SkPixmap< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_accessTopRasterHandle' > < / a >
2017-07-28 19:18:29 +00:00
## accessTopRasterHandle
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'undocumented#SkRasterHandleAllocator_Handle' > SkRasterHandleAllocator::Handle< / a > < a href = '#SkCanvas_accessTopRasterHandle' > accessTopRasterHandle< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns custom context that tracks the < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Use < a href = 'undocumented#Raster_Handle_Allocator' > Raster Handle Allocator< / a > to blend Skia drawing with custom drawing, typically performed
2017-10-04 18:31:33 +00:00
by the host platform user interface. The custom context returned is generated by
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkRasterHandleAllocator_MakeCanvas' > SkRasterHandleAllocator::MakeCanvas< / a > , which creates a custom canvas with raster storage for
2017-07-28 19:18:29 +00:00
the drawing destination.
### Return Value
2017-09-01 19:51:02 +00:00
context of custom allocation
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "4486d0c0b22ad2931db130f42da4c80c" > < div > < / div >
#### Example Output
~~~~
context = skia
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkRasterHandleAllocator' > SkRasterHandleAllocator< / a >
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Pixels'>Pixels</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_peekPixels' > peekPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns if < a href = '#Canvas' > Canvas</ a > has direct access to its pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_readPixels' > readPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts rectangle of pixels from < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_readPixels' > readPixels(const SkImageInfo& dstInfo, void* dstPixels, size t dstRowBytes, int srcX, int srcY)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_readPixels_2' > readPixels(const SkPixmap& pixmap, int srcX, int srcY)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_readPixels_3' > readPixels(const SkBitmap& bitmap, int srcX, int srcY)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_writePixels' > writePixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts rectangle of pixels to < a href = '#Canvas' > Canvas</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_writePixels' > writePixels(const SkImageInfo& info, const void* pixels, size t rowBytes, int x, int y)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_writePixels_2' > writePixels(const SkBitmap& bitmap, int x, int y)</ a ></ td >
< / tr >
< / table >
2018-02-07 12:27:09 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_peekPixels' > < / a >
2017-07-28 19:18:29 +00:00
## peekPixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_peekPixels' > peekPixels< / a > (< a href = 'SkPixmap_Reference#SkPixmap' > SkPixmap< / a > * pixmap)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns true if < a href = '#Canvas' > Canvas< / a > has direct access to its pixels.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are readable when < a href = 'undocumented#Device' > Device< / a > is raster. < a href = '#Pixels' > Pixels< / a > are not readable when < a href = '#Canvas' > Canvas< / a >
is returned from < a href = 'undocumented#GPU_Surface' > GPU Surface< / a > , returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > , returned by
< a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility class
like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_peekPixels_pixmap' > pixmap< / a > is valid only while < a href = '#Canvas' > Canvas< / a > is in scope and unchanged. Any
< a href = '#Canvas' > Canvas< / a > or < a href = 'SkSurface_Reference#Surface' > Surface< / a > call may invalidate the < a href = '#SkCanvas_peekPixels_pixmap' > pixmap< / a > values.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_peekPixels_pixmap' > < code > < strong > pixmap< / strong > < / code > < / a > < / td >
< td > storage for pixel state if pixels are readable; otherwise, ignored< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#Canvas' > Canvas< / a > has direct access to pixels
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "e9411d676d1fa13b46331abe9e14ad3e" >
#### Example Output
~~~~
width=256 height=256
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_readPixels' > readPixels< / a > < sup > < a href = '#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_peekPixels' > SkBitmap::peekPixels< / a > < a href = 'SkImage_Reference#SkImage_peekPixels' > SkImage::peekPixels< / a > < a href = 'SkSurface_Reference#SkSurface_peekPixels' > SkSurface::peekPixels< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_readPixels' > < / a >
2017-07-28 19:18:29 +00:00
## readPixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_readPixels' > readPixels< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels from < a href = '#Canvas' > Canvas< / a > into < a href = '#SkCanvas_readPixels_dstPixels' > dstPixels< / a > . < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > are
2018-01-04 21:11:51 +00:00
ignored.
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
Source < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (< a href = '#SkCanvas_readPixels_srcX' > srcX< / a > , < a href = '#SkCanvas_readPixels_srcY' > srcY< / a > ) and (< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .width(), < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .height()).
Destination < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (0, 0) and (< a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .width(), < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .height()).
2017-08-24 16:59:48 +00:00
Copies each readable pixel intersecting both rectangles, without scaling,
2018-05-16 11:07:07 +00:00
converting to < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .colorType() and < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .alphaType() if required.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are readable when < a href = 'undocumented#Device' > Device< / a > is raster, or backed by a GPU.
< a href = '#Pixels' > Pixels< / a > are not readable when < a href = '#SkCanvas' > SkCanvas< / a > is returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > ,
returned by < a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility
class like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
The destination pixel storage must be allocated by the caller.
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > values are converted only if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
2018-03-12 12:09:48 +00:00
do not match. Only pixels within both source and destination rectangles
2018-05-16 11:07:07 +00:00
are copied. < a href = '#SkCanvas_readPixels_dstPixels' > dstPixels< / a > contents outside < a href = 'SkRect_Reference#Rect' > Rect< / a > intersection are unchanged.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Pass negative values for < a href = '#SkCanvas_readPixels_srcX' > srcX< / a > or < a href = '#SkCanvas_readPixels_srcY' > srcY< / a > to offset pixels across or down destination.
2018-03-12 12:09:48 +00:00
Does not copy, and returns false if:
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > Source and destination rectangles do not intersect.< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels could not be converted to < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .colorType() or < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .alphaType().< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels are not readable; for instance, < a href = '#Canvas' > Canvas< / a > is document-based.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_readPixels_dstRowBytes' > dstRowBytes< / a > is too small to contain one row of pixels.< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_readPixels_dstInfo' > < code > < strong > dstInfo< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > of < a href = '#SkCanvas_readPixels_dstPixels' > dstPixels< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_dstPixels' > < code > < strong > dstPixels< / strong > < / code > < / a > < / td >
< td > storage for pixels; < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .height() times < a href = '#SkCanvas_readPixels_dstRowBytes' > dstRowBytes< / a > , or larger< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_dstRowBytes' > < code > < strong > dstRowBytes< / strong > < / code > < / a > < / td >
< td > size of one destination row; < a href = '#SkCanvas_readPixels_dstInfo' > dstInfo< / a > .width() times pixel size, or larger< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_srcX' > < code > < strong > srcX< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on x-axis; may be negative< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_srcY' > < code > < strong > srcY< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on y-axis; may be negative< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
true if pixels were copied
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "102d014d7f753db2a9b9ee08893aaf11" > < div > A black circle drawn on a blue background provides an image to copy.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_readPixels' > readPixels< / a > copies one quarter of the canvas into each of the four corners.
2018-03-05 18:26:16 +00:00
The copied quarter circles overdraw the original circle.
< / div > < / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "481e990e923a0ed34654f4361b94f096" > < div > < a href = '#Canvas' > Canvas< / a > returned by < a href = 'undocumented#Raster_Surface' > Raster Surface< / a > has < a href = 'undocumented#Premultiply' > Premultiplied< / a > pixel values.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clear' > clear< / a > takes < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > input with < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > equal 0x80
2018-05-17 16:17:28 +00:00
and RGB equal 0x55, 0xAA, 0xFF. RGB is multiplied by < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a >
2018-05-16 11:07:07 +00:00
to generate < a href = 'undocumented#Premultiply' > Premultiplied< / a > value 0x802B5580. < a href = '#SkCanvas_readPixels' > readPixels< / a > converts pixel back
to < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > value 0x8056A9FF, introducing error.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
pixel = 802b5580
pixel = 8056a9ff
~~~~
< / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_peekPixels' > peekPixels< / a > < a href = '#SkCanvas_writePixels' > writePixels< / a > < sup > < a href = '#SkCanvas_writePixels_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels' > SkPixmap::readPixels< / a > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_3' > [3]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_4' > [4]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-08-24 16:59:48 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_readPixels_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_readPixels' > readPixels< / a > (const < a href = 'SkPixmap_Reference#SkPixmap' > SkPixmap< / a > & pixmap, int srcX, int srcY)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels from < a href = '#Canvas' > Canvas< / a > into < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > . < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > are
2017-11-27 15:44:06 +00:00
ignored.
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
Source < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (< a href = '#SkCanvas_readPixels_2_srcX' > srcX< / a > , < a href = '#SkCanvas_readPixels_2_srcY' > srcY< / a > ) and (< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .width(), < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .height()).
Destination < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (0, 0) and (< a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .width(), < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .height()).
2017-08-24 16:59:48 +00:00
Copies each readable pixel intersecting both rectangles, without scaling,
2018-05-16 11:07:07 +00:00
converting to < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .colorType() and < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .alphaType() if required.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are readable when < a href = 'undocumented#Device' > Device< / a > is raster, or backed by a GPU.
< a href = '#Pixels' > Pixels< / a > are not readable when < a href = '#SkCanvas' > SkCanvas< / a > is returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > ,
returned by < a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility
class like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Caller must allocate pixel storage in < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > if needed.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > values are converted only if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
do not match. Only pixels within both source and destination < a href = 'SkRect_Reference#Rect' > Rects< / a >
are copied. < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > pixels contents outside < a href = 'SkRect_Reference#Rect' > Rect< / a > intersection are unchanged.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Pass negative values for < a href = '#SkCanvas_readPixels_2_srcX' > srcX< / a > or < a href = '#SkCanvas_readPixels_2_srcY' > srcY< / a > to offset pixels across or down < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .
2018-03-12 12:09:48 +00:00
Does not copy, and returns false if:
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > Source and destination rectangles do not intersect.< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels could not be converted to < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .colorType() or < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .alphaType().< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels are not readable; for instance, < a href = '#Canvas' > Canvas< / a > is document-based.< / td >
< / tr > < tr >
< td > < a href = 'SkPixmap_Reference#Pixmap' > Pixmap< / a > pixels could not be allocated.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_readPixels_2_pixmap' > pixmap< / a > .rowBytes() is too small to contain one row of pixels.< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_readPixels_2_pixmap' > < code > < strong > pixmap< / strong > < / code > < / a > < / td >
< td > storage for pixels copied from < a href = '#Canvas' > Canvas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_2_srcX' > < code > < strong > srcX< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on x-axis; may be negative< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_2_srcY' > < code > < strong > srcY< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on y-axis; may be negative< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
true if pixels were copied
2017-07-28 19:18:29 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "85f199032943b6483722c34a91c4e20f" > < div > < a href = '#SkCanvas_clear' > clear< / a > takes < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > input with < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > equal 0x80
2018-05-17 16:17:28 +00:00
and RGB equal 0x55, 0xAA, 0xFF. RGB is multiplied by < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a >
2018-05-16 11:07:07 +00:00
to generate < a href = 'undocumented#Premultiply' > Premultiplied< / a > value 0x802B5580.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
pixel = 802b5580
~~~~
< / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_peekPixels' > peekPixels< / a > < a href = '#SkCanvas_writePixels' > writePixels< / a > < sup > < a href = '#SkCanvas_writePixels_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels' > SkPixmap::readPixels< / a > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_3' > [3]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_4' > [4]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-08-24 16:59:48 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_readPixels_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_readPixels' > readPixels< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, int srcX, int srcY)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels from < a href = '#Canvas' > Canvas< / a > into < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > . < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > are
2017-11-27 15:44:06 +00:00
ignored.
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
Source < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (< a href = '#SkCanvas_readPixels_3_srcX' > srcX< / a > , < a href = '#SkCanvas_readPixels_3_srcY' > srcY< / a > ) and (< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .width(), < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .height()).
Destination < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (0, 0) and (< a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .width(), < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .height()).
2017-08-24 16:59:48 +00:00
Copies each readable pixel intersecting both rectangles, without scaling,
2018-05-16 11:07:07 +00:00
converting to < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .colorType() and < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .alphaType() if required.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are readable when < a href = 'undocumented#Device' > Device< / a > is raster, or backed by a GPU.
< a href = '#Pixels' > Pixels< / a > are not readable when < a href = '#SkCanvas' > SkCanvas< / a > is returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > ,
returned by < a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility
class like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Caller must allocate pixel storage in < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > if needed.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > values are converted only if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
2018-03-12 12:09:48 +00:00
do not match. Only pixels within both source and destination rectangles
2018-05-16 11:07:07 +00:00
are copied. < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > pixels outside < a href = 'SkRect_Reference#Rect' > Rect< / a > intersection are unchanged.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Pass negative values for < a href = '#SkCanvas_readPixels_3_srcX' > srcX< / a > or < a href = '#SkCanvas_readPixels_3_srcY' > srcY< / a > to offset pixels across or down < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .
2018-03-12 12:09:48 +00:00
Does not copy, and returns false if:
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > Source and destination rectangles do not intersect.< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels could not be converted to < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .colorType() or < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .alphaType().< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels are not readable; for instance, < a href = '#Canvas' > Canvas< / a > is document-based.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > pixels could not be allocated.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_readPixels_3_bitmap' > bitmap< / a > .rowBytes() is too small to contain one row of pixels.< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_readPixels_3_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > storage for pixels copied from < a href = '#Canvas' > Canvas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_3_srcX' > < code > < strong > srcX< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on x-axis; may be negative< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_readPixels_3_srcY' > < code > < strong > srcY< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into readable pixels on y-axis; may be negative< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
true if pixels were copied
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "af6dec8ef974aa67bf102f29915bcd6a" > < div > < a href = '#SkCanvas_clear' > clear< / a > takes < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > input with < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > equal 0x80
2018-05-17 16:17:28 +00:00
and RGB equal 0x55, 0xAA, 0xFF. RGB is multiplied by < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a >
2018-05-16 11:07:07 +00:00
to generate < a href = 'undocumented#Premultiply' > Premultiplied< / a > value 0x802B5580.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
pixel = 802b5580
~~~~
< / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_peekPixels' > peekPixels< / a > < a href = '#SkCanvas_writePixels' > writePixels< / a > < sup > < a href = '#SkCanvas_writePixels_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels' > SkPixmap::readPixels< / a > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_3' > [3]< / a > < / sup > < sup > < a href = 'SkPixmap_Reference#SkPixmap_readPixels_4' > [4]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-08-24 16:59:48 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_writePixels' > < / a >
2017-07-28 19:18:29 +00:00
## writePixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_writePixels' > writePixels< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & info, const void* pixels, size_t rowBytes, int x, int y)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkRect_Reference#Rect' > Rect< / a > from < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > to < a href = '#Canvas' > Canvas< / a > . < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > are ignored.
Source < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (0, 0) and (< a href = '#SkCanvas_writePixels_info' > info< / a > .width(), < a href = '#SkCanvas_writePixels_info' > info< / a > .height()).
Destination < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (< a href = '#SkCanvas_writePixels_x' > x< / a > , < a href = '#SkCanvas_writePixels_y' > y< / a > ) and
(< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .width(), < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .height()).
2017-09-21 16:31:06 +00:00
Copies each readable pixel intersecting both rectangles, without scaling,
2018-05-16 11:07:07 +00:00
converting to < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .colorType() and < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .alphaType() if required.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are writable when < a href = 'undocumented#Device' > Device< / a > is raster, or backed by a GPU.
< a href = '#Pixels' > Pixels< / a > are not writable when < a href = '#SkCanvas' > SkCanvas< / a > is returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > ,
returned by < a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility
class like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > values are converted only if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
do not match. Only < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > within both source and destination rectangles
are copied. < a href = '#Canvas' > Canvas< / a > < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > outside < a href = 'SkRect_Reference#Rect' > Rect< / a > intersection are unchanged.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Pass negative values for < a href = '#SkCanvas_writePixels_x' > x< / a > or < a href = '#SkCanvas_writePixels_y' > y< / a > to offset < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > to the left or
above < a href = '#Canvas' > Canvas< / a > < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > .
2018-03-12 12:09:48 +00:00
Does not copy, and returns false if:
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > Source and destination rectangles do not intersect.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > could not be converted to < a href = '#Canvas' > Canvas< / a > < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .colorType() or
< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .alphaType().< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > are not writable; for instance, < a href = '#Canvas' > Canvas< / a > is document-based.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_writePixels_rowBytes' > rowBytes< / a > is too small to contain one row of < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > .< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_writePixels_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > of < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_pixels' > < code > < strong > pixels< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > to copy, of size < a href = '#SkCanvas_writePixels_info' > info< / a > .height() times < a href = '#SkCanvas_writePixels_rowBytes' > rowBytes< / a > , or larger< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > size of one row of < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > ; < a href = '#SkCanvas_writePixels_info' > info< / a > .width() times pixel size, or larger< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into < a href = '#Canvas' > Canvas< / a > writable < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > on < a href = '#SkCanvas_writePixels_x' > x< / a > -axis; may be negative< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into < a href = '#Canvas' > Canvas< / a > writable < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > on < a href = '#SkCanvas_writePixels_y' > y< / a > -axis; may be negative< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#SkCanvas_writePixels_pixels' > pixels< / a > were written to < a href = '#Canvas' > Canvas< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "29b98ebf58aa9fd1edfaabf9f4490b3a" > < / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_readPixels' > readPixels< / a > < sup > < a href = '#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels' > SkBitmap::writePixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels_2' > [2]< / a > < / sup >
2017-08-24 16:59:48 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_writePixels_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_writePixels' > writePixels< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, int x, int y)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkRect_Reference#Rect' > Rect< / a > from pixels to < a href = '#Canvas' > Canvas< / a > . < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > are ignored.
Source < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (0, 0) and (< a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > .width(), < a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > .height()).
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
Destination < a href = 'SkRect_Reference#Rect' > Rect< / a > corners are (< a href = '#SkCanvas_writePixels_2_x' > x< / a > , < a href = '#SkCanvas_writePixels_2_y' > y< / a > ) and
(< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .width(), < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .height()).
2017-09-01 19:51:02 +00:00
2017-09-21 16:31:06 +00:00
Copies each readable pixel intersecting both rectangles, without scaling,
2018-05-16 11:07:07 +00:00
converting to < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .colorType() and < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .alphaType() if required.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are writable when < a href = 'undocumented#Device' > Device< / a > is raster, or backed by a GPU.
< a href = '#Pixels' > Pixels< / a > are not writable when < a href = '#SkCanvas' > SkCanvas< / a > is returned by < a href = 'undocumented#SkDocument_beginPage' > SkDocument::beginPage< / a > ,
returned by < a href = 'undocumented#SkPictureRecorder_beginRecording' > SkPictureRecorder::beginRecording< / a > , or < a href = '#Canvas' > Canvas< / a > is the base of a utility
class like < a href = 'undocumented#SkDebugCanvas' > SkDebugCanvas< / a > .
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Pixel' > Pixel< / a > values are converted only if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > and < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
2018-03-12 12:09:48 +00:00
do not match. Only pixels within both source and destination rectangles
2018-05-16 11:07:07 +00:00
are copied. < a href = '#Canvas' > Canvas< / a > pixels outside < a href = 'SkRect_Reference#Rect' > Rect< / a > intersection are unchanged.
2018-03-12 12:09:48 +00:00
2018-05-16 11:07:07 +00:00
Pass negative values for < a href = '#SkCanvas_writePixels_2_x' > x< / a > or < a href = '#SkCanvas_writePixels_2_y' > y< / a > to offset pixels to the left or
above < a href = '#Canvas' > Canvas< / a > pixels.
2018-03-12 12:09:48 +00:00
Does not copy, and returns false if:
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > Source and destination rectangles do not intersect.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > does not have allocated pixels.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > pixels could not be converted to < a href = '#Canvas' > Canvas< / a > < a href = '#SkCanvas_imageInfo' > imageInfo< / a > .colorType() or
< a href = '#SkCanvas_imageInfo' > imageInfo< / a > .alphaType().< / td >
< / tr > < tr >
< td > < a href = '#Canvas' > Canvas< / a > pixels are not writable; for instance, < a href = '#Canvas' > Canvas< / a > is document based.< / td >
< / tr > < tr >
< td > < a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > pixels are inaccessible; for instance, < a href = '#SkCanvas_writePixels_2_bitmap' > bitmap< / a > wraps a texture.< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_writePixels_2_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > contains pixels copied to < a href = '#Canvas' > Canvas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > offset into < a href = '#Canvas' > Canvas< / a > writable pixels in < a href = '#SkCanvas_writePixels_2_x' > x< / a > ; may be negative< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_writePixels_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > offset into < a href = '#Canvas' > Canvas< / a > writable pixels in < a href = '#SkCanvas_writePixels_2_y' > y< / a > ; may be negative< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if pixels were written to < a href = '#Canvas' > Canvas< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "8b128e067881f9251357653692fa28da" > < / fiddle-embed > < / div >
2017-08-24 16:59:48 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_readPixels' > readPixels< / a > < sup > < a href = '#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels' > SkBitmap::writePixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels_2' > [2]< / a > < / sup >
2017-08-24 16:59:48 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='State_Stack'>State Stack</a>
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > maintains a stack of state that allows hierarchical drawing, commonly used
2017-08-03 21:14:08 +00:00
to implement windows and views. The initial state has an identity matrix and and
an infinite clip. Even with a wide-open clip, drawing is constrained by the
2018-05-16 11:07:07 +00:00
bounds of the < a href = '#Canvas' > Canvas< / a > < a href = 'SkSurface_Reference#Surface' > Surface< / a > or < a href = 'undocumented#Device' > Device< / a > .
2017-07-28 19:18:29 +00:00
2018-07-12 12:40:13 +00:00
< a href = '#Canvas' > Canvas< / a > savable state consists of < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#Clip' > Clip< / a > describes the area that may be drawn to.
< a href = '#Matrix' > Matrix< / a > transforms the geometry.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > , < a href = '#SkCanvas_saveLayer' > saveLayer< / a > , < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > , and < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2018-01-26 17:56:22 +00:00
save state and return the depth of the stack.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_restore' > restore< / a > , < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > , and < a href = '#SkCanvas_destructor' > ~SkCanvas()< / a > revert state to its value when saved.
Each state on the stack intersects < a href = '#Clip' > Clip< / a > with the previous < a href = '#Clip' > Clip< / a > ,
and concatenates < a href = '#Matrix' > Matrix< / a > with the previous < a href = '#Matrix' > Matrix< / a > .
The intersected < a href = '#Clip' > Clip< / a > makes the drawing area the same or smaller;
the concatenated < a href = '#Matrix' > Matrix< / a > may move the origin and potentially scale or rotate
the coordinate space.
< a href = '#Canvas' > Canvas< / a > does not require balancing the state stack but it is a good idea
to do so. Calling < a href = '#SkCanvas_save' > save< / a > without < a href = '#SkCanvas_restore' > restore< / a > will eventually cause Skia to fail;
mismatched < a href = '#SkCanvas_save' > save< / a > and < a href = '#SkCanvas_restore' > restore< / a > create hard to find bugs.
It is not possible to use state to draw outside of the clip defined by the
previous state.
2017-07-28 19:18:29 +00:00
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "bb1dbfdca3aedf716beb6f07e2aab065" > < div > < a href = '#Draw' > Draw< / a > to ever smaller clips; then restore drawing to full canvas.
2018-05-16 11:07:07 +00:00
Note that the second < a href = '#SkCanvas_clipRect' > clipRect< / a > is not permitted to enlarge < a href = '#Clip' > Clip< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Each < a href = '#Clip' > Clip< / a > uses the current < a href = '#Matrix' > Matrix< / a > for its coordinates.
2017-07-28 19:18:29 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "9f563a2d60aa31d4b26742e5aa17aa4e" > < div > While < a href = '#SkCanvas_clipRect' > clipRect< / a > is given the same rectangle twice, < a href = '#Matrix' > Matrix< / a > makes the second
< a href = '#SkCanvas_clipRect' > clipRect< / a > draw at half the size of the first.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_save' > < / a >
2017-07-28 19:18:29 +00:00
## save
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_save' > save< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > .
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > ,
restoring the < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > to their state when < a href = '#SkCanvas_save' > save< / a > was called.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > , < a href = '#SkCanvas_setMatrix' > setMatrix< / a > ,
and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > , < a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Saved < a href = '#Canvas' > Canvas< / a > state is put on a stack; multiple calls to < a href = '#SkCanvas_save' > save< / a > should be balance
by an equal number of calls to < a href = '#SkCanvas_restore' > restore< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with result to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
### Return Value
2017-08-03 21:14:08 +00:00
depth of saved stack
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "e477dce358a9ba3b0aa1bf33b8a376de" > < div > The black square is translated 50 pixels down and to the right.
2018-05-16 11:07:07 +00:00
Restoring < a href = '#Canvas' > Canvas< / a > state removes < a href = '#SkCanvas_translate' > translate< / a > from < a href = '#Canvas' > Canvas< / a > stack;
2018-03-05 18:26:16 +00:00
the red square is not translated, and is drawn at the origin.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_restore' > < / a >
2017-09-01 19:51:02 +00:00
## restore
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_restore' > restore< / a > ()
2017-09-01 19:51:02 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Removes changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > since < a href = '#Canvas' > Canvas< / a > state was
2018-01-04 21:11:51 +00:00
last saved. The state is removed from the stack.
2017-09-01 19:51:02 +00:00
2018-01-04 21:11:51 +00:00
Does nothing if the stack is empty.
2017-09-01 19:51:02 +00:00
### Example
< div > < fiddle-embed name = "e78471212a67f2f4fd39496e17a30d17" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a >
2017-11-02 21:49:34 +00:00
2017-09-01 19:51:02 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getSaveCount' > < / a >
2017-09-01 19:51:02 +00:00
## getSaveCount
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_getSaveCount' > getSaveCount< / a > () const
2017-09-01 19:51:02 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Returns the number of saved states, each containing: < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > .
2018-05-16 11:07:07 +00:00
Equals the number of < a href = '#SkCanvas_save' > save< / a > calls less the number of < a href = '#SkCanvas_restore' > restore< / a > calls plus one.
2018-01-26 17:56:22 +00:00
The save count of a new canvas is one.
2017-09-01 19:51:02 +00:00
### Return Value
2018-01-26 17:56:22 +00:00
depth of save state stack
2017-09-01 19:51:02 +00:00
### Example
< div > < fiddle-embed name = "005f2b207e078baac596681924fe591e" >
#### Example Output
~~~~
depth = 1
depth = 2
depth = 1
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a >
2017-11-02 21:49:34 +00:00
2017-09-01 19:51:02 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_restoreToCount' > < / a >
2017-09-01 19:51:02 +00:00
## restoreToCount
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > (int saveCount)
2017-09-01 19:51:02 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Restores state to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > values when < a href = '#SkCanvas_save' > save< / a > , < a href = '#SkCanvas_saveLayer' > saveLayer< / a > ,
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > , or < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > returned < a href = '#SkCanvas_restoreToCount_saveCount' > saveCount< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Does nothing if < a href = '#SkCanvas_restoreToCount_saveCount' > saveCount< / a > is greater than state stack count.
Restores state to initial values if < a href = '#SkCanvas_restoreToCount_saveCount' > saveCount< / a > is less than or equal to one.
2017-09-01 19:51:02 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_restoreToCount_saveCount' > < code > < strong > saveCount< / strong > < / code > < / a > < / td >
< td > depth of state stack to restore< / td >
2017-09-01 19:51:02 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "9ed0d56436e114c7097fd49eed1aea47" >
2017-09-01 19:51:02 +00:00
#### Example Output
~~~~
depth = 1
depth = 3
depth = 1
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_getSaveCount' > getSaveCount< / a > < a href = '#SkCanvas_save' > save< / a >
2017-11-02 21:49:34 +00:00
2017-09-01 19:51:02 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Layer'>Layer</a>
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Layer' > Layer< / a > allocates a temporary < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > to draw into. When the drawing is
complete, the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > is drawn into the < a href = '#Canvas' > Canvas< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Layer' > Layer< / a > is saved in a stack along with other saved state. When state with a < a href = '#Layer' > Layer< / a >
is restored, the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > is drawn into the previous < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Layer' > Layer< / a > may be initialized with the contents of the previous < a href = '#Layer' > Layer< / a > . When < a href = '#Layer' > Layer< / a > is
restored, its < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > can be modified by < a href = 'SkPaint_Reference#Paint' > Paint< / a > passed to < a href = '#Layer' > Layer< / a > to apply
2018-06-27 15:00:21 +00:00
< a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_saveLayer' > < / a >
2017-07-28 19:18:29 +00:00
## saveLayer
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_saveLayer' > saveLayer< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and allocates a < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > for subsequent drawing.
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and draws the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > ,
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > , and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > ,
< a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_saveLayer_bounds' > bounds< / a > suggests but does not define the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > size. To clip drawing to
a specific rectangle, use < a href = '#SkCanvas_clipRect' > clipRect< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_saveLayer_paint' > paint< / a > applies < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > when < a href = '#SkCanvas_restore' > restore< / a > is called.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with returned value to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_saveLayer_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > hint to limit the size of the < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_saveLayer_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > graphics state for < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
depth of saved stack
2017-07-28 19:18:29 +00:00
### Example
2018-06-25 20:30:08 +00:00
< div > < fiddle-embed name = "42318b18d403e17e07a541652da91ee2" > < div > Rectangles are blurred by < a href = 'undocumented#Image_Filter' > Image Filter< / a > when < a href = '#SkCanvas_restore' > restore< / a > draws < a href = '#Layer' > Layer< / a > to main
2018-05-16 11:07:07 +00:00
< a href = '#Canvas' > Canvas< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_saveLayer_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_saveLayer' > saveLayer< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and allocates a < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > for subsequent drawing.
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and draws the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > ,
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > , and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > ,
< a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_saveLayer_2_bounds' > bounds< / a > suggests but does not define the < a href = '#Layer' > Layer< / a > size. To clip drawing to
a specific rectangle, use < a href = '#SkCanvas_clipRect' > clipRect< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_saveLayer_2_paint' > paint< / a > applies < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > when < a href = '#SkCanvas_restore' > restore< / a > is called.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with returned value to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_saveLayer_2_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > hint to limit the size of < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_saveLayer_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > graphics state for < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
depth of saved stack
2017-07-28 19:18:29 +00:00
### Example
2018-07-07 05:34:31 +00:00
< div > < fiddle-embed name = "a17aec3aa4909527be039e26a7eda694" > < div > Rectangles are blurred by < a href = 'undocumented#Image_Filter' > Image Filter< / a > when < a href = '#SkCanvas_restore' > restore< / a > draws < a href = '#Layer' > Layer< / a > to main < a href = '#Canvas' > Canvas< / a > .
2018-05-16 11:07:07 +00:00
The red rectangle is clipped; it does not fully fit on < a href = '#Layer' > Layer< / a > .
< a href = 'undocumented#Image_Filter' > Image Filter< / a > blurs past edge of < a href = '#Layer' > Layer< / a > so red rectangle is blurred on all sides.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_saveLayerPreserveLCDTextRequests' > < / a >
2017-07-28 19:18:29 +00:00
## saveLayerPreserveLCDTextRequests
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and allocates a < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > for subsequent drawing.
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#LCD_Text' > LCD Text< / a > is preserved when the < a href = '#Layer' > Layer< / a > is drawn to the prior < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-07-12 12:40:13 +00:00
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and draws < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > ,
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > , and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > ,
< a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2018-05-03 06:27:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests_bounds' > bounds< / a > suggests but does not define the < a href = '#Layer' > Layer< / a > size. To clip drawing to
a specific rectangle, use < a href = '#SkCanvas_clipRect' > clipRect< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests_paint' > paint< / a > applies < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > when < a href = '#SkCanvas_restore' > restore< / a > is called.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with returned value to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Draw' > Draw< / a > text on an opaque background so that < a href = 'SkPaint_Reference#LCD_Text' > LCD Text< / a > blends correctly with the
prior < a href = '#Layer' > Layer< / a > . < a href = 'SkPaint_Reference#LCD_Text' > LCD Text< / a > drawn on a background with transparency may result in
2017-09-21 16:31:06 +00:00
incorrect blending.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_saveLayerPreserveLCDTextRequests_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > hint to limit the size of < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_saveLayerPreserveLCDTextRequests_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > graphics state for < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
depth of saved stack
2017-07-28 19:18:29 +00:00
### Example
2018-07-09 05:28:19 +00:00
< div > < fiddle-embed name = "8460bf8b013f46c67e0bd96e13451aff" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_saveLayerAlpha' > < / a >
2017-07-28 19:18:29 +00:00
## saveLayerAlpha
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, < a href = 'undocumented#U8CPU' > U8CPU< / a > alpha)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and allocates < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > for subsequent drawing.
2017-07-28 19:18:29 +00:00
2018-07-12 12:40:13 +00:00
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > ,
2018-05-16 11:07:07 +00:00
and blends < a href = '#Layer' > Layer< / a > with < a href = '#SkCanvas_saveLayerAlpha_alpha' > alpha< / a > opacity onto prior < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > ,
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > , and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > ,
< a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_saveLayerAlpha_bounds' > bounds< / a > suggests but does not define < a href = '#Layer' > Layer< / a > size. To clip drawing to
a specific rectangle, use < a href = '#SkCanvas_clipRect' > clipRect< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_saveLayerAlpha_alpha' > alpha< / a > of zero is fully transparent, 255 is fully opaque.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with returned value to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_saveLayerAlpha_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > hint to limit the size of < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_saveLayerAlpha_alpha' > < code > < strong > alpha< / strong > < / code > < / a > < / td >
< td > opacity of < a href = '#Layer' > Layer< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2017-08-03 21:14:08 +00:00
depth of saved stack
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "8ab88d86fb438856cc48d6e2f08a6e24" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='SkCanvas_SaveLayerFlagsSet'>Enum SkCanvas::SaveLayerFlagsSet</a>
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum < a href = '#SkCanvas_SaveLayerFlagsSet' > SaveLayerFlagsSet< / a > {
< a href = '#SkCanvas_kPreserveLCDText_SaveLayerFlag' > kPreserveLCDText SaveLayerFlag< / a > = 1 < < 1 ,
< a href = '#SkCanvas_kInitWithPrevious_SaveLayerFlag' > kInitWithPrevious SaveLayerFlag< / a > = 1 < < 2 ,
< a href = '#SkCanvas_kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag' > kMaskAgainstCoverage EXPERIMENTAL DONT USE SaveLayerFlag< / a > = 1 < < 3 ,
< a href = '#SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag' > kDontClipToLayer Legacy SaveLayerFlag< / a > = kDontClipToLayer_PrivateSaveLayerFlag,
2018-04-03 12:43:27 +00:00
};
2018-04-26 12:32:37 +00:00
2018-05-16 11:07:07 +00:00
typedef uint32_t < a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > ;
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-05-17 16:17:28 +00:00
## <a name='SkCanvas_SaveLayerFlags'>Typedef SkCanvas::SaveLayerFlags</a>
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > provides options that may be used in any combination in < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a > ,
defining how < a href = '#Layer' > Layer< / a > allocated by < a href = '#SkCanvas_saveLayer' > saveLayer< / a > operates. It may be set to zero,
< a href = '#SkCanvas_kPreserveLCDText_SaveLayerFlag' > kPreserveLCDText SaveLayerFlag< / a > , < a href = '#SkCanvas_kInitWithPrevious_SaveLayerFlag' > kInitWithPrevious SaveLayerFlag< / a > , or both flags.
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kPreserveLCDText_SaveLayerFlag' >< code > SkCanvas::kPreserveLCDText_SaveLayerFlag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Creates < a href = '#Layer' > Layer< / a > for LCD text. Flag is ignored if < a href = '#Layer' > Layer< / a > < a href = 'SkPaint_Reference#Paint' > Paint< / a > contains
< a href = 'undocumented#Image_Filter' > Image Filter< / a > or < a href = 'undocumented#Color_Filter' > Color Filter< / a > .
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kInitWithPrevious_SaveLayerFlag' >< code > SkCanvas::kInitWithPrevious_SaveLayerFlag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 4</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Initializes < a href = '#Layer' > Layer< / a > with the contents of the previous < a href = '#Layer' > Layer< / a > .
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag' >< code > SkCanvas::kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 8</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Experimental.
do not use< / td >
2018-04-26 12:32:37 +00:00
< / tr >
2017-08-03 21:14:08 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag' >< code > SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x80000000</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Deprecated.
soon< / td >
2017-08-03 21:14:08 +00:00
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "05db6a937225e8e31ae3481173d25dae" > < div > < a href = '#Canvas' > Canvas< / a > < a href = '#Layer' > Layer< / a > captures red and blue circles scaled up by four.
scalePaint blends < a href = '#Layer' > Layer< / a > back with transparency.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a > < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a >
2017-11-02 21:49:34 +00:00
2018-05-16 11:07:07 +00:00
## <a name='Layer_SaveLayerRec'>Layer SaveLayerRec</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
# <a name='SkCanvas_SaveLayerRec'>Struct SkCanvas::SaveLayerRec</a>
2017-07-28 19:18:29 +00:00
2018-08-10 17:09:13 +00:00
## <a name='Layer_SaveLayerRec_Member_Function'>Member_Function</a>
SkCanvas::SaveLayerRec member functions read and modify the structure properties.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec()</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > constructs < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec</ a ></ td >
< / tr >
< / table >
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
struct < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > {
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > *(...
2018-04-03 12:43:27 +00:00
2018-05-16 11:07:07 +00:00
const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * < a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > ;
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * < a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > ;
const < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > * < a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > ;
< a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > < a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > ;
2018-04-03 12:43:27 +00:00
};
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > contains the state used to create the < a href = '#Layer' > Layer< / a > .
2018-05-30 13:21:49 +00:00
2018-05-16 11:07:07 +00:00
## <a name='Layer_SaveLayerRec_Overview'>Layer SaveLayerRec Overview</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Layer_SaveLayerRec_Constructor' > Constructors</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > functions that construct < a href = '#SkCanvas_SaveLayerRec' > SkCanvas::SaveLayerRec</ a ></ td >
< / tr >
< tr >
2018-08-10 17:09:13 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Layer_SaveLayerRec_Member_Function' > Functions</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > global and class member functions</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Layer_SaveLayerRec_Member' > Members</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > member values</ td >
< / tr >
< / table >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
## <a name='Layer_SaveLayerRec_Member'>Layer SaveLayerRec Member</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< / table >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
### Members
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Type</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Name</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkRect*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fBounds' >< code > fBounds</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > is used as a hint to limit the size of < a href = '#Layer' > Layer< / a > ; may be nullptr.
< a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > suggests but does not define < a href = '#Layer' > Layer< / a > size. To clip drawing to
a specific rectangle, use < a href = '#SkCanvas_clipRect' > clipRect< / a > .
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkPaint*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fPaint' >< code > fPaint</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > modifies how < a href = '#Layer' > Layer< / a > overlays the prior < a href = '#Layer' > Layer< / a > ; may be nullptr.
2018-06-27 15:00:21 +00:00
< a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Mask_Filter' > Mask Filter< / a > affect < a href = '#Layer' > Layer< / a > draw.
< / td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkImageFilter*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fBackdrop' >< code > fBackdrop</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > applies < a href = 'undocumented#Image_Filter' > Image Filter< / a > to the prior < a href = '#Layer' > Layer< / a > when copying to the < a href = '#Layer' > Layer< / a > ;
may be nullptr. Use < a href = '#SkCanvas_kInitWithPrevious_SaveLayerFlag' > kInitWithPrevious SaveLayerFlag< / a > to copy the
prior < a href = '#Layer' > Layer< / a > without an < a href = 'undocumented#Image_Filter' > Image Filter< / a > .
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkImage*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fClipMask' >< code > fClipMask</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_restore' > restore< / a > clips < a href = '#Layer' > Layer< / a > by the < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > channel of < a href = '#SkCanvas_SaveLayerRec_fClipMask' > fClipMask< / a > when
< a href = '#Layer' > Layer< / a > is copied to < a href = 'undocumented#Device' > Device< / a > . < a href = '#SkCanvas_SaveLayerRec_fClipMask' > fClipMask< / a > may be nullptr. .
< / td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkMatrix*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fClipMatrix' >< code > fClipMatrix</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_SaveLayerRec_fClipMatrix' > fClipMatrix< / a > transforms < a href = '#SkCanvas_SaveLayerRec_fClipMask' > fClipMask< / a > before it clips < a href = '#Layer' > Layer< / a > . If
< a href = '#SkCanvas_SaveLayerRec_fClipMask' > fClipMask< / a > describes a translucent gradient, it may be scaled and rotated
without introducing artifacts. < a href = '#SkCanvas_SaveLayerRec_fClipMatrix' > fClipMatrix< / a > may be nullptr.
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > SaveLayerFlags</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_SaveLayerRec_fSaveLayerFlags' >< code > fSaveLayerFlags</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
< a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > are used to create < a href = '#Layer' > Layer< / a > without transparency,
create < a href = '#Layer' > Layer< / a > for LCD text, and to create < a href = '#Layer' > Layer< / a > with the
contents of the previous < a href = '#Layer' > Layer< / a > .
< / td >
< / tr >
< / table >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
### Example
2017-07-28 19:18:29 +00:00
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "ee8c0b120234e27364f8c9a786cf8f89" > < div > < a href = '#Canvas' > Canvas< / a > < a href = '#Layer' > Layer< / a > captures a red < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > circle and a blue < a href = 'undocumented#Alias' > Aliased< / a > circle scaled
2018-05-16 11:07:07 +00:00
up by four. After drawing another red circle without scaling on top, the < a href = '#Layer' > Layer< / a > is
transferred to the main canvas.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
## <a name='Layer_SaveLayerRec_Constructor'>Layer SaveLayerRec Constructor</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< / table >
2017-07-28 19:18:29 +00:00
2018-08-10 17:09:13 +00:00
< a name = 'SkCanvas_SaveLayerRec_SaveLayerRec' > < / a >
2017-07-28 19:18:29 +00:00
## SaveLayerRec
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets < a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > , < a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > , and < a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > to nullptr. Clears < a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-08-10 17:09:13 +00:00
empty < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-02-08 06:01:32 +00:00
< div > < fiddle-embed name = "b5cea1eed80a0eb04ddbab3f36dff73f" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
rec1 == rec2
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-08-10 17:09:13 +00:00
< a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star' > < / a >
2018-06-27 15:00:21 +00:00
## SaveLayerRec
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, < a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > saveLayerFlags = 0)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets < a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > , < a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > , and < a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > ; sets < a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > to nullptr.
2017-07-28 19:18:29 +00:00
### Parameters
2018-08-10 17:09:13 +00:00
< table > < tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > < a href = '#Layer' > Layer< / a > dimensions; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > applied to < a href = '#Layer' > Layer< / a > when overlaying prior < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_saveLayerFlags' > < code > < strong > saveLayerFlags< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > options to modify < a href = '#Layer' > Layer< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > with empty backdrop
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "027f920259888fc19591ea9a90d92873" >
#### Example Output
~~~~
rec1 == rec2
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-08-10 17:09:13 +00:00
< a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star' > < / a >
2018-06-27 15:00:21 +00:00
## SaveLayerRec
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, const < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > * backdrop,
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > saveLayerFlags)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets < a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > , < a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > , < a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > , and < a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-08-10 17:09:13 +00:00
< table > < tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > < a href = '#Layer' > Layer< / a > dimensions; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > applied to < a href = '#Layer' > Layer< / a > when overlaying prior < a href = '#Layer' > Layer< / a > ;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_backdrop' > < code > < strong > backdrop< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > prior < a href = '#Layer' > Layer< / a > copied with < a href = 'undocumented#Image_Filter' > Image Filter< / a > ; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_saveLayerFlags' > < code > < strong > saveLayerFlags< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > options to modify < a href = '#Layer' > Layer< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > fully specified
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "9b7fa2fe855642ffff6538829db15328" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
rec1 == rec2
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-08-10 17:09:13 +00:00
< a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star' > < / a >
2018-06-27 15:00:21 +00:00
## SaveLayerRec
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, const < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > * backdrop,
2018-05-16 11:07:07 +00:00
const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * clipMask, const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > * clipMatrix, < a href = '#SkCanvas_SaveLayerFlags' > SaveLayerFlags< / a > saveLayerFlags)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Experimental.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
not readySets < a href = '#SkCanvas_SaveLayerRec_fBounds' > fBounds< / a > , < a href = '#SkCanvas_SaveLayerRec_fPaint' > fPaint< / a > , < a href = '#SkCanvas_SaveLayerRec_fBackdrop' > fBackdrop< / a > , < a href = '#SkCanvas_SaveLayerRec_fClipMask' > fClipMask< / a > , < a href = '#SkCanvas_SaveLayerRec_fClipMatrix' > fClipMatrix< / a > , and < a href = '#SkCanvas_SaveLayerRec_fSaveLayerFlags' > fSaveLayerFlags< / a > .
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_clipMatrix' > clipMatrix< / a > uses < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > channel of image, transformed by < a href = '#SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_clipMatrix' > clipMatrix< / a > , to clip
2018-05-16 11:07:07 +00:00
< a href = '#Layer' > Layer< / a > when drawn to < a href = '#Canvas' > Canvas< / a > .
Implementation is not complete; has no effect if < a href = 'undocumented#Device' > Device< / a > is GPU-backed.
2017-07-28 19:18:29 +00:00
### Parameters
2018-08-10 17:09:13 +00:00
< table > < tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > < a href = '#Layer' > Layer< / a > dimensions; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > graphics state applied to < a href = '#Layer' > Layer< / a > when overlaying prior
< a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_backdrop' > < code > < strong > backdrop< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > prior < a href = '#Layer' > Layer< / a > copied with < a href = 'undocumented#Image_Filter' > Image Filter< / a > ;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_clipMask' > < code > < strong > clipMask< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > clip applied to < a href = '#Layer' > Layer< / a > ; may be nullptr< / td >
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_clipMatrix' > < code > < strong > clipMatrix< / strong > < / code > < / a > < / td >
< td > matrix applied to < a href = '#SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_clipMask' > clipMask< / a > ; may be nullptr to use
2017-08-03 21:14:08 +00:00
identity matrix< / td >
2018-05-16 11:07:07 +00:00
< / tr >
2018-08-10 17:09:13 +00:00
< tr > < td > < a name = 'SkCanvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star_const_SkImage_star_const_SkMatrix_star_saveLayerFlags' > < code > < strong > saveLayerFlags< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > options to modify < a href = '#Layer' > Layer< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_SaveLayerRec_SaveLayerRec' > SaveLayerRec< / a > fully specified
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_saveLayer_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkCanvas_saveLayer' > saveLayer< / a > (const < a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a > & layerRec)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-12 12:40:13 +00:00
Saves < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > , and allocates < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > for subsequent drawing.
2017-07-28 19:18:29 +00:00
2018-07-12 12:40:13 +00:00
Calling < a href = '#SkCanvas_restore' > restore< / a > discards changes to < a href = '#Matrix' > Matrix< / a > and < a href = '#Clip' > Clip< / a > ,
2018-05-16 11:07:07 +00:00
and blends < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > with < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > opacity onto the prior < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > may be changed by < a href = '#SkCanvas_translate' > translate< / a > , < a href = '#SkCanvas_scale' > scale< / a > , < a href = '#SkCanvas_rotate' > rotate< / a > , < a href = '#SkCanvas_skew' > skew< / a > , < a href = '#SkCanvas_concat' > concat< / a > ,
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > , and < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > . < a href = '#Clip' > Clip< / a > may be changed by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > ,
< a href = '#SkCanvas_clipPath' > clipPath< / a > , < a href = '#SkCanvas_clipRegion' > clipRegion< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SaveLayerRec' > SaveLayerRec< / a > contains the state used to create the < a href = '#Layer' > Layer< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Call < a href = '#SkCanvas_restoreToCount' > restoreToCount< / a > with returned value to restore this and subsequent saves.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_saveLayer_3_layerRec' > < code > < strong > layerRec< / strong > < / code > < / a > < / td >
< td > < a href = '#Layer' > Layer< / a > state< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-01-26 17:56:22 +00:00
depth of save state stack
2017-07-28 19:18:29 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "7d3751e82d1b6ec328ffa3d6f48ca831" > < div > The example draws an image, and saves it into a < a href = '#Layer' > Layer< / a > with < a href = '#SkCanvas_kInitWithPrevious_SaveLayerFlag' > kInitWithPrevious SaveLayerFlag< / a > .
2018-06-27 15:00:21 +00:00
Next it punches a hole in < a href = '#Layer' > Layer< / a > and restore with < a href = 'SkBlendMode_Reference#SkBlendMode_kPlus' > SkBlendMode::kPlus< / a > .
2018-05-16 11:07:07 +00:00
Where < a href = '#Layer' > Layer< / a > was cleared, the original image will draw unchanged.
2018-03-05 18:26:16 +00:00
Outside of the circle the mandrill is brightened.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_save' > save< / a > < a href = '#SkCanvas_restore' > restore< / a > < a href = '#SkCanvas_saveLayer' > saveLayer< / a > < sup > < a href = '#SkCanvas_saveLayer_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_saveLayer_3' > [3]< / a > < / sup > < a href = '#SkCanvas_saveLayerPreserveLCDTextRequests' > saveLayerPreserveLCDTextRequests< / a > < a href = '#SkCanvas_saveLayerAlpha' > saveLayerAlpha< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Matrix'>Matrix</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_translate' > < / a >
2017-07-28 19:18:29 +00:00
## translate
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_translate' > translate< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > dx, < a href = 'undocumented#SkScalar' > SkScalar< / a > dy)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Translates < a href = '#Matrix' > Matrix< / a > by < a href = '#SkCanvas_translate_dx' > dx< / a > along the x-axis and < a href = '#SkCanvas_translate_dy' > dy< / a > along the y-axis.
2017-07-28 19:18:29 +00:00
2018-07-11 20:18:41 +00:00
Mathematically, replaces < a href = '#Matrix' > Matrix< / a > with a translation matrix
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Premultiply' > Premultiplied< / a > with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
This has the effect of moving the drawing by (< a href = '#SkCanvas_translate_dx' > dx< / a > , < a href = '#SkCanvas_translate_dy' > dy< / a > ) before transforming
the result with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_translate_dx' > < code > < strong > dx< / strong > < / code > < / a > < / td >
< td > distance to translate in x< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_translate_dy' > < code > < strong > dy< / strong > < / code > < / a > < / td >
< td > distance to translate in y< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "eb93d5fa66a5f7a10f4f9210494d7222" > < div > < a href = '#SkCanvas_scale' > scale< / a > followed by < a href = '#SkCanvas_translate' > translate< / a > produces different results from < a href = '#SkCanvas_translate' > translate< / a > followed
2018-05-16 11:07:07 +00:00
by < a href = '#SkCanvas_scale' > scale< / a > .
2017-07-28 19:18:29 +00:00
2018-01-26 17:56:22 +00:00
The blue stroke follows translate of (50, 50); a black
fill follows scale of (2, 1/2.f). After restoring the clip, which resets
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > , a red frame follows the same scale of (2, 1/2.f); a gray fill
2018-03-05 18:26:16 +00:00
follows translate of (50, 50).
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_skew' > skew< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_scale' > < / a >
2017-07-28 19:18:29 +00:00
## scale
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_scale' > scale< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > sx, < a href = 'undocumented#SkScalar' > SkScalar< / a > sy)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Scales < a href = '#Matrix' > Matrix< / a > by < a href = '#SkCanvas_scale_sx' > sx< / a > on the x-axis and < a href = '#SkCanvas_scale_sy' > sy< / a > on the y-axis.
2017-07-28 19:18:29 +00:00
2018-07-11 20:18:41 +00:00
Mathematically, replaces < a href = '#Matrix' > Matrix< / a > with a scale matrix
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Premultiply' > Premultiplied< / a > with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
This has the effect of scaling the drawing by (< a href = '#SkCanvas_scale_sx' > sx< / a > , < a href = '#SkCanvas_scale_sy' > sy< / a > ) before transforming
the result with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_scale_sx' > < code > < strong > sx< / strong > < / code > < / a > < / td >
< td > amount to scale in x< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_scale_sy' > < code > < strong > sy< / strong > < / code > < / a > < / td >
< td > amount to scale in y< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "7d0d801ef13c6c6da51e840c22ac15b0" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_skew' > skew< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_rotate' > < / a >
2017-07-28 19:18:29 +00:00
## rotate
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_rotate' > rotate< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > degrees)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Rotates < a href = '#Matrix' > Matrix< / a > by < a href = '#SkCanvas_rotate_degrees' > degrees< / a > . Positive < a href = '#SkCanvas_rotate_degrees' > degrees< / a > rotates clockwise.
2017-07-28 19:18:29 +00:00
2018-07-11 20:18:41 +00:00
Mathematically, replaces < a href = '#Matrix' > Matrix< / a > with a rotation matrix
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Premultiply' > Premultiplied< / a > with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
This has the effect of rotating the drawing by < a href = '#SkCanvas_rotate_degrees' > degrees< / a > before transforming
the result with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_rotate_degrees' > < code > < strong > degrees< / strong > < / code > < / a > < / td >
< td > amount to rotate, in < a href = '#SkCanvas_rotate_degrees' > degrees< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "963789ac8498d4e505748ab3b15cdaa5" > < div > < a href = '#Draw' > Draw< / a > clock hands at time 5:10. The hour hand and minute hand point up and
2018-03-05 18:26:16 +00:00
are rotated clockwise.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_skew' > skew< / a > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_rotate_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_rotate' > rotate< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > degrees, < a href = 'undocumented#SkScalar' > SkScalar< / a > px, < a href = 'undocumented#SkScalar' > SkScalar< / a > py)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Rotates < a href = '#Matrix' > Matrix< / a > by < a href = '#SkCanvas_rotate_2_degrees' > degrees< / a > about a point at (< a href = '#SkCanvas_rotate_2_px' > px< / a > , < a href = '#SkCanvas_rotate_2_py' > py< / a > ). Positive < a href = '#SkCanvas_rotate_2_degrees' > degrees< / a > rotates
2017-08-03 21:14:08 +00:00
clockwise.
2017-07-28 19:18:29 +00:00
2018-07-11 20:18:41 +00:00
Mathematically, constructs a rotation matrix; < a href = 'undocumented#Premultiply' > Premultiplies< / a > the rotation matrix by
a translation matrix; then replaces < a href = '#Matrix' > Matrix< / a > with the resulting matrix
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Premultiply' > Premultiplied< / a > with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2017-08-03 21:14:08 +00:00
This has the effect of rotating the drawing about a given point before
2018-05-16 11:07:07 +00:00
transforming the result with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_rotate_2_degrees' > < code > < strong > degrees< / strong > < / code > < / a > < / td >
< td > amount to rotate, in < a href = '#SkCanvas_rotate_2_degrees' > degrees< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_rotate_2_px' > < code > < strong > px< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > x-axis value of the point to rotate about< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_rotate_2_py' > < code > < strong > py< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > y-axis value of the point to rotate about< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "bcf5baea1c66a957d5ffd7b54bbbfeff" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_skew' > skew< / a > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_skew' > < / a >
2017-07-28 19:18:29 +00:00
## skew
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_skew' > skew< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > sx, < a href = 'undocumented#SkScalar' > SkScalar< / a > sy)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Skews < a href = '#Matrix' > Matrix< / a > by < a href = '#SkCanvas_skew_sx' > sx< / a > on the x-axis and < a href = '#SkCanvas_skew_sy' > sy< / a > on the y-axis. A positive value of < a href = '#SkCanvas_skew_sx' > sx< / a >
2018-06-14 16:28:14 +00:00
skews the drawing right as y-axis values increase; a positive value of < a href = '#SkCanvas_skew_sy' > sy< / a > skews
the drawing down as x-axis values increase.
2017-07-28 19:18:29 +00:00
2018-07-11 20:18:41 +00:00
Mathematically, replaces < a href = '#Matrix' > Matrix< / a > with a skew matrix < a href = 'undocumented#Premultiply' > Premultiplied< / a > with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
This has the effect of skewing the drawing by (< a href = '#SkCanvas_skew_sx' > sx< / a > , < a href = '#SkCanvas_skew_sy' > sy< / a > ) before transforming
the result with < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_skew_sx' > < code > < strong > sx< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > amount to skew on x-axis< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_skew_sy' > < code > < strong > sy< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > amount to skew on y-axis< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-08 05:32:09 +00:00
< div > < fiddle-embed name = "2e2acc21d7774df7e0940a30ad2ca99e" > < div > Black text mimics an oblique text style by using a negative skew on x-axis
2018-06-14 16:28:14 +00:00
that shifts the geometry to the right as the y-axis values decrease.
Red text uses a positive skew on y-axis to shift the geometry down
as the x-axis values increase.
Blue text combines < a href = '#SkCanvas_skew_sx' > sx< / a > and < a href = '#SkCanvas_skew_sy' > sy< / a > skew to rotate and scale.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_concat' > < / a >
2017-07-28 19:18:29 +00:00
## concat
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_concat' > concat< / a > (const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > & matrix)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Matrix' > Matrix< / a > with < a href = '#SkCanvas_concat_matrix' > matrix< / a > < a href = 'undocumented#Premultiply' > Premultiplied< / a > with existing < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
This has the effect of transforming the drawn geometry by < a href = '#SkCanvas_concat_matrix' > matrix< / a > , before
transforming the result with existing < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_concat_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_concat_matrix' > matrix< / a > to < a href = 'undocumented#Premultiply' > Premultiply< / a > with existing < a href = '#Matrix' > Matrix< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "8f6818b25a92a88638ad99b2dd293f61" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_skew' > skew< / a > < a href = '#SkCanvas_setMatrix' > setMatrix< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_setMatrix' > < / a >
2017-07-28 19:18:29 +00:00
## setMatrix
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_setMatrix' > setMatrix< / a > (const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > & matrix)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Matrix' > Matrix< / a > with < a href = '#SkCanvas_setMatrix_matrix' > matrix< / a > .
2018-05-16 11:07:07 +00:00
Unlike < a href = '#SkCanvas_concat' > concat< / a > , any prior < a href = '#SkCanvas_setMatrix_matrix' > matrix< / a > state is overwritten.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_setMatrix_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_setMatrix_matrix' > matrix< / a > to copy, replacing existing < a href = '#Matrix' > Matrix< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "24b9cf7e6f9a08394e1e07413bd8733a" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > < a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_skew' > skew< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_resetMatrix' > < / a >
2017-07-28 19:18:29 +00:00
## resetMatrix
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets < a href = '#Matrix' > Matrix< / a > to the identity matrix.
2017-07-28 19:18:29 +00:00
Any prior matrix state is overwritten.
### Example
< div > < fiddle-embed name = "412afffdf4682baa503a4e2e99201967" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > < a href = '#SkCanvas_concat' > concat< / a > < a href = '#SkCanvas_translate' > translate< / a > < a href = '#SkCanvas_rotate' > rotate< / a > < sup > < a href = '#SkCanvas_rotate_2' > [2]< / a > < / sup > < a href = '#SkCanvas_scale' > scale< / a > < a href = '#SkCanvas_skew' > skew< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getTotalMatrix' > < / a >
2017-07-28 19:18:29 +00:00
## getTotalMatrix
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > & < a href = '#SkCanvas_getTotalMatrix' > getTotalMatrix< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = '#Matrix' > Matrix< / a > .
This does not account for translation by < a href = 'undocumented#Device' > Device< / a > or < a href = 'SkSurface_Reference#Surface' > Surface< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > in < a href = '#Canvas' > Canvas< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "c0d5fa544759704768f47cac91ae3832" >
#### Example Output
~~~~
isIdentity true
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_setMatrix' > setMatrix< / a > < a href = '#SkCanvas_resetMatrix' > resetMatrix< / a > < a href = '#SkCanvas_concat' > concat< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Clip'>Clip</a>
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Clip' > Clip< / a > is built from a stack of clipping paths. Each < a href = 'SkPath_Reference#Path' > Path< / a > in the
stack can be constructed from one or more < a href = 'SkPath_Reference#Contour' > Path Contour< / a > elements. The
< a href = 'SkPath_Reference#Contour' > Path Contour< / a > may be composed of any number of < a href = 'SkPath_Reference#Verb' > Path Verb< / a > segments. Each
< a href = 'SkPath_Reference#Contour' > Path Contour< / a > forms a closed area; < a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > defines the area enclosed
by < a href = 'SkPath_Reference#Contour' > Path Contour< / a > .
2017-08-25 15:51:49 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Clip' > Clip< / a > stack of < a href = 'SkPath_Reference#Path' > Path< / a > elements successfully restrict the < a href = 'SkPath_Reference#Path' > Path< / a > area. Each
< a href = 'SkPath_Reference#Path' > Path< / a > is transformed by < a href = '#Matrix' > Matrix< / a > , then intersected with or subtracted from the
prior < a href = '#Clip' > Clip< / a > to form the replacement < a href = '#Clip' > Clip< / a > . Use < a href = 'undocumented#SkClipOp_kDifference' > SkClipOp::kDifference< / a >
to subtract < a href = 'SkPath_Reference#Path' > Path< / a > from < a href = '#Clip' > Clip< / a > ; use < a href = 'undocumented#SkClipOp_kIntersect' > SkClipOp::kIntersect< / a > to intersect < a href = 'SkPath_Reference#Path' > Path< / a >
with < a href = '#Clip' > Clip< / a > .
2017-08-04 16:48:24 +00:00
2018-05-17 16:17:28 +00:00
A clipping < a href = 'SkPath_Reference#Path' > Path< / a > may be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > ; if < a href = 'SkPath_Reference#Path' > Path< / a > , after transformation, is
composed of horizontal and vertical lines, clearing < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > allows whole pixels
2018-05-16 11:07:07 +00:00
to either be inside or outside the clip. The fastest drawing has a < a href = 'undocumented#Alias' > Aliased< / a > ,
2017-09-01 19:51:02 +00:00
rectangular clip.
2017-07-28 19:18:29 +00:00
2018-05-17 16:17:28 +00:00
If clipping < a href = 'SkPath_Reference#Path' > Path< / a > has < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > set, clip may partially clip a pixel, requiring
2018-01-04 21:11:51 +00:00
that drawing blend partially with the destination along the edge. A rotated
2018-05-17 16:17:28 +00:00
rectangular < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip looks smoother but draws slower.
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
< a href = '#Clip' > Clip< / a > can combine with < a href = 'SkRect_Reference#Rect' > Rect< / a > and < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > primitives; like
2018-05-16 11:07:07 +00:00
< a href = 'SkPath_Reference#Path' > Path< / a > , these are transformed by < a href = '#Matrix' > Matrix< / a > before they are combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
2018-08-10 17:09:13 +00:00
< a href = '#Clip' > Clip< / a > can combine with < a href = 'SkRegion_Reference#Region' > Region< / a > . < a href = 'SkRegion_Reference#Region' > Region< / a > is assumed to be in < a href = 'undocumented#Device' > Device< / a > coordinates
2018-05-16 11:07:07 +00:00
and is unaffected by < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Example
2018-05-17 16:17:28 +00:00
< div > < fiddle-embed name = "862cc026601a41a58df49c0b9f0d7777" > < div > < a href = '#Draw' > Draw< / a > a red circle with an < a href = 'undocumented#Alias' > Aliased< / a > clip and an < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip.
2017-07-28 19:18:29 +00:00
Use an image filter to zoom into the pixels drawn.
2018-05-16 11:07:07 +00:00
The edge of the < a href = 'undocumented#Alias' > Aliased< / a > clip fully draws pixels in the red circle.
2018-05-17 16:17:28 +00:00
The edge of the < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip partially draws pixels in the red circle.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRect' > < / a >
2017-07-28 19:18:29 +00:00
## clipRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipRect' > clipRect< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op, bool doAntiAlias)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRect_rect' > rect< / a > ,
2018-05-17 16:17:28 +00:00
with an < a href = 'undocumented#Alias' > Aliased< / a > or < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip edge. < a href = '#SkCanvas_clipRect_rect' > rect< / a > is transformed by < a href = '#Matrix' > Matrix< / a >
2018-05-16 11:07:07 +00:00
before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRect_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRect_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRect_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "6a614faa0fbcf19958b5559c19b02d0f" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRect_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipRect' > clipRect< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRect_2_rect' > rect< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = '#SkCanvas_clipRect_2_rect' > rect< / a > is transformed by < a href = '#Matrix' > Matrix< / a > before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRect_2_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRect_2_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "13bbc5fa5597a6cd4d704b419dbc66d9" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRect_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipRect' > clipRect< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, bool doAntiAlias = false)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRect_3_rect' > rect< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = '#SkCanvas_clipRect_3_rect' > rect< / a > is transformed by < a href = '#Matrix' > Matrix< / a >
before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRect_3_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRect_3_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "1d4e0632c97e42692775d834fe10aa99" > < div > A circle drawn in pieces looks uniform when drawn < a href = 'undocumented#Alias' > Aliased< / a > .
2018-05-17 16:17:28 +00:00
The same circle pieces blend with pixels more than once when < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > ,
2018-03-05 18:26:16 +00:00
visible as a thin pair of lines through the right circle.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_androidFramework_setDeviceClipRestriction' > < / a >
2017-07-28 19:18:29 +00:00
## androidFramework_setDeviceClipRestriction
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_androidFramework_setDeviceClipRestriction' > androidFramework setDeviceClipRestriction< / a > (const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & rect)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets the maximum clip rectangle, which can be set by < a href = '#SkCanvas_clipRect' > clipRect< / a > , < a href = '#SkCanvas_clipRRect' > clipRRect< / a > and
< a href = '#SkCanvas_clipPath' > clipPath< / a > and intersect the current clip with the specified < a href = '#SkCanvas_androidFramework_setDeviceClipRestriction_rect' > rect< / a > .
2017-09-01 19:51:02 +00:00
The maximum clip affects only future clipping operations; it is not retroactive.
2017-07-28 19:18:29 +00:00
The clip restriction is not recorded in pictures.
2018-05-16 11:07:07 +00:00
Pass an empty < a href = '#SkCanvas_androidFramework_setDeviceClipRestriction_rect' > rect< / a > to disable maximum clip.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_androidFramework_setDeviceClipRestriction_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > maximum allowed clip in device coordinates< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2017-08-03 21:14:08 +00:00
#
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRRect' > < / a >
2017-07-28 19:18:29 +00:00
## clipRRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_clipRRect' > clipRRect< / a > (const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & rrect, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op, bool doAntiAlias)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRRect_rrect' > rrect< / a > ,
2018-05-17 16:17:28 +00:00
with an < a href = 'undocumented#Alias' > Aliased< / a > or < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip edge.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRRect_rrect' > rrect< / a > is transformed by < a href = '#Matrix' > Matrix< / a >
before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRRect_rrect' > < code > < strong > rrect< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRRect_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRRect_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "182ef48ab5e04ba3578496fda8d9fa36" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRRect_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_clipRRect' > clipRRect< / a > (const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & rrect, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRRect_2_rrect' > rrect< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = '#SkCanvas_clipRRect_2_rrect' > rrect< / a > is transformed by < a href = '#Matrix' > Matrix< / a > before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRRect_2_rrect' > < code > < strong > rrect< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRRect_2_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "ef6ae2eaae6761130ce38065d0364abd" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRRect_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_clipRRect' > clipRRect< / a > (const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & rrect, bool doAntiAlias = false)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipRRect_3_rrect' > rrect< / a > ,
2018-05-17 16:17:28 +00:00
with an < a href = 'undocumented#Alias' > Aliased< / a > or < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip edge.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRRect_3_rrect' > rrect< / a > is transformed by < a href = '#Matrix' > Matrix< / a > before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRRect_3_rrect' > < code > < strong > rrect< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRRect_3_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "f583114580b2176fe3e75b0994476a84" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipPath' > < / a >
2017-07-28 19:18:29 +00:00
## clipPath
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipPath' > clipPath< / a > (const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op, bool doAntiAlias)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipPath_path' > path< / a > ,
2018-05-17 16:17:28 +00:00
with an < a href = 'undocumented#Alias' > Aliased< / a > or < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > clip edge. < a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > determines if < a href = '#SkCanvas_clipPath_path' > path< / a >
2018-05-16 11:07:07 +00:00
describes the area inside or outside its contours; and if < a href = 'SkPath_Reference#Contour' > Path Contour< / a > overlaps
itself or another < a href = 'SkPath_Reference#Contour' > Path Contour< / a > , whether the overlaps form part of the area.
< a href = '#SkCanvas_clipPath_path' > path< / a > is transformed by < a href = '#Matrix' > Matrix< / a > before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipPath_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipPath_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipPath_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-12 12:40:13 +00:00
< div > < fiddle-embed name = "ee47ae6b813bfaa55e1a7b7c053ed60d" > < div > Top figure uses < a href = 'SkPath_Reference#SkPath_kInverseWinding_FillType' > SkPath::kInverseWinding FillType< / a > and < a href = 'undocumented#SkClipOp_kDifference' > SkClipOp::kDifference< / a > ;
2017-07-28 19:18:29 +00:00
area outside clip is subtracted from circle.
2018-05-16 11:07:07 +00:00
Bottom figure uses < a href = 'SkPath_Reference#SkPath_kWinding_FillType' > SkPath::kWinding FillType< / a > and < a href = 'undocumented#SkClipOp_kIntersect' > SkClipOp::kIntersect< / a > ;
2018-03-05 18:26:16 +00:00
area inside clip is intersected with circle.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipPath_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipPath' > clipPath< / a > (const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipPath_2_path' > path< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > determines if < a href = '#SkCanvas_clipPath_2_path' > path< / a >
describes the area inside or outside its contours; and if < a href = 'SkPath_Reference#Contour' > Path Contour< / a > overlaps
itself or another < a href = 'SkPath_Reference#Contour' > Path Contour< / a > , whether the overlaps form part of the area.
< a href = '#SkCanvas_clipPath_2_path' > path< / a > is transformed by < a href = '#Matrix' > Matrix< / a >
before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipPath_2_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipPath_2_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "7856755c1bf8431c286c734b353345ad" > < div > Overlapping < a href = 'SkRect_Reference#Rect' > Rects< / a > form a clip. When clip < a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > is set to
< a href = 'SkPath_Reference#SkPath_kWinding_FillType' > SkPath::kWinding FillType< / a > , the overlap is included. Set to
< a href = 'SkPath_Reference#SkPath_kEvenOdd_FillType' > SkPath::kEvenOdd FillType< / a > , the overlap is excluded and forms a hole.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipPath_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clipPath' > clipPath< / a > (const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, bool doAntiAlias = false)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection of < a href = '#Clip' > Clip< / a > and < a href = '#SkCanvas_clipPath_3_path' > path< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > determines if < a href = '#SkCanvas_clipPath_3_path' > path< / a >
describes the area inside or outside its contours; and if < a href = 'SkPath_Reference#Contour' > Path Contour< / a > overlaps
itself or another < a href = 'SkPath_Reference#Contour' > Path Contour< / a > , whether the overlaps form part of the area.
< a href = '#SkCanvas_clipPath_3_path' > path< / a > is transformed by < a href = '#Matrix' > Matrix< / a > before it is combined with < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipPath_3_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_clipPath_3_doAntiAlias' > < code > < strong > doAntiAlias< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > true if < a href = '#Clip' > Clip< / a > is to be < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "187a7ae77a8176e417181411988534b6" > < div > < a href = '#Clip' > Clip< / a > loops over itself covering its center twice. When clip < a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a >
is set to < a href = 'SkPath_Reference#SkPath_kWinding_FillType' > SkPath::kWinding FillType< / a > , the overlap is included. Set to
< a href = 'SkPath_Reference#SkPath_kEvenOdd_FillType' > SkPath::kEvenOdd FillType< / a > , the overlap is excluded and forms a hole.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRegion' > clipRegion< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_setAllowSimplifyClip' > < / a >
2017-07-28 19:18:29 +00:00
## setAllowSimplifyClip
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_setAllowSimplifyClip' > setAllowSimplifyClip< / a > (bool allow)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Experimental.
testingSet to simplify clip stack using < a href = 'undocumented#PathOps' > PathOps< / a > .
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clipRegion' > < / a >
2017-07-28 19:18:29 +00:00
## clipRegion
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
void < a href = '#SkCanvas_clipRegion' > clipRegion< / a > (const < a href = 'SkRegion_Reference#SkRegion' > SkRegion< / a > & deviceRgn, < a href = 'undocumented#SkClipOp' > SkClipOp< / a > op = < a href = 'undocumented#SkClipOp_kIntersect' > SkClipOp::kIntersect< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-08-10 17:09:13 +00:00
Replaces < a href = '#Clip' > Clip< / a > with the intersection or difference of < a href = '#Clip' > Clip< / a > and < a href = 'SkRegion_Reference#Region' > Region< / a > < a href = '#SkCanvas_clipRegion_deviceRgn' > deviceRgn< / a > .
2018-05-16 11:07:07 +00:00
Resulting < a href = '#Clip' > Clip< / a > is < a href = 'undocumented#Alias' > Aliased< / a > ; pixels are fully contained by the clip.
< a href = '#SkCanvas_clipRegion_deviceRgn' > deviceRgn< / a > is unaffected by < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clipRegion_deviceRgn' > < code > < strong > deviceRgn< / strong > < / code > < / a > < / td >
2018-08-10 17:09:13 +00:00
< td > < a href = 'SkRegion_Reference#Region' > Region< / a > to combine with < a href = '#Clip' > Clip< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_clipRegion_op' > < code > < strong > op< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Clip_Op' > Clip Op< / a > to apply to < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "7bb57c0e456c5fda2c2cca4abb68b19e" > < div > region is unaffected by canvas rotation; iRect is affected by canvas rotation.
2018-08-10 17:09:13 +00:00
Both clips are < a href = 'undocumented#Alias' > Aliased< / a > ; this is not noticeable on < a href = 'SkRegion_Reference#Region' > Region< / a > clip because it
2018-03-05 18:26:16 +00:00
aligns to pixel boundaries.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clipRect' > clipRect< / a > < sup > < a href = '#SkCanvas_clipRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipRRect' > clipRRect< / a > < sup > < a href = '#SkCanvas_clipRRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipRRect_3' > [3]< / a > < / sup > < a href = '#SkCanvas_clipPath' > clipPath< / a > < sup > < a href = '#SkCanvas_clipPath_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_clipPath_3' > [3]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_quickReject' > < / a >
2017-07-28 19:18:29 +00:00
## quickReject
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_quickReject' > quickReject< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect) const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns true if < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_quickReject_rect' > rect< / a > , transformed by < a href = '#Matrix' > Matrix< / a > , can be quickly determined to be
2018-05-16 11:07:07 +00:00
outside of < a href = '#Clip' > Clip< / a > . May return false even though < a href = '#SkCanvas_quickReject_rect' > rect< / a > is outside of < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_quickReject_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > to compare with < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#SkCanvas_quickReject_rect' > rect< / a > , transformed by < a href = '#Matrix' > Matrix< / a > , does not intersect < a href = '#Clip' > Clip< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "cfe4016241074477809dd45435be9cf4" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
quickReject true
quickReject false
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getTotalMatrix' > getTotalMatrix< / a > < a href = 'SkBitmap_Reference#SkBitmap_drawsNothing' > SkBitmap::drawsNothing< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_quickReject_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_quickReject' > quickReject< / a > (const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path) const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns true if < a href = '#SkCanvas_quickReject_2_path' > path< / a > , transformed by < a href = '#Matrix' > Matrix< / a > , can be quickly determined to be
2018-05-16 11:07:07 +00:00
outside of < a href = '#Clip' > Clip< / a > . May return false even though < a href = '#SkCanvas_quickReject_2_path' > path< / a > is outside of < a href = '#Clip' > Clip< / a > .
2017-07-28 19:18:29 +00:00
Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_quickReject_2_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > to compare with < a href = '#Clip' > Clip< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#SkCanvas_quickReject_2_path' > path< / a > , transformed by < a href = '#Matrix' > Matrix< / a > , does not intersect < a href = '#Clip' > Clip< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-16 12:12:01 +00:00
< div > < fiddle-embed name = "56dcd14f943aea6f7d7aafe0de7e6c25" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
quickReject true
quickReject false
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getTotalMatrix' > getTotalMatrix< / a > < a href = 'SkBitmap_Reference#SkBitmap_drawsNothing' > SkBitmap::drawsNothing< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getLocalClipBounds' > < / a >
2017-07-28 19:18:29 +00:00
## getLocalClipBounds
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkRect_Reference#SkRect' > SkRect< / a > < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns bounds of < a href = '#Clip' > Clip< / a > , transformed by inverse of < a href = '#Matrix' > Matrix< / a > . If < a href = '#Clip' > Clip< / a > is empty,
2018-05-16 11:07:07 +00:00
return < a href = 'SkRect_Reference#SkRect_MakeEmpty' > SkRect::MakeEmpty< / a > , where all < a href = 'SkRect_Reference#Rect' > Rect< / a > sides equal zero.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkRect_Reference#Rect' > Rect< / a > returned is outset by one to account for partial pixel coverage if < a href = '#Clip' > Clip< / a >
2018-05-17 16:17:28 +00:00
is < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
bounds of < a href = '#Clip' > Clip< / a > in local coordinates
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "7f60cb030d3f9b2473adbe3e34b19d91" > < div > Initial bounds is device bounds outset by 1 on all sides.
2018-05-16 11:07:07 +00:00
Clipped bounds is < a href = '#SkCanvas_clipPath' > clipPath< / a > bounds outset by 1 on all sides.
2018-06-14 16:28:14 +00:00
Scaling the canvas by two on both axes scales the local bounds by 1/2
on both axes.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
left:-1 top:-1 right:257 bottom:257
left:29 top:129 right:121 bottom:231
left:14.5 top:64.5 right:60.5 bottom:115.5
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > < sup > < a href = '#SkCanvas_getDeviceClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize< / a > < a href = '#SkCanvas_quickReject' > quickReject< / a > < sup > < a href = '#SkCanvas_quickReject_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getLocalClipBounds_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > (< a href = 'SkRect_Reference#SkRect' > SkRect< / a > * bounds) const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns < a href = '#SkCanvas_getLocalClipBounds_2_bounds' > bounds< / a > of < a href = '#Clip' > Clip< / a > , transformed by inverse of < a href = '#Matrix' > Matrix< / a > . If < a href = '#Clip' > Clip< / a > is empty,
2018-05-16 11:07:07 +00:00
return false, and set < a href = '#SkCanvas_getLocalClipBounds_2_bounds' > bounds< / a > to < a href = 'SkRect_Reference#SkRect_MakeEmpty' > SkRect::MakeEmpty< / a > , where all < a href = 'SkRect_Reference#Rect' > Rect< / a > sides equal zero.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getLocalClipBounds_2_bounds' > bounds< / a > is outset by one to account for partial pixel coverage if < a href = '#Clip' > Clip< / a >
2018-05-17 16:17:28 +00:00
is < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliased< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_getLocalClipBounds_2_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#Clip' > Clip< / a > in local coordinates< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#Clip' > Clip< / a > < a href = '#SkCanvas_getLocalClipBounds_2_bounds' > bounds< / a > is not empty
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "85496614e90c66b020f8a70db8d06f4a" >
#### Example Output
~~~~
local bounds empty = false
local bounds empty = true
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > < sup > < a href = '#SkCanvas_getDeviceClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize< / a > < a href = '#SkCanvas_quickReject' > quickReject< / a > < sup > < a href = '#SkCanvas_quickReject_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getDeviceClipBounds' > < / a >
2017-07-28 19:18:29 +00:00
## getDeviceClipBounds
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > < a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns < a href = 'SkIRect_Reference#IRect' > IRect< / a > bounds of < a href = '#Clip' > Clip< / a > , unaffected by < a href = '#Matrix' > Matrix< / a > . If < a href = '#Clip' > Clip< / a > is empty,
2018-05-16 11:07:07 +00:00
return < a href = 'SkRect_Reference#SkRect_MakeEmpty' > SkRect::MakeEmpty< / a > , where all < a href = 'SkRect_Reference#Rect' > Rect< / a > sides equal zero.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Unlike < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > , returned < a href = 'SkIRect_Reference#IRect' > IRect< / a > is not outset.
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
bounds of < a href = '#Clip' > Clip< / a > in < a href = 'undocumented#Device' > Device< / a > coordinates
2017-07-28 19:18:29 +00:00
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "556832ac5711af662a98c21c547185e9" > < div > Initial bounds is device bounds, not outset.
2018-05-16 11:07:07 +00:00
Clipped bounds is < a href = '#SkCanvas_clipPath' > clipPath< / a > bounds, not outset.
2018-06-14 16:28:14 +00:00
Scaling the canvas by 1/2 on both axes scales the device bounds by 1/2
on both axes.
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
left:0 top:0 right:256 bottom:256
left:30 top:130 right:120 bottom:230
left:15 top:65 right:60 bottom:115
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize< / a > < a href = '#SkCanvas_quickReject' > quickReject< / a > < sup > < a href = '#SkCanvas_quickReject_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_getDeviceClipBounds_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > (< a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > * bounds) const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns < a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_getDeviceClipBounds_2_bounds' > bounds< / a > of < a href = '#Clip' > Clip< / a > , unaffected by < a href = '#Matrix' > Matrix< / a > . If < a href = '#Clip' > Clip< / a > is empty,
2018-05-16 11:07:07 +00:00
return false, and set < a href = '#SkCanvas_getDeviceClipBounds_2_bounds' > bounds< / a > to < a href = 'SkRect_Reference#SkRect_MakeEmpty' > SkRect::MakeEmpty< / a > , where all < a href = 'SkRect_Reference#Rect' > Rect< / a > sides equal zero.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Unlike < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > , < a href = '#SkCanvas_getDeviceClipBounds_2_bounds' > bounds< / a > is not outset.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_getDeviceClipBounds_2_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#Clip' > Clip< / a > in device coordinates< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#Clip' > Clip< / a > < a href = '#SkCanvas_getDeviceClipBounds_2_bounds' > bounds< / a > is not empty
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "6abb99f849a1f0e33e1dedc00d1c4f7a" >
#### Example Output
~~~~
device bounds empty = false
device bounds empty = true
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getBaseLayerSize' > getBaseLayerSize< / a > < a href = '#SkCanvas_quickReject' > quickReject< / a > < sup > < a href = '#SkCanvas_quickReject_2' > [2]< / a > < / sup >
---
## <a name='Draw'>Draw</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_clear' > clear</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkColor_Reference#Color' > Color</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAnnotation' > drawAnnotation</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > associates a < a href = 'SkRect_Reference#Rect' > Rect</ a > with a key-value pair</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAnnotation' > drawAnnotation(const SkRect& rect, const char key[], SkData* value)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAnnotation_2' > drawAnnotation(const SkRect& rect, const char key[], const sk sp< SkData> & value)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawArc' > drawArc</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Arc' > Arc</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas' > drawAtlas</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws sprites using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas' > drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkRect* cullRect, const SkPaint* paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas_2' > drawAtlas(const sk sp< SkImage> & atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkRect* cullRect, const SkPaint* paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas_3' > drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], int count, const SkRect* cullRect, const SkPaint* paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawAtlas_4' > drawAtlas(const sk sp< SkImage> & atlas, const SkRSXform xform[], const SkRect tex[], int count, const SkRect* cullRect, const SkPaint* paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawCircle' > drawCircle</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Circle' > Circle</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawCircle' > drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawCircle_2' > drawCircle(SkPoint center, SkScalar radius, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawColor' > drawColor</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkColor_Reference#Color' > Color</ a > and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDRRect' > drawDRRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws double < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > stroked or filled</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDrawable' > drawDrawable</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Drawable' > Drawable</ a > , encapsulated drawing commands</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDrawable' > drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = nullptr)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawDrawable_2' > drawDrawable(SkDrawable* drawable, SkScalar x, SkScalar y)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawIRect' > drawIRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkIRect_Reference#IRect' > IRect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawLine' > drawLine</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws line segment between two points</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawLine' > drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawLine_2' > drawLine(SkPoint p0, SkPoint p1, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawOval' > drawOval</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Oval' > Oval</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPaint' > drawPaint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > fills < a href = '#Clip' > Clip</ a > with < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPatch' > drawPatch</ a ></ td >
2018-06-14 16:28:14 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Coons_Patch' > Coons Patch</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPatch' > drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPatch_2' > drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPath' > drawPath</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkPath_Reference#Path' > Path</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture' > drawPicture</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkPicture_Reference#Picture' > Picture</ a > using < a href = '#Clip' > Clip</ a > and < a href = '#Matrix' > Matrix</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture' > drawPicture(const SkPicture* picture)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture_2' > drawPicture(const sk sp< SkPicture> & picture)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture_3' > drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPicture_4' > drawPicture(const sk sp< SkPicture> & picture, const SkMatrix* matrix, const SkPaint* paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoint' > drawPoint</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws point at (x, y) position</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoint' > drawPoint(SkScalar x, SkScalar y, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoint_2' > drawPoint(SkPoint p, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPoints' > drawPoints</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws array as points, lines, polygon</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRRect' > drawRRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRect' > drawRect</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRect_Reference#Rect' > Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRegion' > drawRegion</ a ></ td >
2018-08-10 17:09:13 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRegion_Reference#Region' > Region</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawRoundRect' > drawRoundRect</ a ></ td >
2018-06-27 15:00:21 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'SkRRect_Reference#RRect' > Round Rect</ a > using < a href = '#Clip' > Clip</ a > , < a href = '#Matrix' > Matrix</ a > , and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices' > drawVertices</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws < a href = 'undocumented#Vertices' > Vertices</ a > , a triangle mesh</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices' > drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices_2' > drawVertices(const sk sp< SkVertices> & vertices, SkBlendMode mode, const SkPaint& paint)</ a ></ td >
< / tr >
2018-07-02 19:20:10 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-08-15 14:44:19 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices_3' > drawVertices(const SkVertices* vertices, const SkVertices::Bone bones[], int boneCount, SkBlendMode mode, const SkPaint& paint)</ a ></ td >
2018-07-02 19:20:10 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-08-15 14:44:19 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawVertices_4' > drawVertices(const sk sp< SkVertices> & vertices, const SkVertices::Bone bones[], int boneCount, SkBlendMode mode, const SkPaint& paint)</ a ></ td >
2018-07-02 19:20:10 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< / table >
< a name = 'SkCanvas_drawColor' > < / a >
2017-07-28 19:18:29 +00:00
## drawColor
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawColor' > drawColor< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > color, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode = < a href = 'SkBlendMode_Reference#SkBlendMode_kSrcOver' > SkBlendMode::kSrcOver< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Fills < a href = '#Clip' > Clip< / a > with < a href = 'SkColor_Reference#Color' > Color< / a > < a href = '#SkCanvas_drawColor_color' > color< / a > .
2018-05-17 16:17:28 +00:00
< a href = '#SkCanvas_drawColor_mode' > mode< / a > determines how ARGB is combined with destination.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawColor_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > ARGB< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawColor_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > used to combine source < a href = '#SkCanvas_drawColor_color' > color< / a > and destination< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "9cf94fead1e6b17d836c704b4eac269a" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clear' > clear< / a > < a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a > < a href = '#SkCanvas_drawPaint' > drawPaint< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_clear' > < / a >
2017-07-28 19:18:29 +00:00
## clear
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_clear' > clear< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > color)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Fills < a href = '#Clip' > Clip< / a > with < a href = 'SkColor_Reference#Color' > Color< / a > < a href = '#SkCanvas_clear_color' > color< / a > using < a href = 'SkBlendMode_Reference#SkBlendMode_kSrc' > SkBlendMode::kSrc< / a > .
2018-05-16 11:07:07 +00:00
This has the effect of replacing all pixels contained by < a href = '#Clip' > Clip< / a > with < a href = '#SkCanvas_clear_color' > color< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_clear_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > ARGB< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-01 05:25:37 +00:00
< div > < fiddle-embed name = "8c4499e322f10153dcd9b0b9806233b9" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawColor' > drawColor< / a > < a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a > < a href = '#SkCanvas_drawPaint' > drawPaint< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_discard' > < / a >
2017-07-28 19:18:29 +00:00
## discard
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_discard' > discard< / a > ()
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Makes < a href = '#Canvas' > Canvas< / a > contents undefined. Subsequent calls that read < a href = '#Canvas' > Canvas< / a > pixels,
2018-06-27 15:00:21 +00:00
such as drawing with < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > , return undefined results. < a href = '#SkCanvas_discard' > discard< / a > does
2018-05-16 11:07:07 +00:00
not change < a href = '#Clip' > Clip< / a > or < a href = '#Matrix' > Matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_discard' > discard< / a > may do nothing, depending on the implementation of < a href = 'SkSurface_Reference#Surface' > Surface< / a > or < a href = 'undocumented#Device' > Device< / a >
that created < a href = '#Canvas' > Canvas< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_discard' > discard< / a > allows optimized performance on subsequent draws by removing
cached data associated with < a href = 'SkSurface_Reference#Surface' > Surface< / a > or < a href = 'undocumented#Device' > Device< / a > .
It is not necessary to call < a href = '#SkCanvas_discard' > discard< / a > once done with < a href = '#Canvas' > Canvas< / a > ;
any cached data is deleted when owning < a href = 'SkSurface_Reference#Surface' > Surface< / a > or < a href = 'undocumented#Device' > Device< / a > is deleted.
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_flush' > flush< / a > < a href = 'SkSurface_Reference#SkSurface_prepareForExternalIO' > SkSurface::prepareForExternalIO< / a > GrContext::abandonContext
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPaint' > < / a >
2017-07-28 19:18:29 +00:00
## drawPaint
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPaint' > drawPaint< / a > (const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Fills < a href = '#Clip' > Clip< / a > with < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPaint_paint' > paint< / a > . < a href = 'SkPaint_Reference#Paint' > Paint< / a > components < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > affect drawing;
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Path_Effect' > Path Effect< / a > in < a href = '#SkCanvas_drawPaint_paint' > paint< / a > is ignored.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPaint_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > graphics state used to fill < a href = '#Canvas' > Canvas< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "1cd076b9b1a7c976cdca72b93c4f42dd" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_clear' > clear< / a > < a href = '#SkCanvas_drawColor' > drawColor< / a > < a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='SkCanvas_PointMode'>Enum SkCanvas::PointMode</a>
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum < a href = '#SkCanvas_PointMode' > PointMode< / a > {
< a href = '#SkCanvas_kPoints_PointMode' > kPoints PointMode< / a > ,
< a href = '#SkCanvas_kLines_PointMode' > kLines PointMode< / a > ,
< a href = '#SkCanvas_kPolygon_PointMode' > kPolygon PointMode< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
Selects if an array of points are drawn as discrete points, as lines, or as
an open polygon.
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kPoints_PointMode' >< code > SkCanvas::kPoints_PointMode</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
draw each point separately< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kLines_PointMode' >< code > SkCanvas::kLines_PointMode</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
draw each pair of points as a line segment< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kPolygon_PointMode' >< code > SkCanvas::kPolygon_PointMode</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
draw the array of points as a open polygon< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-08 05:32:09 +00:00
< div > < fiddle-embed name = "292b4b2008961b6f612434d3121fc4ce" > < div > The upper left corner shows three squares when drawn as points.
2017-07-28 19:18:29 +00:00
The upper right corner shows one line; when drawn as lines, two points are required per line.
The lower right corner shows two lines; when draw as polygon, no miter is drawn at the corner.
2018-03-05 18:26:16 +00:00
The lower left corner shows two lines with a miter when path contains polygon.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPoints' > < / a >
2017-07-28 19:18:29 +00:00
## drawPoints
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPoints' > drawPoints< / a > (< a href = '#SkCanvas_PointMode' > PointMode< / a > mode, size_t count, const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > pts[], const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = '#SkCanvas_drawPoints_pts' > pts< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPoints_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPoints_count' > count< / a > is the number of points; if < a href = '#SkCanvas_drawPoints_count' > count< / a > is less than one, has no effect.
< a href = '#SkCanvas_drawPoints_mode' > mode< / a > may be one of: < a href = '#SkCanvas_kPoints_PointMode' > kPoints PointMode< / a > , < a href = '#SkCanvas_kLines_PointMode' > kLines PointMode< / a > , or < a href = '#SkCanvas_kPolygon_PointMode' > kPolygon PointMode< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawPoints_mode' > mode< / a > is < a href = '#SkCanvas_kPoints_PointMode' > kPoints PointMode< / a > , the shape of point drawn depends on < a href = '#SkCanvas_drawPoints_paint' > paint< / a >
< a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > . If < a href = '#SkCanvas_drawPoints_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kRound_Cap' > SkPaint::kRound Cap< / a > , each point draws a
circle of diameter < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > . If < a href = '#SkCanvas_drawPoints_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kSquare_Cap' > SkPaint::kSquare Cap< / a >
or < a href = 'SkPaint_Reference#SkPaint_kButt_Cap' > SkPaint::kButt Cap< / a > , each point draws a square of width and height
< a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawPoints_mode' > mode< / a > is < a href = '#SkCanvas_kLines_PointMode' > kLines PointMode< / a > , each pair of points draws a line segment.
One line is drawn for every two points; each point is used once. If < a href = '#SkCanvas_drawPoints_count' > count< / a > is odd,
2018-01-04 21:11:51 +00:00
the final point is ignored.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawPoints_mode' > mode< / a > is < a href = '#SkCanvas_kPolygon_PointMode' > kPolygon PointMode< / a > , each adjacent pair of points draws a line segment.
< a href = '#SkCanvas_drawPoints_count' > count< / a > minus one lines are drawn; the first and last point are used once.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Each line segment respects < a href = '#SkCanvas_drawPoints_paint' > paint< / a > < a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > and < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > .
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > is ignored, as if were set to < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > .
2017-07-28 19:18:29 +00:00
2017-08-03 21:14:08 +00:00
Always draws each element one at a time; is not affected by
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > , and unlike < a href = '#SkCanvas_drawPath' > drawPath< / a > , does not create a mask from all points
2018-01-04 21:11:51 +00:00
and lines before drawing.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPoints_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
< td > whether < a href = '#SkCanvas_drawPoints_pts' > pts< / a > draws points or lines< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoints_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
< td > number of points in the array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoints_pts' > < code > < strong > pts< / strong > < / code > < / a > < / td >
< td > array of points to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoints_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "635d54b4716e226e93dfbc21ad40e77d" > < div >
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-05-16 11:07:07 +00:00
< td > The first column draws points.< / td >
< / tr > < tr >
< td > The second column draws points as lines.< / td >
< / tr > < tr >
< td > The third column draws points as a polygon.< / td >
< / tr > < tr >
< td > The fourth column draws points as a polygonal path.< / td >
< / tr > < tr >
< td > The first row uses a round cap and round join.< / td >
< / tr > < tr >
< td > The second row uses a square cap and a miter join.< / td >
< / tr > < tr >
< td > The third row uses a butt cap and a bevel join.< / td >
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
The transparent color makes multiple line draws visible;
2018-03-05 18:26:16 +00:00
the path is drawn all at once.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPoint' > < / a >
2017-07-28 19:18:29 +00:00
## drawPoint
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPoint' > drawPoint< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws point at (< a href = '#SkCanvas_drawPoint_x' > x< / a > , < a href = '#SkCanvas_drawPoint_y' > y< / a > ) using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPoint_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
The shape of point drawn depends on < a href = '#SkCanvas_drawPoint_paint' > paint< / a > < a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > .
If < a href = '#SkCanvas_drawPoint_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kRound_Cap' > SkPaint::kRound Cap< / a > , draw a circle of diameter
< a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > . If < a href = '#SkCanvas_drawPoint_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kSquare_Cap' > SkPaint::kSquare Cap< / a > or < a href = 'SkPaint_Reference#SkPaint_kButt_Cap' > SkPaint::kButt Cap< / a > ,
draw a square of width and height < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > .
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > is ignored, as if were set to < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPoint_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > left edge of circle or square< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoint_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > top edge of circle or square< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoint_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "3476b553e7b547b604a3f6969f02d933" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPoints' > drawPoints< / a > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPoint_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPoint' > drawPoint< / a > (< a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > p, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-08-03 21:14:08 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws point < a href = '#SkCanvas_drawPoint_2_p' > p< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPoint_2_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
The shape of point drawn depends on < a href = '#SkCanvas_drawPoint_2_paint' > paint< / a > < a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > .
If < a href = '#SkCanvas_drawPoint_2_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kRound_Cap' > SkPaint::kRound Cap< / a > , draw a circle of diameter
< a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > . If < a href = '#SkCanvas_drawPoint_2_paint' > paint< / a > is set to < a href = 'SkPaint_Reference#SkPaint_kSquare_Cap' > SkPaint::kSquare Cap< / a > or < a href = 'SkPaint_Reference#SkPaint_kButt_Cap' > SkPaint::kButt Cap< / a > ,
draw a square of width and height < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > .
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > is ignored, as if were set to < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > .
2017-08-03 21:14:08 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPoint_2_p' > < code > < strong > p< / strong > < / code > < / a > < / td >
< td > top-left edge of circle or square< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPoint_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-08-03 21:14:08 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "1a0a839061c69d870acca2bcfbdf1a41" > < / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPoints' > drawPoints< / a > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-08-03 21:14:08 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawLine' > < / a >
2017-07-28 19:18:29 +00:00
## drawLine
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawLine' > drawLine< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > x0, < a href = 'undocumented#SkScalar' > SkScalar< / a > y0, < a href = 'undocumented#SkScalar' > SkScalar< / a > x1, < a href = 'undocumented#SkScalar' > SkScalar< / a > y1, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Draws line segment from (< a href = '#SkCanvas_drawLine_x0' > x0< / a > , < a href = '#SkCanvas_drawLine_y0' > y0< / a > ) to (< a href = '#SkCanvas_drawLine_x1' > x1< / a > , < a href = '#SkCanvas_drawLine_y1' > y1< / a > ) using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawLine_paint' > paint< / a > .
In < a href = '#SkCanvas_drawLine_paint' > paint< / a > : < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness;
< a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > draws the end rounded or square;
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > is ignored, as if were set to < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawLine_x0' > < code > < strong > x0< / strong > < / code > < / a > < / td >
< td > start of line segment on x-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_y0' > < code > < strong > y0< / strong > < / code > < / a > < / td >
< td > start of line segment on y-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_x1' > < code > < strong > x1< / strong > < / code > < / a > < / td >
< td > end of line segment on x-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_y1' > < code > < strong > y1< / strong > < / code > < / a > < / td >
< td > end of line segment on y-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "d10ee4a265f278d02afe11ad889b293b" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawLine_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawLine' > drawLine< / a > (< a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > p0, < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > p1, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-08-03 21:14:08 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Draws line segment from < a href = '#SkCanvas_drawLine_2_p0' > p0< / a > to < a href = '#SkCanvas_drawLine_2_p1' > p1< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawLine_2_paint' > paint< / a > .
In < a href = '#SkCanvas_drawLine_2_paint' > paint< / a > : < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness;
< a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > draws the end rounded or square;
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > is ignored, as if were set to < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > .
2017-08-03 21:14:08 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawLine_2_p0' > < code > < strong > p0< / strong > < / code > < / a > < / td >
< td > start of line segment< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_2_p1' > < code > < strong > p1< / strong > < / code > < / a > < / td >
< td > end of line segment< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawLine_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-08-03 21:14:08 +00:00
< / tr >
< / table >
### Example
2018-07-07 05:34:31 +00:00
< div > < fiddle-embed name = "f8525816cb596dde1a3855446792c8e0" > < / fiddle-embed > < / div >
2017-08-03 21:14:08 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-08-03 21:14:08 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawRect' > drawRect< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawRect_rect' > rect< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawRect_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
In < a href = '#SkCanvas_drawRect_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if rectangle is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness, and
< a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > draws the corners rounded or square.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawRect_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > rectangle to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-08 05:32:09 +00:00
< div > < fiddle-embed name = "871b0da9b4a23de11ae7a772ce14aed3" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawIRect' > drawIRect< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawRegion' > drawRegion< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawIRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawIRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawIRect' > drawIRect< / a > (const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & rect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawIRect_rect' > rect< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawIRect_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
In < a href = '#SkCanvas_drawIRect_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if rectangle is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness, and
< a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > draws the corners rounded or square.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawIRect_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > rectangle to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawIRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "d3d8ca584134560750b1efa4a4c6e138" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawRegion' > drawRegion< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawRegion' > < / a >
2017-07-28 19:18:29 +00:00
## drawRegion
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
void < a href = '#SkCanvas_drawRegion' > drawRegion< / a > (const < a href = 'SkRegion_Reference#SkRegion' > SkRegion< / a > & region, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-08-10 17:09:13 +00:00
Draws < a href = 'SkRegion_Reference#Region' > Region< / a > < a href = '#SkCanvas_drawRegion_region' > region< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawRegion_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
In < a href = '#SkCanvas_drawRegion_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if rectangle is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness, and
< a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > draws the corners rounded or square.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawRegion_region' > < code > < strong > region< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawRegion_region' > region< / a > to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRegion_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "80309e0deca0f8add616cec7bec634ca" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawIRect' > drawIRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawOval' > < / a >
2017-07-28 19:18:29 +00:00
## drawOval
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawOval' > drawOval< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & oval, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Oval' > Oval< / a > < a href = '#SkCanvas_drawOval_oval' > oval< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > .
2018-05-16 11:07:07 +00:00
In < a href = '#SkCanvas_drawOval_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'undocumented#Oval' > Oval< / a > is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawOval_oval' > < code > < strong > oval< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > bounds of < a href = 'undocumented#Oval' > Oval< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawOval_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "8b6b86f8a022811cd29a9c6ab771df12" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawRRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawRRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawRRect' > drawRRect< / a > (const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & rrect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > < a href = '#SkCanvas_drawRRect_rrect' > rrect< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawRRect_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
In < a href = '#SkCanvas_drawRRect_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = '#SkCanvas_drawRRect_rrect' > rrect< / a > is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawRRect_rrect' > rrect< / a > may represent a rectangle, circle, oval, uniformly rounded rectangle, or
2017-08-03 21:14:08 +00:00
may have any combination of positive non-square radii for the four corners.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawRRect_rrect' > < code > < strong > rrect< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > with up to eight corner radii to draw< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "90fed1bb11efb43aada94113338c63d8" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawDRRect' > drawDRRect< / a > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawDRRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawDRRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawDRRect' > drawDRRect< / a > (const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & outer, const < a href = 'SkRRect_Reference#SkRRect' > SkRRect< / a > & inner, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > < a href = '#SkCanvas_drawDRRect_outer' > outer< / a > and < a href = '#SkCanvas_drawDRRect_inner' > inner< / a >
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawDRRect_paint' > paint< / a > .
< a href = '#SkCanvas_drawDRRect_outer' > outer< / a > must contain < a href = '#SkCanvas_drawDRRect_inner' > inner< / a > or the drawing is undefined.
2018-06-27 15:00:21 +00:00
In < a href = '#SkCanvas_drawDRRect_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > is stroked or filled;
2018-05-16 11:07:07 +00:00
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
2018-06-27 15:00:21 +00:00
If stroked and < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > corner has zero length radii, < a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > can
2018-01-04 21:11:51 +00:00
draw corners rounded or square.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
GPU-backed platforms optimize drawing when both < a href = '#SkCanvas_drawDRRect_outer' > outer< / a > and < a href = '#SkCanvas_drawDRRect_inner' > inner< / a > are
concave and < a href = '#SkCanvas_drawDRRect_outer' > outer< / a > contains < a href = '#SkCanvas_drawDRRect_inner' > inner< / a > . These platforms may not be able to draw
< a href = 'SkPath_Reference#Path' > Path< / a > built with identical data as fast.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawDRRect_outer' > < code > < strong > outer< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > < a href = '#SkCanvas_drawDRRect_outer' > outer< / a > bounds to draw< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawDRRect_inner' > < code > < strong > inner< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > < a href = '#SkCanvas_drawDRRect_inner' > inner< / a > bounds to draw< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawDRRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "02e33141f13da2f19aef7feb7117b541" > < / fiddle-embed > < / div >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "30823cb4edf884d330285ea161664931" > < div > Outer < a href = 'SkRect_Reference#Rect' > Rect< / a > has no corner radii, but stroke join is rounded.
2018-06-27 15:00:21 +00:00
Inner < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > has corner radii; outset stroke increases radii of corners.
Stroke join does not affect < a href = '#SkCanvas_drawDRRect_inner' > inner< / a > < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > since it has no sharp corners.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawCircle' > < / a >
2017-07-28 19:18:29 +00:00
## drawCircle
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawCircle' > drawCircle< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > cx, < a href = 'undocumented#SkScalar' > SkScalar< / a > cy, < a href = 'undocumented#SkScalar' > SkScalar< / a > radius, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Circle' > Circle< / a > at (< a href = '#SkCanvas_drawCircle_cx' > cx< / a > , < a href = '#SkCanvas_drawCircle_cy' > cy< / a > ) with < a href = '#SkCanvas_drawCircle_radius' > radius< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawCircle_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawCircle_radius' > radius< / a > is zero or less, nothing is drawn.
In < a href = '#SkCanvas_drawCircle_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'undocumented#Circle' > Circle< / a > is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawCircle_cx' > < code > < strong > cx< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Circle' > Circle< / a > center on the x-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawCircle_cy' > < code > < strong > cy< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Circle' > Circle< / a > center on the y-axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawCircle_radius' > < code > < strong > radius< / strong > < / code > < / a > < / td >
< td > half the diameter of < a href = 'undocumented#Circle' > Circle< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawCircle_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "841229e25ca9dfb68bd0dc4dfff356eb" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawArc' > drawArc< / a > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawCircle_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawCircle' > drawCircle< / a > (< a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > center, < a href = 'undocumented#SkScalar' > SkScalar< / a > radius, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-08-03 21:14:08 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Circle' > Circle< / a > at < a href = '#SkCanvas_drawCircle_2_center' > center< / a > with < a href = '#SkCanvas_drawCircle_2_radius' > radius< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawCircle_2_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawCircle_2_radius' > radius< / a > is zero or less, nothing is drawn.
In < a href = '#SkCanvas_drawCircle_2_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'undocumented#Circle' > Circle< / a > is stroked or filled;
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
2017-08-03 21:14:08 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawCircle_2_center' > < code > < strong > center< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Circle' > Circle< / a > < a href = '#SkCanvas_drawCircle_2_center' > center< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawCircle_2_radius' > < code > < strong > radius< / strong > < / code > < / a > < / td >
< td > half the diameter of < a href = 'undocumented#Circle' > Circle< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawCircle_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-08-03 21:14:08 +00:00
< / tr >
< / table >
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "9303ffae45ddd0b0a1f93d816a1762f4" > < / fiddle-embed > < / div >
2017-08-03 21:14:08 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawRRect' > drawRRect< / a > < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawArc' > drawArc< / a > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-08-03 21:14:08 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawArc' > < / a >
2017-07-28 19:18:29 +00:00
## drawArc
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawArc' > drawArc< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & oval, < a href = 'undocumented#SkScalar' > SkScalar< / a > startAngle, < a href = 'undocumented#SkScalar' > SkScalar< / a > sweepAngle, bool useCenter,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Arc' > Arc< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawArc_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Arc' > Arc< / a > is part of < a href = 'undocumented#Oval' > Oval< / a > bounded by < a href = '#SkCanvas_drawArc_oval' > oval< / a > , sweeping from < a href = '#SkCanvas_drawArc_startAngle' > startAngle< / a > to < a href = '#SkCanvas_drawArc_startAngle' > startAngle< / a > plus
< a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > . < a href = '#SkCanvas_drawArc_startAngle' > startAngle< / a > and < a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > are in degrees.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawArc_startAngle' > startAngle< / a > of zero places start point at the right middle edge of < a href = '#SkCanvas_drawArc_oval' > oval< / a > .
A positive < a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > places < a href = 'undocumented#Arc' > Arc< / a > end point clockwise from start point;
a negative < a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > places < a href = 'undocumented#Arc' > Arc< / a > end point counterclockwise from start point.
< a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > may exceed 360 degrees, a full circle.
If < a href = '#SkCanvas_drawArc_useCenter' > useCenter< / a > is true, draw a wedge that includes lines from < a href = '#SkCanvas_drawArc_oval' > oval< / a >
center to < a href = 'undocumented#Arc' > Arc< / a > end points. If < a href = '#SkCanvas_drawArc_useCenter' > useCenter< / a > is false, draw < a href = 'undocumented#Arc' > Arc< / a > between end points.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawArc_oval' > oval< / a > is empty or < a href = '#SkCanvas_drawArc_sweepAngle' > sweepAngle< / a > is zero, nothing is drawn.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawArc_oval' > < code > < strong > oval< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > bounds of < a href = 'undocumented#Oval' > Oval< / a > containing < a href = 'undocumented#Arc' > Arc< / a > to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawArc_startAngle' > < code > < strong > startAngle< / strong > < / code > < / a > < / td >
< td > angle in degrees where < a href = 'undocumented#Arc' > Arc< / a > begins< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawArc_sweepAngle' > < code > < strong > sweepAngle< / strong > < / code > < / a > < / td >
< td > sweep angle in degrees; positive is clockwise< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawArc_useCenter' > < code > < strong > useCenter< / strong > < / code > < / a > < / td >
< td > if true, include the center of the < a href = '#SkCanvas_drawArc_oval' > oval< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawArc_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > stroke or fill, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "11f0fbe7b30d776913c2e7c92c02ff57" > < / fiddle-embed > < / div >
### Example
< div > < fiddle-embed name = "e91dbe45974489b8962c815017b7914f" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkPath_Reference#SkPath_arcTo' > SkPath::arcTo< / a > < sup > < a href = 'SkPath_Reference#SkPath_arcTo_2' > [2]< / a > < / sup > < sup > < a href = 'SkPath_Reference#SkPath_arcTo_3' > [3]< / a > < / sup > < sup > < a href = 'SkPath_Reference#SkPath_arcTo_4' > [4]< / a > < / sup > < sup > < a href = 'SkPath_Reference#SkPath_arcTo_5' > [5]< / a > < / sup > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawRoundRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawRoundRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawRoundRect' > drawRoundRect< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, < a href = 'undocumented#SkScalar' > SkScalar< / a > rx, < a href = 'undocumented#SkScalar' > SkScalar< / a > ry, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > bounded by < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawRoundRect_rect' > rect< / a > , with corner radii (< a href = '#SkCanvas_drawRoundRect_rx' > rx< / a > , < a href = '#SkCanvas_drawRoundRect_ry' > ry< / a > ) using < a href = '#Clip' > Clip< / a > ,
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawRoundRect_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-06-27 15:00:21 +00:00
In < a href = '#SkCanvas_drawRoundRect_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > is stroked or filled;
2018-05-16 11:07:07 +00:00
if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness.
If < a href = '#SkCanvas_drawRoundRect_rx' > rx< / a > or < a href = '#SkCanvas_drawRoundRect_ry' > ry< / a > are less than zero, they are treated as if they are zero.
If < a href = '#SkCanvas_drawRoundRect_rx' > rx< / a > plus < a href = '#SkCanvas_drawRoundRect_ry' > ry< / a > exceeds < a href = '#SkCanvas_drawRoundRect_rect' > rect< / a > width or < a href = '#SkCanvas_drawRoundRect_rect' > rect< / a > height, radii are scaled down to fit.
2018-06-27 15:00:21 +00:00
If < a href = '#SkCanvas_drawRoundRect_rx' > rx< / a > and < a href = '#SkCanvas_drawRoundRect_ry' > ry< / a > are zero, < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > is drawn as < a href = 'SkRect_Reference#Rect' > Rect< / a > and if stroked is affected by
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawRoundRect_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > bounds of < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > to draw< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRoundRect_rx' > < code > < strong > rx< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > axis length on x-axis of oval describing rounded corners< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRoundRect_ry' > < code > < strong > ry< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > axis length on y-axis of oval describing rounded corners< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawRoundRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "199fe818c09026c114e165bff166a39f" > < div > Top row has a zero radius a generates a rectangle.
Second row radii sum to less than sides.
Third row radii sum equals sides.
2018-03-05 18:26:16 +00:00
Fourth row radii sum exceeds sides; radii are scaled to fit.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
DrawRRect < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawDRRect' > drawDRRect< / a > < a href = '#SkCanvas_drawPath' > drawPath< / a > < a href = '#SkCanvas_drawCircle' > drawCircle< / a > < sup > < a href = '#SkCanvas_drawCircle_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawOval' > drawOval< / a > < a href = '#SkCanvas_drawPoint' > drawPoint< / a > < sup > < a href = '#SkCanvas_drawPoint_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPath' > < / a >
2017-07-28 19:18:29 +00:00
## drawPath
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPath' > drawPath< / a > (const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkPath_Reference#Path' > Path< / a > < a href = '#SkCanvas_drawPath_path' > path< / a > using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPath_paint' > paint< / a > .
2018-05-16 11:07:07 +00:00
< a href = 'SkPath_Reference#Path' > Path< / a > contains an array of < a href = 'SkPath_Reference#Contour' > Path Contour< / a > , each of which may be open or closed.
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
In < a href = '#SkCanvas_drawPath_paint' > paint< / a > : < a href = 'SkPaint_Reference#Style' > Paint Style< / a > determines if < a href = 'SkRRect_Reference#RRect' > Round Rect< / a > is stroked or filled:
2018-05-16 11:07:07 +00:00
if filled, < a href = 'SkPath_Reference#Fill_Type' > Path Fill Type< / a > determines whether < a href = 'SkPath_Reference#Contour' > Path Contour< / a > describes inside or
outside of fill; if stroked, < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > describes the line thickness,
< a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > describes line ends, and < a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > describes how
2017-08-03 21:14:08 +00:00
corners are drawn.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPath_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPath_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > stroke, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "fe2294131f422b8d6752f6a880f98ad9" > < div > Top rows draw stroked < a href = '#SkCanvas_drawPath_path' > path< / a > with combinations of joins and caps. The open contour
2017-07-28 19:18:29 +00:00
is affected by caps; the closed contour is affected by joins.
2018-01-04 21:11:51 +00:00
Bottom row draws fill the same for open and closed contour.
2017-07-28 19:18:29 +00:00
First bottom column shows winding fills overlap.
Second bottom column shows even odd fills exclude overlap.
2018-03-05 18:26:16 +00:00
Third bottom column shows inverse winding fills area outside both contours.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkPath_Reference#SkPath' > SkPath< / a > < a href = '#SkCanvas_drawLine' > drawLine< / a > < sup > < a href = '#SkCanvas_drawLine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawArc' > drawArc< / a > < a href = '#SkCanvas_drawRect' > drawRect< / a > < a href = '#SkCanvas_drawPoints' > drawPoints< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Draw_Image'>Draw Image</a>
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImage' > drawImage< / a > , < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > , and < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > can be called with a bare pointer or
2017-08-03 21:14:08 +00:00
a smart pointer as a convenience. The pairs of calls are otherwise identical.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImage' > < / a >
2017-07-28 19:18:29 +00:00
## drawImage
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImage' > drawImage< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, < a href = 'undocumented#SkScalar' > SkScalar< / a > left, < a href = 'undocumented#SkScalar' > SkScalar< / a > top, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImage_image' > image< / a > , with its < a href = '#SkCanvas_drawImage_top' > top< / a > -< a href = '#SkCanvas_drawImage_left' > left< / a > corner at (< a href = '#SkCanvas_drawImage_left' > left< / a > , < a href = '#SkCanvas_drawImage_top' > top< / a > ),
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImage_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
If < a href = '#SkCanvas_drawImage_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > ,
2018-05-16 11:07:07 +00:00
and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImage_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
If < a href = '#SkCanvas_drawImage_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImage_image' > image< / a > bounds. If generated
mask extends beyond < a href = '#SkCanvas_drawImage_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImage_image' > image< / a > edge colors, just as < a href = 'undocumented#Shader' > Shader< / a >
made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the
< a href = '#SkCanvas_drawImage_image' > image< / a > edge color when it samples outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImage_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > uncompressed rectangular map of pixels< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_left' > < code > < strong > left< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawImage_left' > left< / a > side of < a href = '#SkCanvas_drawImage_image' > image< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_top' > < code > < strong > top< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawImage_top' > top< / a > side of < a href = '#SkCanvas_drawImage_image' > image< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-03 21:18:07 +00:00
< div > < fiddle-embed name = "185746dc0faa6f1df30c4afe098646ff" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = 'SkPaint_Reference#SkPaint_setImageFilter' > SkPaint::setImageFilter< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImage_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImage' > drawImage< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & image, < a href = 'undocumented#SkScalar' > SkScalar< / a > left, < a href = 'undocumented#SkScalar' > SkScalar< / a > top,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImage_2_image' > image< / a > , with its < a href = '#SkCanvas_drawImage_2_top' > top< / a > -< a href = '#SkCanvas_drawImage_2_left' > left< / a > corner at (< a href = '#SkCanvas_drawImage_2_left' > left< / a > , < a href = '#SkCanvas_drawImage_2_top' > top< / a > ),
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImage_2_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImage_2_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImage_2_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImage_2_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImage_2_image' > image< / a > bounds. If generated
mask extends beyond < a href = '#SkCanvas_drawImage_2_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImage_2_image' > image< / a > edge colors, just as < a href = 'undocumented#Shader' > Shader< / a >
made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the
< a href = '#SkCanvas_drawImage_2_image' > image< / a > edge color when it samples outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImage_2_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > uncompressed rectangular map of pixels< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_2_left' > < code > < strong > left< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawImage_2_left' > left< / a > side of < a href = '#SkCanvas_drawImage_2_image' > image< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_2_top' > < code > < strong > top< / strong > < / code > < / a > < / td >
< td > pop side of < a href = '#SkCanvas_drawImage_2_image' > image< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImage_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "a4e877e891b1be5faa2b7fd07f673a10" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = 'SkPaint_Reference#SkPaint_setImageFilter' > SkPaint::setImageFilter< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='SkCanvas_SrcRectConstraint'>Enum SkCanvas::SrcRectConstraint</a>
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum < a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > {
< a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > ,
< a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > controls the behavior at the edge of source < a href = 'SkRect_Reference#Rect' > Rect< / a > ,
provided to < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > , trading off speed for precision.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Image_Filter' > Image Filter< / a > in < a href = 'SkPaint_Reference#Paint' > Paint< / a > may sample multiple pixels in the image. Source < a href = 'SkRect_Reference#Rect' > Rect< / a >
restricts the bounds of pixels that may be read. < a href = 'undocumented#Image_Filter' > Image Filter< / a > may slow down if
it cannot read outside the bounds, when sampling near the edge of source < a href = 'SkRect_Reference#Rect' > Rect< / a > .
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > specifies whether an < a href = 'undocumented#Image_Filter' > Image Filter< / a > is allowed to read pixels
outside source < a href = 'SkRect_Reference#Rect' > Rect< / a > .
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kStrict_SrcRectConstraint' >< code > SkCanvas::kStrict_SrcRectConstraint</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Requires < a href = 'undocumented#Image_Filter' > Image Filter< / a > to respect source < a href = 'SkRect_Reference#Rect' > Rect< / a > ,
sampling only inside of its bounds, possibly with a performance penalty.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_kFast_SrcRectConstraint' >< code > SkCanvas::kFast_SrcRectConstraint</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Permits < a href = 'undocumented#Image_Filter' > Image Filter< / a > to sample outside of source < a href = 'SkRect_Reference#Rect' > Rect< / a >
by half the width of < a href = 'undocumented#Image_Filter' > Image Filter< / a > , permitting it to run faster but with
2018-03-05 18:26:16 +00:00
error at the image edges.
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-17 12:20:27 +00:00
< div > < fiddle-embed name = "5df49d1f4da37275a1f10ef7f1a749f0" > < div > redBorder contains a black and white checkerboard bordered by red.
2017-07-28 19:18:29 +00:00
redBorder is drawn scaled by 16 on the left.
2017-09-01 19:51:02 +00:00
The middle and right bitmaps are filtered checkerboards.
2018-05-16 11:07:07 +00:00
Drawing the checkerboard with < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > shows only a blur of black and white.
Drawing the checkerboard with < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows red to bleed in the corners.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = 'SkPaint_Reference#SkPaint_setImageFilter' > SkPaint::setImageFilter< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawImageRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & src, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint,
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_src' > src< / a > of < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_src' > src< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_src' > < code > < strong > src< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_image' > image< / a > to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_src' > src< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "bfd18e9cac896cdf94c9f154ccf94be8" > < div > The left bitmap draws with < a href = 'SkPaint_Reference#Paint' > Paint< / a > default < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , and stays within
its bounds; there is no bleeding with < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > .
the middle and right bitmaps draw with < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > ; with
< a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > , the filter remains within the checkerboard, and
with < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > red bleeds on the edges.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & isrc, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint,
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawImageRect_2_isrc' > isrc< / a > of < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_2_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
Note that < a href = '#SkCanvas_drawImageRect_2_isrc' > isrc< / a > is on integer pixel boundaries; < a href = '#SkCanvas_drawImageRect_2_dst' > dst< / a > may include fractional
boundaries. Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a >
< a href = '#SkCanvas_drawImageRect_2_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_2_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_2_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_2_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_2_isrc' > isrc< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_2_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_2_isrc' > < code > < strong > isrc< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkIRect_Reference#IRect' > IRect< / a > of < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_2_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_2_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_2_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_2_isrc' > isrc< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "7f92cd5c9b9f4b1ac3cd933b08037bfe" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint,
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_3_dst' > dst< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > ,
2018-05-16 11:07:07 +00:00
and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_3_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_3_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_3_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_3_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_3_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_3_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_3_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_3_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_3_image' > image< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "3cf8fb639fef99993cafc064d550c739" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect_4' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & image, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & src, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, < a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_4_src' > src< / a > of < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_4_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_4_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_4_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_4_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_4_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_4_src' > src< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_4_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_4_src' > < code > < strong > src< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_4_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_4_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_4_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_4_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_4_src' > src< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "d4b35a9d24c32c042bd1f529b8de3c0d" > < div > < a href = '#Canvas' > Canvas< / a > scales and translates; transformation from < a href = '#SkCanvas_drawImageRect_4_src' > src< / a > to < a href = '#SkCanvas_drawImageRect_4_dst' > dst< / a > also scales.
2018-03-05 18:26:16 +00:00
The two matrices are concatenated to create the final transformation.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect_5' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & image, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & isrc, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, < a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawImageRect_5_isrc' > isrc< / a > of < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_5_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_5_isrc' > isrc< / a > is on integer pixel boundaries; < a href = '#SkCanvas_drawImageRect_5_dst' > dst< / a > may include fractional boundaries.
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_5_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_5_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_5_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_5_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_5_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_5_isrc' > < code > < strong > isrc< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkIRect_Reference#IRect' > IRect< / a > of < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_5_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_5_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_5_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_5_image' > image< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "d307e7e1237f39fb54d80723e5449857" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageRect_6' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & image, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint,
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageRect_6_dst' > dst< / a > ,
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_6_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageRect_6_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageRect_6_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > edge color when it samples outside of its bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect_6_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageRect_6_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_6_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_6_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageRect_6_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawImageRect_6_image' > image< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "3a47ef94cb70144455f80333d8653e6c" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageNine' > < / a >
2017-07-28 19:18:29 +00:00
## drawImageNine
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & center, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageNine_image' > image< / a > stretched proportionally to fit into < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageNine_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawImageNine_center' > center< / a > divides the < a href = '#SkCanvas_drawImageNine_image' > image< / a > into nine sections: four sides, four corners, and
the < a href = '#SkCanvas_drawImageNine_center' > center< / a > . Corners are unmodified or scaled down proportionately if their sides
are larger than < a href = '#SkCanvas_drawImageNine_dst' > dst< / a > ; < a href = '#SkCanvas_drawImageNine_center' > center< / a > and four sides are scaled to fit remaining space, if any.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > .
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If image is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from image bounds. If < a href = '#SkCanvas_drawImageNine_paint' > paint< / a >
< a href = 'undocumented#Filter_Quality' > Filter Quality< / a > set to < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , disable pixel filtering. For all
other values of < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > , use < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > to filter pixels.
2018-05-30 13:21:49 +00:00
Any < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > on < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > is ignored as is < a href = '#SkCanvas_drawImageNine_paint' > paint< / a > < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliasing< / a > state.
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageNine_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageNine_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageNine_image' > image< / a > edge color when it samples outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageNine_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_center' > < code > < strong > center< / strong > < / code > < / a > < / td >
< td > < a href = 'SkIRect_Reference#IRect' > IRect< / a > edge of < a href = '#SkCanvas_drawImageNine_image' > image< / a > corners and sides< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageNine_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-16 12:12:01 +00:00
< div > < fiddle-embed name = "4f153cf1d0dbe1a95acf5badeec14dae" > < div > The leftmost < a href = '#SkCanvas_drawImageNine_image' > image< / a > is smaller than < a href = '#SkCanvas_drawImageNine_center' > center< / a > ; only corners are drawn, all scaled to fit.
2018-05-16 11:07:07 +00:00
The second < a href = '#SkCanvas_drawImageNine_image' > image< / a > equals the size of < a href = '#SkCanvas_drawImageNine_center' > center< / a > ; only corners are drawn without scaling.
The remaining images are larger than < a href = '#SkCanvas_drawImageNine_center' > center< / a > . All corners draw without scaling.
The sides and < a href = '#SkCanvas_drawImageNine_center' > center< / a > are scaled if needed to take up the remaining space.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageNine_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & image, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & center, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > stretched proportionally to fit into < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageNine_2_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > divides the < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > into nine sections: four sides, four corners, and
the < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > . Corners are not scaled, or scaled down proportionately if their sides
are larger than < a href = '#SkCanvas_drawImageNine_2_dst' > dst< / a > ; < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > and four sides are scaled to fit remaining space, if any.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > .
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If image is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-30 13:21:49 +00:00
If < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from image bounds. If < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a >
< a href = 'undocumented#Filter_Quality' > Filter Quality< / a > set to < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , disable pixel filtering. For all
other values of < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > , use < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > to filter pixels.
Any < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > on < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > is ignored as is < a href = '#SkCanvas_drawImageNine_2_paint' > paint< / a > < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliasing< / a > state.
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > bounds, replicate < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > edge colors, just
as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'SkImage_Reference#SkImage_makeShader' > SkImage::makeShader< / a > with < a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set
replicates the < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > edge color when it samples outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageNine_2_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_2_center' > < code > < strong > center< / strong > < / code > < / a > < / td >
< td > < a href = 'SkIRect_Reference#IRect' > IRect< / a > edge of < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > corners and sides< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_2_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageNine_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "d597d9af8d17fd93e634dd12017058e2" > < div > The two leftmost images has four corners and sides to the left and right of < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > .
2018-05-16 11:07:07 +00:00
The leftmost < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > scales the width of corners proportionately to fit.
The third and fourth < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > corners are not scaled; the sides and < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > are scaled to
2017-07-28 19:18:29 +00:00
fill the remaining space.
2018-05-16 11:07:07 +00:00
The rightmost < a href = '#SkCanvas_drawImageNine_2_image' > image< / a > has four corners scaled vertically to fit, and uses sides above
and below < a href = '#SkCanvas_drawImageNine_2_center' > center< / a > to fill the remaining space.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmap' > < / a >
2017-07-28 19:18:29 +00:00
## drawBitmap
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, < a href = 'undocumented#SkScalar' > SkScalar< / a > left, < a href = 'undocumented#SkScalar' > SkScalar< / a > top, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > , with its < a href = '#SkCanvas_drawBitmap_top' > top< / a > -< a href = '#SkCanvas_drawBitmap_left' > left< / a > corner at (< a href = '#SkCanvas_drawBitmap_left' > left< / a > , < a href = '#SkCanvas_drawBitmap_top' > top< / a > ),
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmap_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmap_paint' > paint< / a > is not nullptr, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmap_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > edge color when it samples
2018-01-04 21:11:51 +00:00
outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmap_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmap_left' > < code > < strong > left< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawBitmap_left' > left< / a > side of < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmap_top' > < code > < strong > top< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawBitmap_top' > top< / a > side of < a href = '#SkCanvas_drawBitmap_bitmap' > bitmap< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmap_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "4a521be1f850058541e136a808c65e78" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > < a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > < sup > < a href = '#SkCanvas_drawBitmapRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawBitmapRect_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels' > SkBitmap::writePixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_writePixels_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmapRect' > < / a >
2017-07-28 19:18:29 +00:00
## drawBitmapRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & src, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, < a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapRect_src' > src< / a > of < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapRect_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmapRect_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmapRect_bitmap' > bitmap< / a > edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapRect_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawBitmapRect_src' > src< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmapRect_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_src' > < code > < strong > src< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawBitmapRect_src' > src< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "7d04932f2a259cc70d6e45cd25a6feb6" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmapRect_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & isrc, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint, < a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawBitmapRect_2_isrc' > isrc< / a > of < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapRect_2_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapRect_2_isrc' > isrc< / a > is on integer pixel boundaries; < a href = '#SkCanvas_drawBitmapRect_2_dst' > dst< / a > may include fractional boundaries.
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_2_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_2_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmapRect_2_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmapRect_2_bitmap' > bitmap< / a > edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapRect_2_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawBitmapRect_2_isrc' > isrc< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmapRect_2_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_2_isrc' > < code > < strong > isrc< / strong > < / code > < / a > < / td >
< td > source < a href = 'SkIRect_Reference#IRect' > IRect< / a > of image to draw from< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_2_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_2_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > sample strictly within < a href = '#SkCanvas_drawBitmapRect_2_isrc' > isrc< / a > , or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "0a3c6d2459566e58cee7d4910655ee21" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmapRect_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint,
< a href = '#SkCanvas_SrcRectConstraint' > SrcRectConstraint< / a > constraint = < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > , scaled and translated to fill < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapRect_3_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > bounds is on integer pixel boundaries; < a href = '#SkCanvas_drawBitmapRect_3_dst' > dst< / a > may include fractional boundaries.
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_3_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapRect_3_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmapRect_3_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > bounds.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapRect_3_constraint' > constraint< / a > set to < a href = '#SkCanvas_kStrict_SrcRectConstraint' > kStrict SrcRectConstraint< / a > limits < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > to
sample within < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > ; set to < a href = '#SkCanvas_kFast_SrcRectConstraint' > kFast SrcRectConstraint< / a > allows sampling outside to
2017-08-03 21:14:08 +00:00
improve performance.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmapRect_3_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_3_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_3_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapRect_3_constraint' > < code > < strong > constraint< / strong > < / code > < / a > < / td >
< td > filter strictly within < a href = '#SkCanvas_drawBitmapRect_3_bitmap' > bitmap< / a > or draw faster< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "bdbeac3c97f60a63987b1cc8e1f1e91e" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < sup > < a href = '#SkCanvas_drawImageRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_4' > [4]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_5' > [5]< / a > < / sup > < sup > < a href = '#SkCanvas_drawImageRect_6' > [6]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmapNine' > < / a >
2017-07-28 19:18:29 +00:00
## drawBitmapNine
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & center, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > stretched proportionally to fit into < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapNine_dst' > dst< / a > .
2018-05-16 11:07:07 +00:00
< a href = 'SkIRect_Reference#IRect' > IRect< / a > < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > divides the < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > into nine sections: four sides, four corners,
and the < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > . Corners are not scaled, or scaled down proportionately if their
sides are larger than < a href = '#SkCanvas_drawBitmapNine_dst' > dst< / a > ; < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > and four sides are scaled to fit remaining
2017-08-03 21:14:08 +00:00
space, if any.
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > .
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If bitmap is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from bitmap bounds. If < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a >
< a href = 'undocumented#Filter_Quality' > Filter Quality< / a > set to < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , disable pixel filtering. For all
other values of < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > , use < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > to filter pixels.
2018-05-30 13:21:49 +00:00
Any < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > on < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > is ignored as is < a href = '#SkCanvas_drawBitmapNine_paint' > paint< / a > < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliasing< / a > state.
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmapNine_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapNine_center' > < code > < strong > center< / strong > < / code > < / a > < / td >
< td > < a href = 'SkIRect_Reference#IRect' > IRect< / a > edge of image corners and sides< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapNine_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapNine_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "e99e7be0d8f67dfacbecf85df585433d" > < div > The two leftmost < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > draws has four corners and sides to the left and right of < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > .
2018-05-16 11:07:07 +00:00
The leftmost < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > draw scales the width of corners proportionately to fit.
The third and fourth draw corners are not scaled; the sides and < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > are scaled to
2017-07-28 19:18:29 +00:00
fill the remaining space.
2018-05-16 11:07:07 +00:00
The rightmost < a href = '#SkCanvas_drawBitmapNine_bitmap' > bitmap< / a > draw has four corners scaled vertically to fit, and uses sides above
and below < a href = '#SkCanvas_drawBitmapNine_center' > center< / a > to fill the remaining space.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > < sup > < a href = '#SkCanvas_drawBitmapRect_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawBitmapRect_3' > [3]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Draw_Image_Lattice'>Draw Image Lattice</a>
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
# <a name='SkCanvas_Lattice'>Struct SkCanvas::Lattice</a>
2017-10-26 11:58:48 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
struct < a href = '#SkCanvas_Lattice' > Lattice< / a > {
enum < a href = '#SkCanvas_Lattice_RectType' > RectType< / a > ...
const int* < a href = '#SkCanvas_Lattice_fXDivs' > fXDivs< / a > ;
const int* < a href = '#SkCanvas_Lattice_fYDivs' > fYDivs< / a > ;
const < a href = '#SkCanvas_Lattice_RectType' > RectType< / a > * < a href = '#SkCanvas_Lattice_fRectTypes' > fRectTypes< / a > ;
int < a href = '#SkCanvas_Lattice_fXCount' > fXCount< / a > ;
int < a href = '#SkCanvas_Lattice_fYCount' > fYCount< / a > ;
const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > * < a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > ;
const < a href = 'SkColor_Reference#SkColor' > SkColor< / a > * < a href = '#SkCanvas_Lattice_fColors' > fColors< / a > ;
};
< / pre >
2018-05-30 13:21:49 +00:00
< a href = '#SkCanvas_Lattice' > Lattice< / a > divides < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > or < a href = 'SkImage_Reference#Image' > Image< / a > into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
2018-05-16 11:07:07 +00:00
## <a name='Draw_Image_Lattice_Overview'>Draw Image Lattice Overview</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw_Image_Lattice_Constant' > Constants</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > enum and enum class, and their const values</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Draw_Image_Lattice_Member' > Members</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > member values</ td >
< / tr >
< / table >
## <a name='Draw_Image_Lattice_Constant'>Draw Image Lattice Constant</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< / table >
## <a name='SkCanvas_Lattice_RectType'>Enum SkCanvas::Lattice::RectType</a>
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum < a href = '#SkCanvas_Lattice_RectType' > RectType< / a > : uint8_t {
< a href = '#SkCanvas_Lattice_kDefault' > kDefault< / a > = 0,
< a href = '#SkCanvas_Lattice_kTransparent' > kTransparent< / a > ,
< a href = '#SkCanvas_Lattice_kFixedColor' > kFixedColor< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2017-12-11 21:03:17 +00:00
Optional setting per rectangular grid entry to make it transparent,
or to fill the grid entry with a color.
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_kDefault' >< code > SkCanvas::Lattice::kDefault</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
draws Bitmap into lattice rectangle< / td >
2017-12-11 21:03:17 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_kTransparent' >< code > SkCanvas::Lattice::kTransparent</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
skips lattice rectangle by making it transparent< / td >
2017-12-11 21:03:17 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_kFixedColor' >< code > SkCanvas::Lattice::kFixedColor</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
draws one of fColors into lattice rectangle< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< / table >
## <a name='Draw_Image_Lattice_Member'>Draw Image Lattice Member</a>
2017-07-28 19:18:29 +00:00
2018-03-20 19:53:27 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< / table >
### Members
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Type</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Name</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const int*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fXDivs' >< code > fXDivs</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-06-14 16:28:14 +00:00
Array of x-axis values that divide the bitmap vertically.
2017-08-03 21:14:08 +00:00
Array entries must be unique, increasing, greater than or equal to
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > left edge, and less than < a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > right edge.
Set the first element to < a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > left to collapse the left column of
2017-08-03 21:14:08 +00:00
fixed grid entries.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const int*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fYDivs' >< code > fYDivs</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-06-14 16:28:14 +00:00
Array of y-axis values that divide the bitmap horizontally.
2017-08-03 21:14:08 +00:00
Array entries must be unique, increasing, greater than or equal to
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > top edge, and less than < a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > bottom edge.
Set the first element to < a href = '#SkCanvas_Lattice_fBounds' > fBounds< / a > top to collapse the top row of fixed
2017-08-03 21:14:08 +00:00
grid entries.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const RectType*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fRectTypes' >< code > fRectTypes</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2017-12-11 21:03:17 +00:00
Optional array of fill types, one per rectangular grid entry:
2018-05-16 11:07:07 +00:00
array length must be( < a href = '#SkCanvas_Lattice_fXCount' > fXCount< / a > + 1) * (< a href = '#SkCanvas_Lattice_fYCount' > fYCount< / a > + 1)
2018-03-05 18:26:16 +00:00
.
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
Each < a href = '#SkCanvas_Lattice_RectType' > RectType< / a > is one of: < a href = '#SkCanvas_Lattice_kDefault' > kDefault< / a > , < a href = '#SkCanvas_Lattice_kTransparent' > kTransparent< / a > , < a href = '#SkCanvas_Lattice_kFixedColor' > kFixedColor< / a > .
2017-12-11 21:03:17 +00:00
2017-07-28 19:18:29 +00:00
Array entries correspond to the rectangular grid entries, ascending
left to right and then top to bottom.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > int</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fXCount' >< code > fXCount</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Number of entries in < a href = '#SkCanvas_Lattice_fXDivs' > fXDivs< / a > array; one less than the number of
2017-08-03 21:14:08 +00:00
horizontal divisions.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > int</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fYCount' >< code > fYCount</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Number of entries in < a href = '#SkCanvas_Lattice_fYDivs' > fYDivs< / a > array; one less than the number of vertical
2017-08-03 21:14:08 +00:00
divisions.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkIRect*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fBounds' >< code > fBounds</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Optional subset < a href = 'SkIRect_Reference#IRect' > IRect< / a > source to draw from.
If nullptr, source bounds is dimensions of < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > or < a href = 'SkImage_Reference#Image' > Image< / a > .
< / td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > const SkColor*</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkCanvas_Lattice_fColors' >< code > fColors</ code ></ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2017-12-11 21:03:17 +00:00
Optional array of colors, one per rectangular grid entry.
2018-05-16 11:07:07 +00:00
Array length must be( < a href = '#SkCanvas_Lattice_fXCount' > fXCount< / a > + 1) * (< a href = '#SkCanvas_Lattice_fYCount' > fYCount< / a > + 1)
2018-03-05 18:26:16 +00:00
.
2017-12-11 21:03:17 +00:00
Array entries correspond to the rectangular grid entries, ascending
left to right, then top to bottom.
2018-05-16 11:07:07 +00:00
< / td >
< / tr >
< / table >
2017-12-11 21:03:17 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawBitmapLattice' > < / a >
2017-07-28 19:18:29 +00:00
## drawBitmapLattice
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > (const < a href = 'SkBitmap_Reference#SkBitmap' > SkBitmap< / a > & bitmap, const < a href = '#SkCanvas_Lattice' > Lattice< / a > & lattice, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > stretched proportionally to fit into < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawBitmapLattice_dst' > dst< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_Lattice' > Lattice< / a > < a href = '#SkCanvas_drawBitmapLattice_lattice' > lattice< / a > divides < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > into a rectangular grid.
2017-07-28 19:18:29 +00:00
Each intersection of an even-numbered row and column is fixed; like the corners
2018-05-16 11:07:07 +00:00
of < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > , fixed < a href = '#SkCanvas_drawBitmapLattice_lattice' > lattice< / a > elements never scale larger than their initial
size and shrink proportionately when all fixed elements exceed the < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a >
2018-01-26 17:56:22 +00:00
dimension. All other grid elements scale to fill the available space, if any.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > .
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If bitmap is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from bitmap bounds. If < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a >
< a href = 'undocumented#Filter_Quality' > Filter Quality< / a > set to < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , disable pixel filtering. For all
other values of < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > , use < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > to filter pixels.
2018-05-30 13:21:49 +00:00
Any < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > on < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > is ignored as is < a href = '#SkCanvas_drawBitmapLattice_paint' > paint< / a > < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliasing< / a > state.
2018-05-16 11:07:07 +00:00
If generated mask extends beyond < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > bounds, replicate < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > edge colors,
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawBitmapLattice_bitmap' > < code > < strong > bitmap< / strong > < / code > < / a > < / td >
< td > < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapLattice_lattice' > < code > < strong > lattice< / strong > < / code > < / a > < / td >
< td > division of < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > into fixed and variable rectangles< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapLattice_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of image to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawBitmapLattice_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "c5bfa944e17ba4a4400dc799f032069c" > < div > The two leftmost < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > draws has four corners and sides to the left and right of center.
2018-05-16 11:07:07 +00:00
The leftmost < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > draw scales the width of corners proportionately to fit.
2018-01-04 21:11:51 +00:00
The third and fourth draw corners are not scaled; the sides are scaled to
2017-07-28 19:18:29 +00:00
fill the remaining space; the center is transparent.
2018-05-16 11:07:07 +00:00
The rightmost < a href = '#SkCanvas_drawBitmapLattice_bitmap' > bitmap< / a > draw has four corners scaled vertically to fit, and uses sides above
2018-03-05 18:26:16 +00:00
and below center to fill the remaining space.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > < a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > < a href = '#SkCanvas_Lattice' > Lattice< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawImageLattice' > < / a >
2017-07-28 19:18:29 +00:00
## drawImageLattice
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawImageLattice' > drawImageLattice< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * image, const < a href = '#SkCanvas_Lattice' > Lattice< / a > & lattice, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & dst,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkImage_Reference#Image' > Image< / a > < a href = '#SkCanvas_drawImageLattice_image' > image< / a > stretched proportionally to fit into < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawImageLattice_dst' > dst< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_Lattice' > Lattice< / a > < a href = '#SkCanvas_drawImageLattice_lattice' > lattice< / a > divides < a href = '#SkCanvas_drawImageLattice_image' > image< / a > into a rectangular grid.
2017-07-28 19:18:29 +00:00
Each intersection of an even-numbered row and column is fixed; like the corners
2018-05-16 11:07:07 +00:00
of < a href = '#SkCanvas_drawBitmapNine' > drawBitmapNine< / a > , fixed < a href = '#SkCanvas_drawImageLattice_lattice' > lattice< / a > elements never scale larger than their initial
2017-10-04 18:31:33 +00:00
size and shrink proportionately when all fixed elements exceed the bitmap
2018-01-26 17:56:22 +00:00
dimension. All other grid elements scale to fill the available space, if any.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Additionally transform draw using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > .
If < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > is supplied, apply < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > . If image is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , apply < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > contains < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , generate mask from image bounds. If < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a >
< a href = 'undocumented#Filter_Quality' > Filter Quality< / a > set to < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , disable pixel filtering. For all
other values of < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > < a href = 'undocumented#Filter_Quality' > Filter Quality< / a > , use < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > to filter pixels.
2018-05-30 13:21:49 +00:00
Any < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > on < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > is ignored as is < a href = '#SkCanvas_drawImageLattice_paint' > paint< / a > < a href = 'SkPaint_Reference#Anti_Alias' > Anti Aliasing< / a > state.
2017-08-03 21:14:08 +00:00
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
2018-05-16 11:07:07 +00:00
just as < a href = 'undocumented#Shader' > Shader< / a > made from < a href = 'undocumented#SkShader_MakeBitmapShader' > SkShader::MakeBitmapShader< / a > with
< a href = 'undocumented#SkShader_kClamp_TileMode' > SkShader::kClamp TileMode< / a > set replicates the bitmap edge color when it samples
2017-08-03 21:14:08 +00:00
outside of its bounds.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawImageLattice_image' > < code > < strong > image< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing pixels, dimensions, and format< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageLattice_lattice' > < code > < strong > lattice< / strong > < / code > < / a > < / td >
< td > division of bitmap into fixed and variable rectangles< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageLattice_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > destination < a href = 'SkRect_Reference#Rect' > Rect< / a > of < a href = '#SkCanvas_drawImageLattice_image' > image< / a > to draw to< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawImageLattice_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > containing < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > ,
2017-08-03 21:14:08 +00:00
and so on; or nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-07 05:34:31 +00:00
< div > < fiddle-embed name = "4f153cf1d0dbe1a95acf5badeec14dae" > < div > The leftmost < a href = '#SkCanvas_drawImageLattice_image' > image< / a > is smaller than center; only corners are drawn, all scaled to fit.
2018-05-16 11:07:07 +00:00
The second < a href = '#SkCanvas_drawImageLattice_image' > image< / a > equals the size of center; only corners are drawn without scaling.
2017-09-01 19:51:02 +00:00
The remaining images are larger than center. All corners draw without scaling. The sides
2018-03-05 18:26:16 +00:00
are scaled if needed to take up the remaining space; the center is transparent.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmapLattice' > drawBitmapLattice< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawImageNine' > drawImageNine< / a > < sup > < a href = '#SkCanvas_drawImageNine_2' > [2]< / a > < / sup > < a href = '#SkCanvas_Lattice' > Lattice< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Draw_Text'>Draw Text</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPosText' > drawPosText</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at array of (x, y) positions</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawPosTextH' > drawPosTextH</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at x positions with common baseline</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawString' > drawString</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws null terminated string at (x, y) using font advance</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawString' > drawString(const char* string, SkScalar x, SkScalar y, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawString_2' > drawString(const SkString& string, SkScalar x, SkScalar y, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawText' > drawText</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text at (x, y), using font advance</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextBlob' > drawTextBlob</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text with arrays of positions and < a href = 'SkPaint_Reference#Paint' > Paint</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextBlob' > drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint)</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextBlob_2' > drawTextBlob(const sk sp< SkTextBlob> & blob, SkScalar x, SkScalar y, const SkPaint& paint)</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text following < a href = 'SkPath_Reference#Path' > Path</ a > contour</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextOnPathHV' > drawTextOnPathHV</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text following < a href = 'SkPath_Reference#Path' > Path</ a > with offsets</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > draws text with array of < a href = 'undocumented#RSXform' > RSXform</ a ></ td >
< / tr >
< / table >
2018-02-07 12:27:09 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawText' > < / a >
2017-07-28 19:18:29 +00:00
## drawText
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawText' > drawText< / a > (const void* text, size_t byteLength, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = '#SkCanvas_drawText_text' > text< / a > , with origin at (< a href = '#SkCanvas_drawText_x' > x< / a > , < a href = '#SkCanvas_drawText_y' > y< / a > ), using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawText_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText_text' > text< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, < a href = '#SkCanvas_drawText_text' > text< / a > is encoded as
2017-11-27 15:44:06 +00:00
UTF-8.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText_x' > x< / a > and < a href = '#SkCanvas_drawText_y' > y< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > and < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by default
< a href = '#SkCanvas_drawText_text' > text< / a > draws left to right, positioning the first glyph left side bearing at < a href = '#SkCanvas_drawText_x' > x< / a >
and its baseline at < a href = '#SkCanvas_drawText_y' > y< / a > . < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawText_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawText_text' > text< / a > . By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawText_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawText_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawText_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawText_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawText_text' > text< / a > on < a href = '#SkCanvas_drawText_x' > x< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawText_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawText_text' > text< / a > on < a href = '#SkCanvas_drawText_y' > y< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawText_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawText_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "55f5e59350622c5e2834d1c85789f732" > < div > The same < a href = '#SkCanvas_drawText_text' > text< / a > is drawn varying < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > and varying
< a href = '#Matrix' > Matrix< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawString' > drawString< / a > < sup > < a href = '#SkCanvas_drawString_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawString' > < / a >
2017-07-28 19:18:29 +00:00
## drawString
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawString' > drawString< / a > (const char* string, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Draws null terminated < a href = '#SkCanvas_drawString_string' > string< / a > , with origin at (< a href = '#SkCanvas_drawString_x' > x< / a > , < a href = '#SkCanvas_drawString_y' > y< / a > ), using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and
< a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawString_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawString_string' > string< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, strings are encoded
as UTF-8. Other values of < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > are unlikely to produce the desired
results, since zero bytes may be embedded in the < a href = '#SkCanvas_drawString_string' > string< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawString_x' > x< / a > and < a href = '#SkCanvas_drawString_y' > y< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > and < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by default
< a href = '#SkCanvas_drawString_string' > string< / a > draws left to right, positioning the first glyph left side bearing at < a href = '#SkCanvas_drawString_x' > x< / a >
and its baseline at < a href = '#SkCanvas_drawString_y' > y< / a > . < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawString_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to text. By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawString_string' > < code > < strong > string< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn,
2017-08-03 21:14:08 +00:00
ending with a char value of zero< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawString_string' > string< / a > on < a href = '#SkCanvas_drawString_x' > x< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawString_string' > string< / a > on < a href = '#SkCanvas_drawString_y' > y< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > text size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-17 16:17:28 +00:00
< div > < fiddle-embed name = "85442cf8d0bce6b5a777853bc36a4dc4" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawString_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawString' > drawString< / a > (const < a href = 'undocumented#SkString' > SkString< / a > & string, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws null terminated < a href = '#SkCanvas_drawString_2_string' > string< / a > , with origin at (< a href = '#SkCanvas_drawString_2_x' > x< / a > , < a href = '#SkCanvas_drawString_2_y' > y< / a > ), using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawString_2_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawString_2_string' > string< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, strings are encoded
as UTF-8. Other values of < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > are unlikely to produce the desired
results, since zero bytes may be embedded in the < a href = '#SkCanvas_drawString_2_string' > string< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawString_2_x' > x< / a > and < a href = '#SkCanvas_drawString_2_y' > y< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > and < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by default
< a href = '#SkCanvas_drawString_2_string' > string< / a > draws left to right, positioning the first glyph left side bearing at < a href = '#SkCanvas_drawString_2_x' > x< / a >
and its baseline at < a href = '#SkCanvas_drawString_2_y' > y< / a > . < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawString_2_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to text. By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawString_2_string' > < code > < strong > string< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn,
2017-08-03 21:14:08 +00:00
ending with a char value of zero< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawString_2_string' > string< / a > on < a href = '#SkCanvas_drawString_2_x' > x< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > start of < a href = '#SkCanvas_drawString_2_string' > string< / a > on < a href = '#SkCanvas_drawString_2_y' > y< / a > -axis< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawString_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > text size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "435178c09feb3bfec5e35d983609a013" > < / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPosText' > < / a >
2017-07-28 19:18:29 +00:00
## drawPosText
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPosText' > drawPosText< / a > (const void* text, size_t byteLength, const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > pos[], const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws each glyph in < a href = '#SkCanvas_drawPosText_text' > text< / a > with the origin in < a href = '#SkCanvas_drawPosText_pos' > pos< / a > array, using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPosText_paint' > paint< / a > . The number of entries in < a href = '#SkCanvas_drawPosText_pos' > pos< / a > array must match the number of < a href = 'undocumented#Glyph' > Glyphs< / a >
described by < a href = '#SkCanvas_drawPosText_byteLength' > byteLength< / a > of < a href = '#SkCanvas_drawPosText_text' > text< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPosText_text' > text< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, < a href = '#SkCanvas_drawPosText_text' > text< / a > is encoded as
2018-06-14 16:28:14 +00:00
UTF-8. < a href = '#SkCanvas_drawPosText_pos' > pos< / a > elements meaning depends on < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by default
glyph left side bearing and baseline are relative to < a href = 'SkPoint_Reference#Point' > Point< / a > in < a href = '#SkCanvas_drawPosText_pos' > pos< / a > array.
< a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawPosText_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawPosText_text' > text< / a > . By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
2018-01-04 21:11:51 +00:00
Layout engines such as Harfbuzz typically position each glyph
2017-10-04 18:31:33 +00:00
rather than using the font advance widths.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPosText_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosText_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawPosText_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosText_pos' > < code > < strong > pos< / strong > < / code > < / a > < / td >
< td > array of glyph origins< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosText_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawPosText_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "bf0b2402533a23b6392e0676b7a8414c" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPosTextH' > < / a >
2017-07-28 19:18:29 +00:00
## drawPosTextH
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > (const void* text, size_t byteLength, const < a href = 'undocumented#SkScalar' > SkScalar< / a > xpos[], < a href = 'undocumented#SkScalar' > SkScalar< / a > constY,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws each glyph in < a href = '#SkCanvas_drawPosTextH_text' > text< / a > with its (x, y) origin composed from < a href = '#SkCanvas_drawPosTextH_xpos' > xpos< / a > array and
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPosTextH_constY' > constY< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPosTextH_paint' > paint< / a > . The number of entries in < a href = '#SkCanvas_drawPosTextH_xpos' > xpos< / a > array
must match the number of < a href = 'undocumented#Glyph' > Glyphs< / a > described by < a href = '#SkCanvas_drawPosTextH_byteLength' > byteLength< / a > of < a href = '#SkCanvas_drawPosTextH_text' > text< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPosTextH_text' > text< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, < a href = '#SkCanvas_drawPosTextH_text' > text< / a > is encoded as
2018-05-30 13:21:49 +00:00
UTF-8. < a href = '#SkCanvas_drawPosTextH_xpos' > xpos< / a > elements meaning depends on < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ;
2018-05-16 11:07:07 +00:00
by default each glyph left side bearing is positioned at an < a href = '#SkCanvas_drawPosTextH_xpos' > xpos< / a > element and
its baseline is positioned at < a href = '#SkCanvas_drawPosTextH_constY' > constY< / a > . < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and
< a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawPosTextH_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawPosTextH_text' > text< / a > . By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-08-03 21:14:08 +00:00
2018-01-04 21:11:51 +00:00
Layout engines such as Harfbuzz typically position each glyph
2018-05-16 11:07:07 +00:00
rather than using the font advance widths if all < a href = 'undocumented#Glyph' > Glyphs< / a > share the same
2017-08-03 21:14:08 +00:00
baseline.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPosTextH_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosTextH_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawPosTextH_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosTextH_xpos' > < code > < strong > xpos< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > array of x-axis positions, used to position each glyph< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosTextH_constY' > < code > < strong > constY< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > shared y-axis value for all of x-axis positions< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPosTextH_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawPosTextH_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "95c6a7ef82993a8d2add676080e9438a" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawTextOnPathHV' > < / a >
2017-07-28 19:18:29 +00:00
## drawTextOnPathHV
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawTextOnPathHV' > drawTextOnPathHV< / a > (const void* text, size_t byteLength, const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, < a href = 'undocumented#SkScalar' > SkScalar< / a > hOffset,
< a href = 'undocumented#SkScalar' > SkScalar< / a > vOffset, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > on < a href = 'SkPath_Reference#Path' > Path< / a > < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawTextOnPathHV_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Origin of < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > is at distance < a href = '#SkCanvas_drawTextOnPathHV_hOffset' > hOffset< / a > along the < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > , offset by a perpendicular
vector of length < a href = '#SkCanvas_drawTextOnPathHV_vOffset' > vOffset< / a > . If the < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > section corresponding the glyph advance is
2017-08-03 21:14:08 +00:00
curved, the glyph is drawn curved to match; control points in the glyph are
2018-05-16 11:07:07 +00:00
mapped to projected points parallel to the < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > . If the < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > advance is larger
than the < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > length, the excess < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > is clipped.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > is encoded as
UTF-8. Origin meaning depends on < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > and < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by
2018-06-14 16:28:14 +00:00
default < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > positions the first glyph left side bearing and baseline relative
to origin. < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#Matrix' > Matrix< / a > and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawTextOnPathHV_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > . By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > providing < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > baseline< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_hOffset' > < code > < strong > hOffset< / strong > < / code > < / a > < / td >
< td > distance along < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > to offset origin< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_vOffset' > < code > < strong > vOffset< / strong > < / code > < / a > < / td >
< td > offset of < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > above (if negative) or below (if positive) the < a href = '#SkCanvas_drawTextOnPathHV_path' > path< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPathHV_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawTextOnPathHV_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "b2f22d1d5041e55d6913aab52f73a7d3" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawTextOnPath' > < / a >
2017-07-28 19:18:29 +00:00
## drawTextOnPath
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > (const void* text, size_t byteLength, const < a href = 'SkPath_Reference#SkPath' > SkPath< / a > & path, const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > * matrix,
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > on < a href = 'SkPath_Reference#Path' > Path< / a > < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawTextOnPath_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
Origin of < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > is at beginning of < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > offset by < a href = '#SkCanvas_drawTextOnPath_matrix' > matrix< / a > , if not nullptr.
2018-05-30 13:21:49 +00:00
< a href = '#SkCanvas_drawTextOnPath_matrix' > matrix< / a > transforms < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > before < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > is mapped to < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > . If the < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > section
2018-05-16 11:07:07 +00:00
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > .
If the < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > advance is larger than the < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > length, the excess < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > is clipped.
2017-08-03 21:14:08 +00:00
2018-05-30 13:21:49 +00:00
< a href = '#SkCanvas_drawTextOnPath_matrix' > matrix< / a > does not effect < a href = '#SkCanvas_drawTextOnPath_paint' > paint< / a > < a href = 'undocumented#Shader' > Shader< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawTextOnPath_text' > text< / a > meaning depends on < a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > ; by default, < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > is encoded as
UTF-8. Origin meaning depends on < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > and < a href = 'SkPaint_Reference#Vertical_Text' > Paint Vertical Text< / a > ; by
2018-06-14 16:28:14 +00:00
default < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > positions the first glyph left side bearing and baseline relative
to origin. < a href = 'undocumented#Text' > Text< / a > size is affected by < a href = '#SkCanvas_drawTextOnPath_matrix' > matrix< / a > parameter, < a href = '#Canvas' > Canvas< / a > < a href = '#Matrix' > Matrix< / a > ,
2018-05-16 11:07:07 +00:00
and < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawTextOnPath_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > . By default, draws
2018-05-30 13:21:49 +00:00
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawTextOnPath_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPath_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPath_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Path' > Path< / a > providing < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > baseline< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPath_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > transform of < a href = 'undocumented#Glyph' > Glyphs< / a > before mapping to < a href = '#SkCanvas_drawTextOnPath_path' > path< / a > ; may be nullptr
to use identity < a href = '#Matrix' > Matrix< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextOnPath_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawTextOnPath_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "236e680b27960ca22641586dba0599c9" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawTextOnPathHV' > drawTextOnPathHV< / a > < a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawTextRSXform' > < / a >
2017-07-28 19:18:29 +00:00
## drawTextRSXform
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawTextRSXform' > drawTextRSXform< / a > (const void* text, size_t byteLength, const < a href = 'undocumented#SkRSXform' > SkRSXform< / a > xform[],
const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * cullRect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > , transforming each glyph by the corresponding < a href = 'undocumented#SkRSXform' > SkRSXform< / a > ,
2018-05-16 11:07:07 +00:00
using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawTextRSXform_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-05-30 13:21:49 +00:00
< a href = 'undocumented#RSXform' > RSXform< / a > < a href = '#SkCanvas_drawTextRSXform_xform' > xform< / a > array specifies a separate square scale, rotation, and translation
for each glyph. < a href = '#SkCanvas_drawTextRSXform_xform' > xform< / a > does not affect < a href = '#SkCanvas_drawTextRSXform_paint' > paint< / a > < a href = 'undocumented#Shader' > Shader< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
Optional < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawTextRSXform_cullRect' > cullRect< / a > is a conservative bounds of < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > , taking into account
< a href = 'undocumented#RSXform' > RSXform< / a > and < a href = '#SkCanvas_drawTextRSXform_paint' > paint< / a > . If < a href = '#SkCanvas_drawTextRSXform_cullRect' > cullRect< / a > is outside of < a href = '#Clip' > Clip< / a > , canvas can skip drawing.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
All elements of < a href = '#SkCanvas_drawTextRSXform_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > . By default, draws
filled 12 point black < a href = 'undocumented#Glyph' > Glyphs< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawTextRSXform_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
< td > character code points or < a href = 'undocumented#Glyph' > Glyphs< / a > drawn< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextRSXform_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > byte length of < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > array< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextRSXform_xform' > < code > < strong > xform< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#RSXform' > RSXform< / a > rotates, scales, and translates each glyph individually< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextRSXform_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > bounds of < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > for efficient clipping; or nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextRSXform_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = '#SkCanvas_drawTextRSXform_text' > text< / a > size, blend, color, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "3ce367af833428b08e75d8a22fe67808" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawTextOnPath' > drawTextOnPath< / a > < a href = '#SkCanvas_drawTextOnPathHV' > drawTextOnPathHV< / a > < a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > < sup > < a href = '#SkCanvas_drawTextBlob_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawTextBlob' > < / a >
2017-07-28 19:18:29 +00:00
## drawTextBlob
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
void < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > (const < a href = 'SkTextBlob_Reference#SkTextBlob' > SkTextBlob< / a > * blob, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-08-10 17:09:13 +00:00
Draws < a href = 'SkTextBlob_Reference#Text_Blob' > Text Blob< / a > < a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > at (< a href = '#SkCanvas_drawTextBlob_x' > x< / a > , < a href = '#SkCanvas_drawTextBlob_y' > y< / a > ), using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawTextBlob_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > contains < a href = 'undocumented#Glyph' > Glyphs< / a > , their positions, and < a href = '#SkCanvas_drawTextBlob_paint' > paint< / a > attributes specific to text: < a href = 'undocumented#Typeface' > Typeface< / a > , < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > , < a href = 'SkPaint_Reference#Text_Scale_X' > Paint Text Scale X< / a > ,
< a href = 'SkPaint_Reference#Text_Skew_X' > Paint Text Skew X< / a > , < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > , < a href = 'SkPaint_Reference#Hinting' > Paint Hinting< / a > , < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkPaint_Reference#Fake_Bold' > Paint Fake Bold< / a > ,
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Font_Embedded_Bitmaps' > Font Embedded Bitmaps< / a > , < a href = 'SkPaint_Reference#Full_Hinting_Spacing' > Full Hinting Spacing< / a > , < a href = 'SkPaint_Reference#LCD_Text' > LCD Text< / a > , < a href = 'SkPaint_Reference#Linear_Text' > Linear Text< / a > ,
2018-08-10 17:09:13 +00:00
and < a href = 'SkPaint_Reference#Subpixel_Text' > Subpixel Text< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > must be set to < a href = 'SkPaint_Reference#SkPaint_kGlyphID_TextEncoding' > SkPaint::kGlyphID TextEncoding< / a > .
2017-12-01 16:49:58 +00:00
2018-08-10 17:09:13 +00:00
Elements of < a href = '#SkCanvas_drawTextBlob_paint' > paint< / a > : < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , < a href = 'SkColor_Reference#Color' > Color< / a > including < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > ,
< a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkPaint_Reference#Dither' > Paint Dither< / a > , < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Shader' > Shader< / a > , and
< a href = 'SkPaint_Reference#Style' > Paint Style< / a > ; apply to < a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > . If < a href = 'SkPaint_Reference#Paint' > Paint< / a > contains < a href = 'SkPaint_Reference#SkPaint_kStroke_Style' > SkPaint::kStroke Style< / a > :
< a href = 'SkPaint_Reference#Miter_Limit' > Paint Miter Limit< / a > , < a href = 'SkPaint_Reference#Stroke_Cap' > Paint Stroke Cap< / a > , < a href = 'SkPaint_Reference#Stroke_Join' > Paint Stroke Join< / a > , and < a href = 'SkPaint_Reference#Stroke_Width' > Paint Stroke Width< / a > ;
apply to < a href = 'SkPath_Reference#Path' > Path< / a > created from < a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawTextBlob_blob' > < code > < strong > blob< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Glyph' > Glyphs< / a > , positions, and their paints' text size, typeface, and so on< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > horizontal offset applied to < a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > vertical offset applied to < a href = '#SkCanvas_drawTextBlob_blob' > blob< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > blend, color, stroking, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "5f823814ec9df1f912a2ea943bedfca1" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawTextBlob_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-10 17:09:13 +00:00
void < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkTextBlob_Reference#SkTextBlob' > SkTextBlob< / a > > & blob, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-08-10 17:09:13 +00:00
Draws < a href = 'SkTextBlob_Reference#Text_Blob' > Text Blob< / a > < a href = '#SkCanvas_drawTextBlob_2_blob' > blob< / a > at (< a href = '#SkCanvas_drawTextBlob_2_x' > x< / a > , < a href = '#SkCanvas_drawTextBlob_2_y' > y< / a > ), using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawTextBlob_2_paint' > paint< / a > .
2017-08-03 21:14:08 +00:00
2018-08-10 17:09:13 +00:00
< a href = '#SkCanvas_drawTextBlob_2_blob' > blob< / a > contains < a href = 'undocumented#Glyph' > Glyphs< / a > , their positions, and < a href = '#SkCanvas_drawTextBlob_2_paint' > paint< / a > attributes specific to text: < a href = 'undocumented#Typeface' > Typeface< / a > , < a href = 'SkPaint_Reference#Text_Size' > Paint Text Size< / a > , < a href = 'SkPaint_Reference#Text_Scale_X' > Paint Text Scale X< / a > ,
< a href = 'SkPaint_Reference#Text_Skew_X' > Paint Text Skew X< / a > , < a href = 'SkPaint_Reference#Text_Align' > Paint Text Align< / a > , < a href = 'SkPaint_Reference#Hinting' > Paint Hinting< / a > , < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkPaint_Reference#Fake_Bold' > Paint Fake Bold< / a > ,
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Font_Embedded_Bitmaps' > Font Embedded Bitmaps< / a > , < a href = 'SkPaint_Reference#Full_Hinting_Spacing' > Full Hinting Spacing< / a > , < a href = 'SkPaint_Reference#LCD_Text' > LCD Text< / a > , < a href = 'SkPaint_Reference#Linear_Text' > Linear Text< / a > ,
2018-08-10 17:09:13 +00:00
and < a href = 'SkPaint_Reference#Subpixel_Text' > Subpixel Text< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Text_Encoding' > Paint Text Encoding< / a > must be set to < a href = 'SkPaint_Reference#SkPaint_kGlyphID_TextEncoding' > SkPaint::kGlyphID TextEncoding< / a > .
2017-12-01 16:49:58 +00:00
2018-05-16 11:07:07 +00:00
Elements of < a href = '#SkCanvas_drawTextBlob_2_paint' > paint< / a > : < a href = 'undocumented#Path_Effect' > Path Effect< / a > , < a href = 'undocumented#Mask_Filter' > Mask Filter< / a > , < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > ,
< a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'undocumented#Draw_Looper' > Draw Looper< / a > ; apply to < a href = '#SkCanvas_drawTextBlob_2_blob' > blob< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawTextBlob_2_blob' > < code > < strong > blob< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Glyph' > Glyphs< / a > , positions, and their paints' text size, typeface, and so on< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > horizontal offset applied to < a href = '#SkCanvas_drawTextBlob_2_blob' > blob< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > vertical offset applied to < a href = '#SkCanvas_drawTextBlob_2_blob' > blob< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawTextBlob_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > blend, color, stroking, and so on, used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-08-10 17:09:13 +00:00
< div > < fiddle-embed name = "af4c69fbbd165c8b0eb0c9bd49ccbd8d" > < div > < a href = 'SkPaint_Reference#Paint' > Paint< / a > attributes unrelated to text, like color, have no effect on < a href = '#SkCanvas_drawTextBlob_2_paint' > paint< / a > in allocated < a href = 'SkTextBlob_Reference#Text_Blob' > Text Blob< / a > .
2018-05-16 11:07:07 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > attributes related to text, like text size, have no effect on < a href = '#SkCanvas_drawTextBlob_2_paint' > paint< / a > passed to < a href = '#SkCanvas_drawTextBlob' > drawTextBlob< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawText' > drawText< / a > < a href = '#SkCanvas_drawPosText' > drawPosText< / a > < a href = '#SkCanvas_drawPosTextH' > drawPosTextH< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPicture' > < / a >
2017-07-28 19:18:29 +00:00
## drawPicture
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawPicture' > drawPicture< / a > (const < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > * picture)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkPicture_Reference#Picture' > Picture< / a > < a href = '#SkCanvas_drawPicture_picture' > picture< / a > , using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > are unchanged by < a href = '#SkCanvas_drawPicture_picture' > picture< / a > contents, as if
< a href = '#SkCanvas_save' > save< / a > was called before and < a href = '#SkCanvas_restore' > restore< / a > was called after < a href = '#SkCanvas_drawPicture' > drawPicture< / a > .
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
< a href = 'SkPicture_Reference#Picture' > Picture< / a > records a series of draw commands for later playback.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPicture_picture' > < code > < strong > picture< / strong > < / code > < / a > < / td >
< td > recorded drawing commands to play< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "83918a23fcffd47f59a1ef662c85a24c" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > < sup > < a href = '#SkCanvas_drawDrawable_2' > [2]< / a > < / sup > < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'SkPicture_Reference#SkPicture_playback' > SkPicture::playback< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPicture_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawPicture' > drawPicture< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > > & picture)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkPicture_Reference#Picture' > Picture< / a > < a href = '#SkCanvas_drawPicture_2_picture' > picture< / a > , using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > are unchanged by < a href = '#SkCanvas_drawPicture_2_picture' > picture< / a > contents, as if
< a href = '#SkCanvas_save' > save< / a > was called before and < a href = '#SkCanvas_restore' > restore< / a > was called after < a href = '#SkCanvas_drawPicture' > drawPicture< / a > .
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
< a href = 'SkPicture_Reference#Picture' > Picture< / a > records a series of draw commands for later playback.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPicture_2_picture' > < code > < strong > picture< / strong > < / code > < / a > < / td >
< td > recorded drawing commands to play< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "83918a23fcffd47f59a1ef662c85a24c" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > < sup > < a href = '#SkCanvas_drawDrawable_2' > [2]< / a > < / sup > < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'SkPicture_Reference#SkPicture_playback' > SkPicture::playback< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPicture_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawPicture' > drawPicture< / a > (const < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > * picture, const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > * matrix, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkPicture_Reference#Picture' > Picture< / a > < a href = '#SkCanvas_drawPicture_3_picture' > picture< / a > , using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > ; transforming < a href = '#SkCanvas_drawPicture_3_picture' > picture< / a > with
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > < a href = '#SkCanvas_drawPicture_3_matrix' > matrix< / a > , if provided; and use < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPicture_3_paint' > paint< / a > < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , if provided.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPicture_3_matrix' > matrix< / a > transformation is equivalent to: < a href = '#SkCanvas_save' > save< / a > , < a href = '#SkCanvas_concat' > concat< / a > , < a href = '#SkCanvas_drawPicture' > drawPicture< / a > , < a href = '#SkCanvas_restore' > restore< / a > .
< a href = '#SkCanvas_drawPicture_3_paint' > paint< / a > use is equivalent to: < a href = '#SkCanvas_saveLayer' > saveLayer< / a > , < a href = '#SkCanvas_drawPicture' > drawPicture< / a > , < a href = '#SkCanvas_restore' > restore< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPicture_3_picture' > < code > < strong > picture< / strong > < / code > < / a > < / td >
< td > recorded drawing commands to play< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPicture_3_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > < a href = '#Matrix' > Matrix< / a > to rotate, scale, translate, and so on; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPicture_3_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > to apply transparency, filtering, and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "759e4e5bac680838added8f70884dcdc" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > < sup > < a href = '#SkCanvas_drawDrawable_2' > [2]< / a > < / sup > < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'SkPicture_Reference#SkPicture_playback' > SkPicture::playback< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPicture_4' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawPicture' > drawPicture< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > > & picture, const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > * matrix, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'SkPicture_Reference#Picture' > Picture< / a > < a href = '#SkCanvas_drawPicture_4_picture' > picture< / a > , using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > ; transforming < a href = '#SkCanvas_drawPicture_4_picture' > picture< / a > with
2018-05-16 11:07:07 +00:00
< a href = '#Matrix' > Matrix< / a > < a href = '#SkCanvas_drawPicture_4_matrix' > matrix< / a > , if provided; and use < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawPicture_4_paint' > paint< / a > < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , if provided.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPicture_4_matrix' > matrix< / a > transformation is equivalent to: < a href = '#SkCanvas_save' > save< / a > , < a href = '#SkCanvas_concat' > concat< / a > , < a href = '#SkCanvas_drawPicture' > drawPicture< / a > , < a href = '#SkCanvas_restore' > restore< / a > .
< a href = '#SkCanvas_drawPicture_4_paint' > paint< / a > use is equivalent to: < a href = '#SkCanvas_saveLayer' > saveLayer< / a > , < a href = '#SkCanvas_drawPicture' > drawPicture< / a > , < a href = '#SkCanvas_restore' > restore< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPicture_4_picture' > < code > < strong > picture< / strong > < / code > < / a > < / td >
< td > recorded drawing commands to play< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPicture_4_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > < a href = '#Matrix' > Matrix< / a > to rotate, scale, translate, and so on; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPicture_4_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPaint_Reference#Paint' > Paint< / a > to apply transparency, filtering, and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "c4ff59439dd2fc871925d4eeb0c84ca1" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > < sup > < a href = '#SkCanvas_drawDrawable_2' > [2]< / a > < / sup > < a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'SkPicture_Reference#SkPicture_playback' > SkPicture::playback< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawVertices' > < / a >
2017-07-28 19:18:29 +00:00
## drawVertices
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawVertices' > drawVertices< / a > (const < a href = 'undocumented#SkVertices' > SkVertices< / a > * vertices, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Vertices' > Vertices< / a > < a href = '#SkCanvas_drawVertices_vertices' > vertices< / a > , a triangle mesh, using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > .
2018-05-16 11:07:07 +00:00
If < a href = 'undocumented#Texs' > Vertices Texs< / a > and < a href = 'undocumented#Colors' > Vertices Colors< / a > are defined in < a href = '#SkCanvas_drawVertices_vertices' > vertices< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawVertices_paint' > paint< / a >
2018-06-27 15:00:21 +00:00
contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawVertices_mode' > mode< / a > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawVertices_vertices' > < code > < strong > vertices< / strong > < / code > < / a > < / td >
< td > triangle mesh to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
< td > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > , if both are present< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > specifies the < a href = 'undocumented#Shader' > Shader< / a > , used as < a href = 'undocumented#Vertices' > Vertices< / a > texture; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "f48b22eaad1bb7adcc3faaa321754af6" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPatch' > drawPatch< / a > < sup > < a href = '#SkCanvas_drawPatch_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawVertices_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-06-27 15:00:21 +00:00
void < a href = '#SkCanvas_drawVertices' > drawVertices< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'undocumented#SkVertices' > SkVertices< / a > > & vertices, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Vertices' > Vertices< / a > < a href = '#SkCanvas_drawVertices_2_vertices' > vertices< / a > , a triangle mesh, using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > .
2018-05-16 11:07:07 +00:00
If < a href = 'undocumented#Texs' > Vertices Texs< / a > and < a href = 'undocumented#Colors' > Vertices Colors< / a > are defined in < a href = '#SkCanvas_drawVertices_2_vertices' > vertices< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawVertices_2_paint' > paint< / a >
2018-06-27 15:00:21 +00:00
contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawVertices_2_mode' > mode< / a > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawVertices_2_vertices' > < code > < strong > vertices< / strong > < / code > < / a > < / td >
< td > triangle mesh to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_2_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
< td > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > , if both are present< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > specifies the < a href = 'undocumented#Shader' > Shader< / a > , used as < a href = 'undocumented#Vertices' > Vertices< / a > texture, may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-02 19:20:10 +00:00
< div > < fiddle-embed name = "e8bdae9bea3227758989028424fcac3d" > < / fiddle-embed > < / div >
### See Also
< a href = '#SkCanvas_drawPatch' > drawPatch< / a > < sup > < a href = '#SkCanvas_drawPatch_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
---
< a name = 'SkCanvas_drawVertices_3' > < / a >
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-15 14:44:19 +00:00
void < a href = '#SkCanvas_drawVertices' > drawVertices< / a > (const < a href = 'undocumented#SkVertices' > SkVertices< / a > * vertices, const < a href = 'undocumented#SkVertices_Bone' > SkVertices::Bone< / a > bones[], int boneCount,
< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2018-07-02 19:20:10 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Vertices' > Vertices< / a > < a href = '#SkCanvas_drawVertices_3_vertices' > vertices< / a > , a triangle mesh, using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > . Bone data is used to
2018-07-02 19:20:10 +00:00
deform < a href = '#SkCanvas_drawVertices_3_vertices' > vertices< / a > with bone weights.
If < a href = 'undocumented#Texs' > Vertices Texs< / a > and < a href = 'undocumented#Colors' > Vertices Colors< / a > are defined in < a href = '#SkCanvas_drawVertices_3_vertices' > vertices< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawVertices_3_paint' > paint< / a >
contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawVertices_3_mode' > mode< / a > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > .
The first element of < a href = '#SkCanvas_drawVertices_3_bones' > bones< / a > should be an object to world space transformation matrix that
will be applied before performing mesh deformations. If no such transformation is needed,
it should be the identity matrix.
2018-08-15 14:44:19 +00:00
< a href = '#SkCanvas_drawVertices_3_boneCount' > boneCount< / a > must be at most 80, and thus the size of < a href = '#SkCanvas_drawVertices_3_bones' > bones< / a > should be at most 80.
2018-07-02 19:20:10 +00:00
### Parameters
< table > < tr > < td > < a name = 'SkCanvas_drawVertices_3_vertices' > < code > < strong > vertices< / strong > < / code > < / a > < / td >
< td > triangle mesh to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_3_bones' > < code > < strong > bones< / strong > < / code > < / a > < / td >
< td > bone matrix data< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_3_boneCount' > < code > < strong > boneCount< / strong > < / code > < / a > < / td >
< td > number of bone matrices< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_3_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
< td > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > , if both are present< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_3_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > specifies the < a href = 'undocumented#Shader' > Shader< / a > , used as < a href = 'undocumented#Vertices' > Vertices< / a > texture, may be nullptr< / td >
< / tr >
< / table >
### See Also
< a href = '#SkCanvas_drawPatch' > drawPatch< / a > < sup > < a href = '#SkCanvas_drawPatch_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
---
< a name = 'SkCanvas_drawVertices_4' > < / a >
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-08-15 14:44:19 +00:00
void < a href = '#SkCanvas_drawVertices' > drawVertices< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'undocumented#SkVertices' > SkVertices< / a > > & vertices, const < a href = 'undocumented#SkVertices_Bone' > SkVertices::Bone< / a > bones[], int boneCount,
2018-07-02 19:20:10 +00:00
< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Vertices' > Vertices< / a > < a href = '#SkCanvas_drawVertices_4_vertices' > vertices< / a > , a triangle mesh, using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > . Bone data is used to
2018-07-02 19:20:10 +00:00
deform < a href = '#SkCanvas_drawVertices_4_vertices' > vertices< / a > with bone weights.
If < a href = 'undocumented#Texs' > Vertices Texs< / a > and < a href = 'undocumented#Colors' > Vertices Colors< / a > are defined in < a href = '#SkCanvas_drawVertices_4_vertices' > vertices< / a > , and < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawVertices_4_paint' > paint< / a >
contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawVertices_4_mode' > mode< / a > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > .
The first element of < a href = '#SkCanvas_drawVertices_4_bones' > bones< / a > should be an object to world space transformation matrix that
will be applied before performing mesh deformations. If no such transformation is needed,
it should be the identity matrix.
2018-08-15 14:44:19 +00:00
< a href = '#SkCanvas_drawVertices_4_boneCount' > boneCount< / a > must be at most 80, and thus the size of < a href = '#SkCanvas_drawVertices_4_bones' > bones< / a > should be at most 80.
2018-07-02 19:20:10 +00:00
### Parameters
< table > < tr > < td > < a name = 'SkCanvas_drawVertices_4_vertices' > < code > < strong > vertices< / strong > < / code > < / a > < / td >
< td > triangle mesh to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_4_bones' > < code > < strong > bones< / strong > < / code > < / a > < / td >
< td > bone matrix data< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_4_boneCount' > < code > < strong > boneCount< / strong > < / code > < / a > < / td >
< td > number of bone matrices< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_4_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
< td > combines < a href = 'undocumented#Colors' > Vertices Colors< / a > with < a href = 'undocumented#Shader' > Shader< / a > , if both are present< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawVertices_4_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > specifies the < a href = 'undocumented#Shader' > Shader< / a > , used as < a href = 'undocumented#Vertices' > Vertices< / a > texture, may be nullptr< / td >
< / tr >
< / table >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawPatch' > drawPatch< / a > < sup > < a href = '#SkCanvas_drawPatch_2' > [2]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPatch' > < / a >
2017-07-28 19:18:29 +00:00
## drawPatch
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPatch' > drawPatch< / a > (const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > cubics[12], const < a href = 'SkColor_Reference#SkColor' > SkColor< / a > colors[4], const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > texCoords[4],
2018-06-27 15:00:21 +00:00
< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-06-14 16:28:14 +00:00
Draws a < a href = 'undocumented#Coons_Patch' > Coons Patch< / a > : the interpolation of four < a href = '#SkCanvas_drawPatch_cubics' > cubics< / a > with shared corners,
associating a color, and optionally a texture < a href = 'SkPoint_Reference#Point' > Point< / a > , with each corner.
2017-07-28 19:18:29 +00:00
2018-06-14 16:28:14 +00:00
< a href = 'undocumented#Coons_Patch' > Coons Patch< / a > uses < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > , < a href = '#SkCanvas_drawPatch_paint' > paint< / a > < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > . If < a href = 'undocumented#Shader' > Shader< / a > is provided it is treated
as < a href = 'undocumented#Coons_Patch' > Coons Patch< / a > texture; < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawPatch_mode' > mode< / a > combines < a href = 'SkColor_Reference#Color' > Color< / a > < a href = '#SkCanvas_drawPatch_colors' > colors< / a > and < a href = 'undocumented#Shader' > Shader< / a > if
2017-08-03 21:14:08 +00:00
both are provided.
2018-05-16 11:07:07 +00:00
< a href = 'SkPoint_Reference#Point' > Point< / a > array < a href = '#SkCanvas_drawPatch_cubics' > cubics< / a > specifies four < a href = 'SkPath_Reference#Cubic' > Cubics< / a > starting at the top-left corner,
in clockwise order, sharing every fourth point. The last < a href = 'SkPath_Reference#Cubic' > Cubic< / a > ends at the
2017-08-03 21:14:08 +00:00
first point.
2018-05-16 11:07:07 +00:00
< a href = 'SkColor_Reference#Color' > Color< / a > array color associates < a href = '#SkCanvas_drawPatch_colors' > colors< / a > with corners in top-left, top-right,
2017-10-04 18:31:33 +00:00
bottom-right, bottom-left order.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawPatch_paint' > paint< / a > contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkPoint_Reference#Point' > Point< / a > array < a href = '#SkCanvas_drawPatch_texCoords' > texCoords< / a > maps < a href = 'undocumented#Shader' > Shader< / a > as texture to
2017-10-04 18:31:33 +00:00
corners in top-left, top-right, bottom-right, bottom-left order.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPatch_cubics' > < code > < strong > cubics< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Cubic' > Path Cubic< / a > array, sharing common points< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPatch_colors' > < code > < strong > colors< / strong > < / code > < / a > < / td >
< td > < a href = 'SkColor_Reference#Color' > Color< / a > array, one for each corner< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPatch_texCoords' > < code > < strong > texCoords< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPoint_Reference#Point' > Point< / a > array of texture coordinates, mapping < a href = 'undocumented#Shader' > Shader< / a > to corners;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
< / tr >
2018-05-16 11:07:07 +00:00
# <tr> <td><a name='SkCanvas_drawPatch_mode'><code><strong>mode</strong></code></a></td>
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > for < a href = '#SkCanvas_drawPatch_colors' > colors< / a > , and for < a href = 'undocumented#Shader' > Shader< / a > if < a href = '#SkCanvas_drawPatch_paint' > paint< / a > has one< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPatch_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "accb545d67984ced168f5be6ab824795" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-07-02 19:20:10 +00:00
SeeAlso < a href = '#SkCanvas_drawVertices' > drawVertices< / a > < sup > < a href = '#SkCanvas_drawVertices_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawVertices_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawVertices_4' > [4]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawPatch_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawPatch' > drawPatch< / a > (const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > cubics[12], const < a href = 'SkColor_Reference#SkColor' > SkColor< / a > colors[4], const < a href = 'SkPoint_Reference#SkPoint' > SkPoint< / a > texCoords[4],
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-06-14 16:28:14 +00:00
Draws < a href = 'SkPath_Reference#Cubic' > Cubic< / a > < a href = 'undocumented#Coons_Patch' > Coons Patch< / a > : the interpolation of four < a href = '#SkCanvas_drawPatch_2_cubics' > cubics< / a > with shared corners,
associating a color, and optionally a texture < a href = 'SkPoint_Reference#Point' > Point< / a > , with each corner.
2017-08-03 21:14:08 +00:00
2018-06-14 16:28:14 +00:00
< a href = 'undocumented#Coons_Patch' > Coons Patch< / a > uses < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > , < a href = '#SkCanvas_drawPatch_2_paint' > paint< / a > < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > ,
2018-06-27 15:00:21 +00:00
< a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > . If < a href = 'undocumented#Shader' > Shader< / a > is provided it is treated
as < a href = 'undocumented#Coons_Patch' > Coons Patch< / a > texture; < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > mode combines < a href = 'SkColor_Reference#Color' > Color< / a > < a href = '#SkCanvas_drawPatch_2_colors' > colors< / a > and < a href = 'undocumented#Shader' > Shader< / a > if
2017-08-03 21:14:08 +00:00
both are provided.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'SkPoint_Reference#Point' > Point< / a > array < a href = '#SkCanvas_drawPatch_2_cubics' > cubics< / a > specifies four < a href = 'SkPath_Reference#Cubic' > Cubics< / a > starting at the top-left corner,
in clockwise order, sharing every fourth point. The last < a href = 'SkPath_Reference#Cubic' > Cubic< / a > ends at the
2017-08-03 21:14:08 +00:00
first point.
2018-05-16 11:07:07 +00:00
< a href = 'SkColor_Reference#Color' > Color< / a > array color associates < a href = '#SkCanvas_drawPatch_2_colors' > colors< / a > with corners in top-left, top-right,
2017-10-04 18:31:33 +00:00
bottom-right, bottom-left order.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#SkCanvas_drawPatch_2_paint' > paint< / a > contains < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'SkPoint_Reference#Point' > Point< / a > array < a href = '#SkCanvas_drawPatch_2_texCoords' > texCoords< / a > maps < a href = 'undocumented#Shader' > Shader< / a > as texture to
2017-10-04 18:31:33 +00:00
corners in top-left, top-right, bottom-right, bottom-left order.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawPatch_2_cubics' > < code > < strong > cubics< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPath_Reference#Cubic' > Path Cubic< / a > array, sharing common points< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPatch_2_colors' > < code > < strong > colors< / strong > < / code > < / a > < / td >
< td > < a href = 'SkColor_Reference#Color' > Color< / a > array, one for each corner< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawPatch_2_texCoords' > < code > < strong > texCoords< / strong > < / code > < / a > < / td >
< td > < a href = 'SkPoint_Reference#Point' > Point< / a > array of texture coordinates, mapping < a href = 'undocumented#Shader' > Shader< / a > to corners;
2017-08-03 21:14:08 +00:00
may be nullptr< / td >
< / tr >
2018-05-16 11:07:07 +00:00
# <tr> <td><a name='SkCanvas_drawPatch_2_paint'><code><strong>paint</strong></code></a></td>
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Shader' > Shader< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , used to draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "4cf70f8d194867d053d7e177e5088445" > < / fiddle-embed > < / div >
### Example
< div > < fiddle-embed name = "3412c2a16cb529af0e04878d264451f2" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-07-02 19:20:10 +00:00
SeeAlso < a href = '#SkCanvas_drawVertices' > drawVertices< / a > < sup > < a href = '#SkCanvas_drawVertices_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawVertices_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawVertices_4' > [4]< / a > < / sup > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAtlas' > < / a >
2017-07-28 19:18:29 +00:00
## drawAtlas
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAtlas' > drawAtlas< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * atlas, const < a href = 'undocumented#SkRSXform' > SkRSXform< / a > xform[], const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > tex[],
2018-06-27 15:00:21 +00:00
const < a href = 'SkColor_Reference#SkColor' > SkColor< / a > colors[], int count, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * cullRect,
2018-05-16 11:07:07 +00:00
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws a set of sprites from < a href = '#SkCanvas_drawAtlas_atlas' > atlas< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawAtlas_paint' > paint< / a > .
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawAtlas_paint' > paint< / a > uses < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a >
2018-05-16 11:07:07 +00:00
to draw, if present. For each entry in the array, < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawAtlas_tex' > tex< / a > locates sprite in
< a href = '#SkCanvas_drawAtlas_atlas' > atlas< / a > , and < a href = 'undocumented#RSXform' > RSXform< / a > < a href = '#SkCanvas_drawAtlas_xform' > xform< / a > transforms it into destination space.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawAtlas_xform' > xform< / a > , text, and < a href = '#SkCanvas_drawAtlas_colors' > colors< / a > if present, must contain < a href = '#SkCanvas_drawAtlas_count' > count< / a > entries.
2018-06-27 15:00:21 +00:00
Optional < a href = '#SkCanvas_drawAtlas_colors' > colors< / a > are applied for each sprite using < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > < a href = '#SkCanvas_drawAtlas_mode' > mode< / a > , treating
sprite as source and < a href = '#SkCanvas_drawAtlas_colors' > colors< / a > as destination.
2018-05-16 11:07:07 +00:00
Optional < a href = '#SkCanvas_drawAtlas_cullRect' > cullRect< / a > is a conservative bounds of all transformed sprites.
If < a href = '#SkCanvas_drawAtlas_cullRect' > cullRect< / a > is outside of < a href = '#Clip' > Clip< / a > , canvas can skip drawing.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAtlas_atlas' > < code > < strong > atlas< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing sprites< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_xform' > < code > < strong > xform< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#RSXform' > RSXform< / a > mappings for sprites in < a href = '#SkCanvas_drawAtlas_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_tex' > < code > < strong > tex< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > locations of sprites in < a href = '#SkCanvas_drawAtlas_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_colors' > < code > < strong > colors< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > one per sprite, blended with sprite using < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > ; may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
< td > number of sprites to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > combining < a href = '#SkCanvas_drawAtlas_colors' > colors< / a > and sprites< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
< td > bounds of transformed sprites for efficient clipping; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "1df575f9b8132306ce0552a2554ed132" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAtlas_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAtlas' > drawAtlas< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & atlas, const < a href = 'undocumented#SkRSXform' > SkRSXform< / a > xform[], const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > tex[],
2018-06-27 15:00:21 +00:00
const < a href = 'SkColor_Reference#SkColor' > SkColor< / a > colors[], int count, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode, const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * cullRect,
2018-05-16 11:07:07 +00:00
const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws a set of sprites from < a href = '#SkCanvas_drawAtlas_2_atlas' > atlas< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawAtlas_2_paint' > paint< / a > .
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawAtlas_2_paint' > paint< / a > uses < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a >
2018-05-16 11:07:07 +00:00
to draw, if present. For each entry in the array, < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawAtlas_2_tex' > tex< / a > locates sprite in
< a href = '#SkCanvas_drawAtlas_2_atlas' > atlas< / a > , and < a href = 'undocumented#RSXform' > RSXform< / a > < a href = '#SkCanvas_drawAtlas_2_xform' > xform< / a > transforms it into destination space.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawAtlas_2_xform' > xform< / a > , text, and < a href = '#SkCanvas_drawAtlas_2_colors' > colors< / a > if present, must contain < a href = '#SkCanvas_drawAtlas_2_count' > count< / a > entries.
2018-06-27 15:00:21 +00:00
Optional < a href = '#SkCanvas_drawAtlas_2_colors' > colors< / a > is applied for each sprite using < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > .
2018-05-16 11:07:07 +00:00
Optional < a href = '#SkCanvas_drawAtlas_2_cullRect' > cullRect< / a > is a conservative bounds of all transformed sprites.
If < a href = '#SkCanvas_drawAtlas_2_cullRect' > cullRect< / a > is outside of < a href = '#Clip' > Clip< / a > , canvas can skip drawing.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAtlas_2_atlas' > < code > < strong > atlas< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing sprites< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_xform' > < code > < strong > xform< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#RSXform' > RSXform< / a > mappings for sprites in < a href = '#SkCanvas_drawAtlas_2_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_tex' > < code > < strong > tex< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > locations of sprites in < a href = '#SkCanvas_drawAtlas_2_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_colors' > < code > < strong > colors< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > one per sprite, blended with sprite using < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > ; may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
< td > number of sprites to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > combining < a href = '#SkCanvas_drawAtlas_2_colors' > colors< / a > and sprites< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
< td > bounds of transformed sprites for efficient clipping; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_2_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "0e66a8f230a8d531bcef9f5ebdc5aac1" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAtlas_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAtlas' > drawAtlas< / a > (const < a href = 'SkImage_Reference#SkImage' > SkImage< / a > * atlas, const < a href = 'undocumented#SkRSXform' > SkRSXform< / a > xform[], const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > tex[], int count,
const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * cullRect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws a set of sprites from < a href = '#SkCanvas_drawAtlas_3_atlas' > atlas< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawAtlas_3_paint' > paint< / a > .
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawAtlas_3_paint' > paint< / a > uses < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a >
2018-05-16 11:07:07 +00:00
to draw, if present. For each entry in the array, < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawAtlas_3_tex' > tex< / a > locates sprite in
< a href = '#SkCanvas_drawAtlas_3_atlas' > atlas< / a > , and < a href = 'undocumented#RSXform' > RSXform< / a > < a href = '#SkCanvas_drawAtlas_3_xform' > xform< / a > transforms it into destination space.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawAtlas_3_xform' > xform< / a > and text must contain < a href = '#SkCanvas_drawAtlas_3_count' > count< / a > entries.
Optional < a href = '#SkCanvas_drawAtlas_3_cullRect' > cullRect< / a > is a conservative bounds of all transformed sprites.
If < a href = '#SkCanvas_drawAtlas_3_cullRect' > cullRect< / a > is outside of < a href = '#Clip' > Clip< / a > , canvas can skip drawing.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAtlas_3_atlas' > < code > < strong > atlas< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing sprites< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_3_xform' > < code > < strong > xform< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#RSXform' > RSXform< / a > mappings for sprites in < a href = '#SkCanvas_drawAtlas_3_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_3_tex' > < code > < strong > tex< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > locations of sprites in < a href = '#SkCanvas_drawAtlas_3_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_3_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
< td > number of sprites to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_3_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
< td > bounds of transformed sprites for efficient clipping; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_3_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "8dc0d0fdeab20bbc21cac6874ddbefcd" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAtlas_4' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAtlas' > drawAtlas< / a > (const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'SkImage_Reference#SkImage' > SkImage< / a > > & atlas, const < a href = 'undocumented#SkRSXform' > SkRSXform< / a > xform[], const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > tex[], int count,
const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > * cullRect, const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > * paint)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws a set of sprites from < a href = '#SkCanvas_drawAtlas_4_atlas' > atlas< / a > , using < a href = '#Clip' > Clip< / a > , < a href = '#Matrix' > Matrix< / a > , and optional < a href = 'SkPaint_Reference#Paint' > Paint< / a > < a href = '#SkCanvas_drawAtlas_4_paint' > paint< / a > .
2018-06-27 15:00:21 +00:00
< a href = '#SkCanvas_drawAtlas_4_paint' > paint< / a > uses < a href = 'SkPaint_Reference#Anti_Alias' > Anti Alias< / a > , < a href = 'SkColor_Reference#Alpha' > Color Alpha< / a > , < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , and < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a >
2018-05-16 11:07:07 +00:00
to draw, if present. For each entry in the array, < a href = 'SkRect_Reference#Rect' > Rect< / a > < a href = '#SkCanvas_drawAtlas_4_tex' > tex< / a > locates sprite in
< a href = '#SkCanvas_drawAtlas_4_atlas' > atlas< / a > , and < a href = 'undocumented#RSXform' > RSXform< / a > < a href = '#SkCanvas_drawAtlas_4_xform' > xform< / a > transforms it into destination space.
2017-08-03 21:14:08 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawAtlas_4_xform' > xform< / a > and text must contain < a href = '#SkCanvas_drawAtlas_4_count' > count< / a > entries.
Optional < a href = '#SkCanvas_drawAtlas_4_cullRect' > cullRect< / a > is a conservative bounds of all transformed sprites.
If < a href = '#SkCanvas_drawAtlas_4_cullRect' > cullRect< / a > is outside of < a href = '#Clip' > Clip< / a > , canvas can skip drawing.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAtlas_4_atlas' > < code > < strong > atlas< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImage_Reference#Image' > Image< / a > containing sprites< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_4_xform' > < code > < strong > xform< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#RSXform' > RSXform< / a > mappings for sprites in < a href = '#SkCanvas_drawAtlas_4_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_4_tex' > < code > < strong > tex< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > locations of sprites in < a href = '#SkCanvas_drawAtlas_4_atlas' > atlas< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_4_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
< td > number of sprites to draw< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_4_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
< td > bounds of transformed sprites for efficient clipping; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAtlas_4_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
2018-06-27 15:00:21 +00:00
< td > < a href = 'undocumented#Color_Filter' > Color Filter< / a > , < a href = 'undocumented#Image_Filter' > Image Filter< / a > , < a href = 'SkBlendMode_Reference#Blend_Mode' > Blend Mode< / a > , and so on; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "c093c2b14bd3e6171ede7cd4049d9b57" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < a href = '#SkCanvas_drawImage' > drawImage< / a > < sup > < a href = '#SkCanvas_drawImage_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawDrawable' > < / a >
2017-07-28 19:18:29 +00:00
## drawDrawable
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > (< a href = 'undocumented#SkDrawable' > SkDrawable< / a > * drawable, const < a href = 'SkMatrix_Reference#SkMatrix' > SkMatrix< / a > * matrix = nullptr)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Drawable' > Drawable< / a > < a href = '#SkCanvas_drawDrawable_drawable' > drawable< / a > using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > , concatenated with
2018-05-16 11:07:07 +00:00
optional < a href = '#SkCanvas_drawDrawable_matrix' > matrix< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#Canvas' > Canvas< / a > has an asynchronous implementation, as is the case
2018-06-27 15:00:21 +00:00
when it is recording into < a href = 'SkPicture_Reference#Picture' > Picture< / a > , then < a href = '#SkCanvas_drawDrawable_drawable' > drawable< / a > will be referenced,
2018-05-16 11:07:07 +00:00
so that < a href = 'undocumented#SkDrawable_draw' > SkDrawable::draw()< / a > can be called when the operation is finalized. To force
immediate drawing, call < a href = 'undocumented#SkDrawable_draw' > SkDrawable::draw()< / a > instead.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawDrawable_drawable' > < code > < strong > drawable< / strong > < / code > < / a > < / td >
< td > custom struct encapsulating drawing commands< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawDrawable_matrix' > < code > < strong > matrix< / strong > < / code > < / a > < / td >
< td > transformation applied to drawing; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "3a4dfcd08838866b5cfc0d82489195ba" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkDrawable' > SkDrawable< / a > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawDrawable_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawDrawable' > drawDrawable< / a > (< a href = 'undocumented#SkDrawable' > SkDrawable< / a > * drawable, < a href = 'undocumented#SkScalar' > SkScalar< / a > x, < a href = 'undocumented#SkScalar' > SkScalar< / a > y)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Draws < a href = 'undocumented#Drawable' > Drawable< / a > < a href = '#SkCanvas_drawDrawable_2_drawable' > drawable< / a > using < a href = '#Clip' > Clip< / a > and < a href = '#Matrix' > Matrix< / a > , offset by (< a href = '#SkCanvas_drawDrawable_2_x' > x< / a > , < a href = '#SkCanvas_drawDrawable_2_y' > y< / a > ).
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
If < a href = '#Canvas' > Canvas< / a > has an asynchronous implementation, as is the case
2018-06-27 15:00:21 +00:00
when it is recording into < a href = 'SkPicture_Reference#Picture' > Picture< / a > , then < a href = '#SkCanvas_drawDrawable_2_drawable' > drawable< / a > will be referenced,
2018-05-16 11:07:07 +00:00
so that < a href = 'undocumented#SkDrawable_draw' > SkDrawable::draw()< / a > can be called when the operation is finalized. To force
immediate drawing, call < a href = 'undocumented#SkDrawable_draw' > SkDrawable::draw()< / a > instead.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawDrawable_2_drawable' > < code > < strong > drawable< / strong > < / code > < / a > < / td >
< td > custom struct encapsulating drawing commands< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawDrawable_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into < a href = '#Canvas' > Canvas< / a > writable pixels on < a href = '#SkCanvas_drawDrawable_2_x' > x< / a > -axis< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkCanvas_drawDrawable_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
2018-06-14 16:28:14 +00:00
< td > offset into < a href = '#Canvas' > Canvas< / a > writable pixels on < a href = '#SkCanvas_drawDrawable_2_y' > y< / a > -axis< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "1bdc07ad3b154c89b771722c2fcaee3f" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#SkDrawable' > SkDrawable< / a > < a href = '#SkCanvas_drawPicture' > drawPicture< / a > < sup > < a href = '#SkCanvas_drawPicture_2' > [2]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_3' > [3]< / a > < / sup > < sup > < a href = '#SkCanvas_drawPicture_4' > [4]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAnnotation' > < / a >
2017-07-28 19:18:29 +00:00
## drawAnnotation
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAnnotation' > drawAnnotation< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, const char key[], < a href = 'undocumented#SkData' > SkData< / a > * value)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Associates < a href = 'SkRect_Reference#Rect' > Rect< / a > on < a href = '#Canvas' > Canvas< / a > with an annotation; a < a href = '#SkCanvas_drawAnnotation_key' > key< / a > -< a href = '#SkCanvas_drawAnnotation_value' > value< / a > pair, where the < a href = '#SkCanvas_drawAnnotation_key' > key< / a > is
2018-05-16 11:07:07 +00:00
a null-terminated utf8 string, and optional < a href = '#SkCanvas_drawAnnotation_value' > value< / a > is stored as < a href = 'undocumented#Data' > Data< / a > .
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
Only some canvas implementations, such as recording to < a href = 'SkPicture_Reference#Picture' > Picture< / a > , or drawing to
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#PDF' > Document PDF< / a > , use annotations.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAnnotation_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > extent of canvas to annotate< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAnnotation_key' > < code > < strong > key< / strong > < / code > < / a > < / td >
< td > string used for lookup< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAnnotation_value' > < code > < strong > value< / strong > < / code > < / a > < / td >
< td > data holding < a href = '#SkCanvas_drawAnnotation_value' > value< / a > stored in annotation< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "00b430bd80d740e19c6d020a940f56d5" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'undocumented#SkDocument' > SkDocument< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_drawAnnotation_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkCanvas_drawAnnotation' > drawAnnotation< / a > (const < a href = 'SkRect_Reference#SkRect' > SkRect< / a > & rect, const char key[], const < a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'undocumented#SkData' > SkData< / a > > & value)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Associates < a href = 'SkRect_Reference#Rect' > Rect< / a > on < a href = '#Canvas' > Canvas< / a > when an annotation; a < a href = '#SkCanvas_drawAnnotation_2_key' > key< / a > -< a href = '#SkCanvas_drawAnnotation_2_value' > value< / a > pair, where the < a href = '#SkCanvas_drawAnnotation_2_key' > key< / a > is
2018-05-16 11:07:07 +00:00
a null-terminated utf8 string, and optional < a href = '#SkCanvas_drawAnnotation_2_value' > value< / a > is stored as < a href = 'undocumented#Data' > Data< / a > .
2017-07-28 19:18:29 +00:00
2018-06-27 15:00:21 +00:00
Only some canvas implementations, such as recording to < a href = 'SkPicture_Reference#Picture' > Picture< / a > , or drawing to
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#PDF' > Document PDF< / a > , use annotations.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkCanvas_drawAnnotation_2_rect' > < code > < strong > rect< / strong > < / code > < / a > < / td >
< td > < a href = 'SkRect_Reference#Rect' > Rect< / a > extent of canvas to annotate< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAnnotation_2_key' > < code > < strong > key< / strong > < / code > < / a > < / td >
< td > string used for lookup< / td >
< / tr >
< tr > < td > < a name = 'SkCanvas_drawAnnotation_2_value' > < code > < strong > value< / strong > < / code > < / a > < / td >
< td > data holding < a href = '#SkCanvas_drawAnnotation_2_value' > value< / a > stored in annotation< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "00b430bd80d740e19c6d020a940f56d5" > < / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-06-27 15:00:21 +00:00
< a href = 'SkPicture_Reference#SkPicture' > SkPicture< / a > < a href = 'undocumented#SkDocument' > SkDocument< / a >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_isClipEmpty' > < / a >
2017-07-28 19:18:29 +00:00
## isClipEmpty
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
virtual bool < a href = '#SkCanvas_isClipEmpty' > isClipEmpty< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns true if < a href = '#Clip' > Clip< / a > is empty; that is, nothing will draw.
2017-07-28 19:18:29 +00:00
2017-08-03 21:14:08 +00:00
May do work when called; it should not be called
2017-07-28 19:18:29 +00:00
more often than needed. However, once called, subsequent calls perform no
2018-05-16 11:07:07 +00:00
work until < a href = '#Clip' > Clip< / a > changes.
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#Clip' > Clip< / a > is empty
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "f106f146a58c8604308d4d8d7086d2f5" >
#### Example Output
~~~~
clip is not empty
clip is empty
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_isClipRect' > isClipRect< / a > < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > < sup > < a href = '#SkCanvas_getDeviceClipBounds_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkCanvas_isClipRect' > < / a >
2017-07-28 19:18:29 +00:00
## isClipRect
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
virtual bool < a href = '#SkCanvas_isClipRect' > isClipRect< / a > () const
2017-07-28 19:18:29 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns true if < a href = '#Clip' > Clip< / a > is < a href = 'SkRect_Reference#Rect' > Rect< / a > and not empty.
Returns false if the clip is empty, or if it is not < a href = 'SkRect_Reference#Rect' > Rect< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = '#Clip' > Clip< / a > is < a href = 'SkRect_Reference#Rect' > Rect< / a > and not empty
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "9894bfb476c78a8f6c8f49fbbca3d50d" >
#### Example Output
~~~~
clip is rect
clip is not rect
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkCanvas_isClipEmpty' > isClipEmpty< / a > < a href = '#SkCanvas_getLocalClipBounds' > getLocalClipBounds< / a > < sup > < a href = '#SkCanvas_getLocalClipBounds_2' > [2]< / a > < / sup > < a href = '#SkCanvas_getDeviceClipBounds' > getDeviceClipBounds< / a > < sup > < a href = '#SkCanvas_getDeviceClipBounds_2' > [2]< / a > < / sup >
2017-11-02 21:49:34 +00:00
2017-07-28 19:18:29 +00:00
---