class SkBlender; class SkColorFilter; class SkColorSpace; class SkImageFilter; class SkMaskFilter; class SkPathEffect; class SkShader; enumclass SkBlendMode; struct SkRect;
/** Makes a shallow copy of SkPaint. SkPathEffect, SkShader, SkMaskFilter,SkColorFilter,andSkImageFilterareshared betweentheoriginalpaintandthecopy.ObjectscontainingSkRefCntincrement theirreferencesbyone.
/** Makes a shallow copy of SkPaint. SkPathEffect, SkShader, SkMaskFilter,SkColorFilter,andSkImageFilterareshared betweentheoriginalpaintandthecopy.ObjectscontainingSkRefCntinthe priordestinationaredecreasedbyone,andthereferencedobjectsaredeletedifthe resultingcountiszero.ObjectscontainingSkRefCntintheparameterpaint areincreasedbyone.paintisunmodified.
/** Moves the paint to avoid increasing the reference counts ofobjectsreferencedbythepaintparameter.ObjectscontainingSkRefCntinthe priordestinationaredecreasedbyone;thoseobjectsaredeletediftheresultingcount iszero.
/** Compares a and b, and returns true if a and b are equivalent. May return false ifSkPathEffect,SkShader,SkMaskFilter,SkColorFilter, orSkImageFilterhaveidenticalcontentsbutdifferentpointers.
/** Compares a and b, and returns true if a and b are not equivalent. May return true ifSkPathEffect,SkShader,SkMaskFilter,SkColorFilter, orSkImageFilterhaveidenticalcontentsbutdifferentpointers.
@paramaSkPainttocompare @parambSkPainttocompare @returntrueifSkPaintpairarenotequivalent
*/ friendbooloperator!=(const SkPaint& a, const SkPaint& b) { return !(a == b);
}
/** Sets all SkPaint contents to their initial values. This is equivalent to replacing SkPaintwiththeresultofSkPaint().
/** Returns true if pixels on the active edges of SkPath may be drawn with partial transparency. @returnantialiasingstate
*/ bool isAntiAlias() const { return SkToBool(fBitfields.fAntiAlias);
}
/** Requests, but does not require, that edge pixels draw opaque or with partialtransparency. @paramaasettingforantialiasing
*/ void setAntiAlias(bool aa) { fBitfields.fAntiAlias = static_cast<unsigned>(aa); }
/** Returns true if color error may be distributed to smooth color transition. @returnditheringstate
*/ bool isDither() const { return SkToBool(fBitfields.fDither);
}
/** Requests, but does not require, to distribute color error. @paramdithersettingfordithering
*/ void setDither(bool dither) { fBitfields.fDither = static_cast<unsigned>(dither); }
UsekStrokeAndFill_Styletoavoidhittingthesamepixelstwicewithastrokedrawand afilldraw.
*/ enum Style : uint8_t {
kFill_Style, //!< set to fill geometry
kStroke_Style, //!< set to stroke geometry
kStrokeAndFill_Style, //!< sets to stroke and fill geometry
};
/** May be used to verify that SkPaint::Style is a legal value.
*/ static constexpr int kStyleCount = kStrokeAndFill_Style + 1;
/** Returns whether the geometry is filled, stroked, or filled and stroked.
*/
Style getStyle() const { return (Style)fBitfields.fStyle; }
/** Sets whether the geometry is filled, stroked, or filled and stroked. HasnoeffectifstyleisnotalegalSkPaint::Stylevalue.
/** Retrieves alpha and RGB, unpremultiplied, as four floating point values. RGB are extendedsRGBvalues(sRGBgamut,andencodedwiththesRGBtransferfunction).
/** Sets alpha and RGB used when stroking and filling. The color is four floating pointvalues,unpremultiplied.Thecolorvaluesareinterpretedasbeingin thecolorSpace.IfcolorSpaceisnullptr,thencolorisassumedtobeinthe sRGBcolorspace.
// Helper that accepts an int between 0 and 255, and divides it by 255.0 void setAlpha(U8CPU a) {
this->setAlphaf(a * (1.0f / 255));
}
/** Sets color used when drawing solid fills. The color components range from 0 to 255. Thecolorisunpremultiplied;alphasetsthetransparencyindependentofRGB.
/** Sets the thickness of the pen used by the paint to outline the shape. Astroke-widthofzeroistreatedas"hairline"width.Hairlinesarealwaysexactlyone pixelwideindevicespace(theirthicknessdoesnotchangeasthecanvasisscaled). Negativestroke-widthsareinvalid;settinganegativewidthwillhavenoeffect.
/** When stroking a small joinAngle with miter, the miterLength may be very long. WhenmiterLength>maxMiterLength(orjoinAngle<minJoinAngle)thejoinwillbecomebevel. miterLimit=maxMiterLength/strokeWidthormiterLimit=1/sin(minJoinAngle/2).
/** If the current blender can be represented as a SkBlendMode enum, this returns that *enumintheoptional'svalue().Ifitcannot,thenthereturnedoptionaldoesnot *containavalue.
*/
std::optional<SkBlendMode> asBlendMode() const;
/** Returns true iff the current blender claims to be equivalent to SkBlendMode::kSrcOver. * *Alsoreturnstrueofthecurrentblenderisnullptr.
*/ bool isSrcOver() const;
/** Returns the user-supplied blend function, if one has been set. *DoesnotalterSkBlender'sSkRefCnt. * *AnullptrblendersignifiesthedefaultSrcOverbehavior. * *@returntheSkBlenderassignedtothispaint,otherwisenullptr
*/
SkBlender* getBlender() const { return fBlender.get(); }
/** Returns the user-supplied blend function, if one has been set. *IncrementstheSkBlender'sSkRefCntbyone. * *AnullptrblendersignifiesthedefaultSrcOverbehavior. * *@returntheSkBlenderassignedtothispaint,otherwisenullptr
*/
sk_sp<SkBlender> refBlender() const;
/** Sets the current blender, increasing its refcnt, and if a blender is already *present,decreasingthatobject'srefcnt. * *AnullptrblendersignifiesthedefaultSrcOverbehavior. * *Forconvenience,youcancallsetBlendMode()iftheblendeffectcanbeexpressed *asoneofthosevalues.
*/ void setBlender(sk_sp<SkBlender> blender);
/** Returns SkPathEffect if set, or nullptr. DoesnotalterSkPathEffectSkRefCnt.
/** Sets SkMaskFilter to maskFilter, decreasing SkRefCnt of the previous SkMaskFilter.PassnullptrtoclearSkMaskFilterandleaveSkMaskFiltereffecton maskalphaunaltered.
/** Sets SkImageFilter to imageFilter, decreasing SkRefCnt of the previous SkImageFilter.PassnullptrtoclearSkImageFilter,andremoveSkImageFiltereffect ondrawing.
/** (to be made private) ReturnstrueifSkPaintdoesnotincludeelementsrequiringextensivecomputation tocomputedeviceboundsofdrawngeometry.Forinstance,SkPaintwithSkPathEffect alwaysreturnsfalse.
/** (to be made private) OnlycallthisifcanComputeFastBounds()returnedtrue.Thistakesa rawrectangle(therawboundsofashape),andadjustsitforstylistic effectsinthepaint(e.g.stroking).Ifneeded,itusesthestorage parameter.Itreturnstheadjustedboundsthatcanthenbeused forSkCanvas::quickRejecttests.
ThereturnedSkRectwilleitherbeorigorstorage,thusthecaller shouldnotrelyonstoragebeingsettotheresult,butshouldalways usethereturnedvalue.Itislegalfororigandstoragetobethesame SkRect. Forexample: if(!path.isInverseFillType()&&paint.canComputeFastBounds()){ SkRectstorage; if(canvas->quickReject(paint.computeFastBounds(path.getBounds(),&storage))){ return;// do not draw the path } } // draw the path
/** (to be made private) Computesthebounds,overridingtheSkPaintSkPaint::Style.Thiscanbeusedto accountforadditionalwidthrequiredbystrokingorig,without alteringSkPaint::Stylesettofill.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.