Skia
2DGraphicsLibrary
|
Public Member Functions | |
SkBitmapDevice (const SkBitmap &bitmap) | |
Construct a new device with the specified bitmap as its backend. More... | |
SkBitmapDevice (const SkBitmap &bitmap, const SkSurfaceProps &surfaceProps) | |
Construct a new device with the specified bitmap as its backend. More... | |
Public Member Functions inherited from SkBaseDevice | |
SkBaseDevice (const SkImageInfo &, const SkSurfaceProps &) | |
Construct a new device. | |
SkMetaData & | getMetaData () |
const SkImageInfo & | imageInfo () const |
Return ImageInfo for this device. More... | |
const SkSurfaceProps & | surfaceProps () const |
Return SurfaceProps for this device. | |
void | getGlobalBounds (SkIRect *bounds) const |
Return the bounds of the device in the coordinate space of the root canvas. More... | |
SkIRect | getGlobalBounds () const |
int | width () const |
int | height () const |
bool | isOpaque () const |
bool | writePixels (const SkImageInfo &, const void *, size_t rowBytes, int x, int y) |
bool | accessPixels (SkPixmap *pmap) |
Try to get write-access to the pixels behind the device. More... | |
bool | peekPixels (SkPixmap *) |
Try to get read-only-access to the pixels behind the device. More... | |
const SkIPoint & | getOrigin () const |
Return the device's origin: its offset in device coordinates from the default origin in its canvas' matrix/clip. | |
Public Member Functions inherited from SkRefCntBase | |
SkRefCntBase () | |
Default construct, initializing the reference count to 1. | |
virtual | ~SkRefCntBase () |
Destruct, asserting that the reference count is 1. | |
int32_t | getRefCnt () const |
Return the reference count. More... | |
void | validate () const |
bool | unique () const |
May return true if the caller is the only owner. More... | |
void | ref () const |
Increment the reference count. More... | |
void | unref () const |
Decrement the reference count. More... | |
Static Public Member Functions | |
static SkBitmapDevice * | Create (const SkImageInfo &info) |
Create a new device along with its requisite pixel memory using default SkSurfaceProps (i.e., kLegacyFontHost_InitType-style). More... | |
static SkBitmapDevice * | Create (const SkImageInfo &, const SkSurfaceProps &) |
Protected Member Functions | |
bool | onShouldDisableLCD (const SkPaint &) const override |
void | drawPaint (const SkDraw &, const SkPaint &paint) override |
These are called inside the per-device-layer loop for each draw call. More... | |
virtual void | drawPoints (const SkDraw &, SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint &paint) override |
virtual void | drawRect (const SkDraw &, const SkRect &r, const SkPaint &paint) override |
virtual void | drawOval (const SkDraw &, const SkRect &oval, const SkPaint &paint) override |
virtual void | drawRRect (const SkDraw &, const SkRRect &rr, const SkPaint &paint) override |
virtual void | drawPath (const SkDraw &, const SkPath &path, const SkPaint &paint, const SkMatrix *prePathMatrix=NULL, bool pathIsMutable=false) override |
If pathIsMutable, then the implementation is allowed to cast path to a non-const pointer and modify it in place (as an optimization). More... | |
virtual void | drawBitmap (const SkDraw &, const SkBitmap &bitmap, const SkMatrix &matrix, const SkPaint &paint) override |
virtual void | drawSprite (const SkDraw &, const SkBitmap &bitmap, int x, int y, const SkPaint &paint) override |
void | drawBitmapRect (const SkDraw &, const SkBitmap &, const SkRect *, const SkRect &, const SkPaint &, SkCanvas::SrcRectConstraint) override |
The default impl. More... | |
virtual void | drawText (const SkDraw &, const void *text, size_t len, SkScalar x, SkScalar y, const SkPaint &paint) override |
Does not handle text decoration. More... | |
virtual void | drawPosText (const SkDraw &, const void *text, size_t len, const SkScalar pos[], int scalarsPerPos, const SkPoint &offset, const SkPaint &paint) override |
virtual void | drawVertices (const SkDraw &, SkCanvas::VertexMode, int vertexCount, const SkPoint verts[], const SkPoint texs[], const SkColor colors[], SkXfermode *xmode, const uint16_t indices[], int indexCount, const SkPaint &paint) override |
virtual void | drawDevice (const SkDraw &, SkBaseDevice *, int x, int y, const SkPaint &) override |
The SkDevice passed will be an SkDevice which was returned by a call to onCreateDevice on this device with kNeverTile_TileExpectation. | |
void | drawSpecial (const SkDraw &, SkSpecialImage *, int x, int y, const SkPaint &) override |
sk_sp< SkSpecialImage > | makeSpecial (const SkBitmap &) override |
sk_sp< SkSpecialImage > | makeSpecial (const SkImage *) override |
sk_sp< SkSpecialImage > | snapSpecial () override |
const SkBitmap & | onAccessBitmap () |
Update as needed the pixel value in the bitmap, so that the caller can access the pixels directly. More... | |
SkPixelRef * | getPixelRef () const |
SkPixelRef * | setPixelRef (SkPixelRef *pr) |
bool | onReadPixels (const SkImageInfo &, void *, size_t, int x, int y) override |
The caller is responsible for "pre-clipping" the dst. More... | |
bool | onWritePixels (const SkImageInfo &, const void *, size_t, int, int) override |
The caller is responsible for "pre-clipping" the src. More... | |
bool | onPeekPixels (SkPixmap *) override |
bool | onAccessPixels (SkPixmap *) override |
Protected Member Functions inherited from SkBaseDevice | |
uint32_t | filterTextFlags (const SkPaint &) const |
Returns the text-related flags, possibly modified based on the state of the device (e.g. More... | |
virtual void | setMatrixClip (const SkMatrix &, const SkRegion &, const SkClipStack &) |
DEPRECATED: This will be removed in a future change. More... | |
virtual void | drawArc (const SkDraw &, const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint) |
By the time this is called we know that abs(sweepAngle) is in the range [0, 360). More... | |
virtual void | drawDRRect (const SkDraw &, const SkRRect &outer, const SkRRect &inner, const SkPaint &) |
virtual void | drawBitmapNine (const SkDraw &, const SkBitmap &, const SkIRect ¢er, const SkRect &dst, const SkPaint &) |
virtual void | drawBitmapLattice (const SkDraw &, const SkBitmap &, const SkCanvas::Lattice &, const SkRect &dst, const SkPaint &) |
virtual void | drawImage (const SkDraw &, const SkImage *, SkScalar x, SkScalar y, const SkPaint &) |
virtual void | drawImageRect (const SkDraw &, const SkImage *, const SkRect *src, const SkRect &dst, const SkPaint &, SkCanvas::SrcRectConstraint) |
virtual void | drawImageNine (const SkDraw &, const SkImage *, const SkIRect ¢er, const SkRect &dst, const SkPaint &) |
virtual void | drawImageLattice (const SkDraw &, const SkImage *, const SkCanvas::Lattice &, const SkRect &dst, const SkPaint &) |
virtual void | drawTextBlob (const SkDraw &, const SkTextBlob *, SkScalar x, SkScalar y, const SkPaint &paint, SkDrawFilter *drawFilter) |
virtual void | drawPatch (const SkDraw &, const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkXfermode *xmode, const SkPaint &paint) |
virtual void | drawAtlas (const SkDraw &, const SkImage *atlas, const SkRSXform[], const SkRect[], const SkColor[], int count, SkXfermode::Mode, const SkPaint &) |
virtual void | drawAnnotation (const SkDraw &, const SkRect &, const char[], SkData *) |
virtual void | drawTextOnPath (const SkDraw &, const void *text, size_t len, const SkPath &, const SkMatrix *, const SkPaint &) |
virtual void | drawTextRSXform (const SkDraw &, const void *text, size_t len, const SkRSXform[], const SkPaint &) |
bool | readPixels (const SkImageInfo &, void *dst, size_t rowBytes, int x, int y) |
virtual GrContext * | context () const |
Protected Member Functions inherited from SkRefCntBase | |
void | internal_dispose_restore_refcnt_to_1 () const |
Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More... | |
Private Types | |
typedef SkBaseDevice | INHERITED |
Private Member Functions | |
void | replaceBitmapBackendForRasterSurface (const SkBitmap &) override |
SkBaseDevice * | onCreateDevice (const CreateInfo &, const SkPaint *) override |
Create a new device based on CreateInfo. More... | |
sk_sp< SkSurface > | makeSurface (const SkImageInfo &, const SkSurfaceProps &) override |
SkImageFilterCache * | getImageFilterCache () override |
void | setNewSize (const SkISize &) |
Private Attributes | |
SkBitmap | fBitmap |
Friends | |
class | SkCanvas |
struct | DeviceCM |
class | SkDraw |
class | SkDrawIter |
class | SkDeviceFilteredPaint |
class | SkSurface_Raster |
Additional Inherited Members | |
Protected Types inherited from SkBaseDevice | |
enum | TileUsage { kPossible_TileUsage, kNever_TileUsage } |
Static Protected Member Functions inherited from SkBaseDevice | |
static void | LogDrawScaleFactor (const SkMatrix &, SkFilterQuality) |
SkBitmapDevice::SkBitmapDevice | ( | const SkBitmap & | bitmap | ) |
Construct a new device with the specified bitmap as its backend.
It is valid for the bitmap to have no pixels associated with it. In that case, any drawing to this device will have no effect.
SkBitmapDevice::SkBitmapDevice | ( | const SkBitmap & | bitmap, |
const SkSurfaceProps & | surfaceProps | ||
) |
Construct a new device with the specified bitmap as its backend.
It is valid for the bitmap to have no pixels associated with it. In that case, any drawing to this device will have no effect.
|
static |
Create a new device along with its requisite pixel memory using default SkSurfaceProps (i.e., kLegacyFontHost_InitType-style).
Note: this entry point is slated for removal - no one should call it.
|
overrideprotectedvirtual |
The default impl.
will create a bitmap-shader from the bitmap, and call drawRect with it.
Implements SkBaseDevice.
These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations, and are handling any looping from the paint, and any effects from the DrawFilter.
Implements SkBaseDevice.
|
overrideprotectedvirtual |
If pathIsMutable, then the implementation is allowed to cast path to a non-const pointer and modify it in place (as an optimization).
Canvas may do this to implement helpers such as drawOval, by placing a temp path on the stack to hold the representation of the oval.
If prePathMatrix is not null, it should logically be applied before any stroking or other effects. If there are no effects on the paint that affect the geometry/rasterization, then the pre matrix can just be pre-concated with the current matrix.
Implements SkBaseDevice.
|
overrideprotectedvirtual |
Does not handle text decoration.
Decorations (underline and stike-thru) will be handled by SkCanvas.
Implements SkBaseDevice.
|
protected |
Update as needed the pixel value in the bitmap, so that the caller can access the pixels directly.
Note: only the pixels field should be altered. The config/width/height/rowbytes must remain unchanged.
|
overrideprivatevirtual |
Create a new device based on CreateInfo.
If the paint is not null, then it represents a preview of how the new device will be composed with its creator device (this).
The subclass may be handed this device in drawDevice(), so it must always return a device that it knows how to draw, and that it knows how to identify if it is not of the same subclass (since drawDevice is passed a SkBaseDevice*). If the subclass cannot fulfill that contract (e.g. PDF cannot support some settings on the paint) it should return NULL, and the caller may then decide to explicitly create a bitmapdevice, knowing that later it could not call drawDevice with it (but it could call drawSprite or drawBitmap).
Reimplemented from SkBaseDevice.
|
overrideprotectedvirtual |
The caller is responsible for "pre-clipping" the dst.
The impl can assume that the dst image at the specified x,y offset will fit within the device's bounds.
This is explicitly asserted in readPixels(), the public way to call this.
Reimplemented from SkBaseDevice.
|
overrideprotectedvirtual |
The caller is responsible for "pre-clipping" the src.
The impl can assume that the src image at the specified x,y offset will fit within the device's bounds.
This is explicitly asserted in writePixelsDirect(), the public way to call this.
Reimplemented from SkBaseDevice.