#include <SkDevice.h>
Inherits SkRefCnt.
Public Member Functions | |
SkDevice () | |
SkDevice (const SkBitmap &bitmap) | |
int | width () const |
int | height () const |
SkBitmap::Config | config () const |
bool | isOpaque () const |
void | getBounds (SkIRect *bounds) const |
bool | intersects (const SkIRect &r, SkIRect *sect=NULL) const |
const SkBitmap & | accessBitmap (bool changePixels) |
void | eraseColor (SkColor eraseColor) |
virtual void | lockPixels () |
virtual void | unlockPixels () |
virtual void | setMatrixClip (const SkMatrix &, const SkRegion &) |
virtual void | gainFocus (SkCanvas *) |
virtual void | drawPaint (const SkDraw &, const SkPaint &paint) |
virtual void | drawPoints (const SkDraw &, SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint &paint) |
virtual void | drawRect (const SkDraw &, const SkRect &r, const SkPaint &paint) |
virtual void | drawPath (const SkDraw &, const SkPath &path, const SkPaint &paint) |
virtual void | drawBitmap (const SkDraw &, const SkBitmap &bitmap, const SkMatrix &matrix, const SkPaint &paint) |
virtual void | drawSprite (const SkDraw &, const SkBitmap &bitmap, int x, int y, const SkPaint &paint) |
virtual void | drawText (const SkDraw &, const void *text, size_t len, SkScalar x, SkScalar y, const SkPaint &paint) |
virtual void | drawPosText (const SkDraw &, const void *text, size_t len, const SkScalar pos[], SkScalar constY, int scalarsPerPos, const SkPaint &paint) |
virtual void | drawTextOnPath (const SkDraw &, const void *text, size_t len, const SkPath &path, const SkMatrix *matrix, const SkPaint &paint) |
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) |
virtual void | drawDevice (const SkDraw &, SkDevice *, int x, int y, const SkPaint &) |
Protected Member Functions | |
virtual void | onAccessBitmap (SkBitmap *) |
Definition at line 30 of file SkDevice.h.
SkDevice::SkDevice | ( | ) |
SkDevice::SkDevice | ( | const SkBitmap & | bitmap | ) |
Construct a new device, extracting the width/height/config/isOpaque values from the bitmap. If transferPixelOwnership is true, and the bitmap claims to own its own pixels (getOwnsPixels() == true), then transfer this responsibility to the device, and call setOwnsPixels(false) on the bitmap.
Subclasses may override the destructor, which is virtual, even though this class doesn't have one. SkRefCnt does.
bitmap | A copy of this bitmap is made and stored in the device |
const SkBitmap& SkDevice::accessBitmap | ( | bool | changePixels | ) |
Return the bitmap associated with this device. Call this each time you need to access the bitmap, as it notifies the subclass to perform any flushing etc. before you examine the pixels.
changePixels | set to true if the caller plans to change the pixels |
SkBitmap::Config SkDevice::config | ( | ) | const [inline] |
Return the bitmap config of the device's pixels
Definition at line 53 of file SkDevice.h.
virtual void SkDevice::drawBitmap | ( | const SkDraw & | , | |
const SkBitmap & | bitmap, | |||
const SkMatrix & | matrix, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawDevice | ( | const SkDraw & | , | |
SkDevice * | , | |||
int | x, | |||
int | y, | |||
const SkPaint & | ||||
) | [virtual] |
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.
virtual void SkDevice::drawPath | ( | const SkDraw & | , | |
const SkPath & | path, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawPoints | ( | const SkDraw & | , | |
SkCanvas::PointMode | mode, | |||
size_t | count, | |||
const | SkPoint[], | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawPosText | ( | const SkDraw & | , | |
const void * | text, | |||
size_t | len, | |||
const SkScalar | pos[], | |||
SkScalar | constY, | |||
int | scalarsPerPos, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawRect | ( | const SkDraw & | , | |
const SkRect & | r, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawSprite | ( | const SkDraw & | , | |
const SkBitmap & | bitmap, | |||
int | x, | |||
int | y, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawText | ( | const SkDraw & | , | |
const void * | text, | |||
size_t | len, | |||
SkScalar | x, | |||
SkScalar | y, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::drawTextOnPath | ( | const SkDraw & | , | |
const void * | text, | |||
size_t | len, | |||
const SkPath & | path, | |||
const SkMatrix * | matrix, | |||
const SkPaint & | paint | |||
) | [virtual] |
virtual void SkDevice::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 | |||
) | [virtual] |
void SkDevice::eraseColor | ( | SkColor | eraseColor | ) |
Helper to erase the entire device to the specified color (including alpha).
virtual void SkDevice::gainFocus | ( | SkCanvas * | ) | [inline, virtual] |
Called when this device gains focus (i.e becomes the current device for drawing).
Definition at line 97 of file SkDevice.h.
void SkDevice::getBounds | ( | SkIRect * | bounds | ) | const |
Return the bounds of the device
int SkDevice::height | ( | ) | const [inline] |
Return the height of the device (in pixels).
Definition at line 50 of file SkDevice.h.
Return true if the specified rectangle intersects the bounds of the device. If sect is not NULL and there is an intersection, sect returns the intersection.
bool SkDevice::isOpaque | ( | ) | const [inline] |
Returns true if the device's bitmap's config treats every pixels as implicitly opaque.
Definition at line 57 of file SkDevice.h.
virtual void SkDevice::lockPixels | ( | ) | [virtual] |
Called when this device is installed into a Canvas. Balanaced by a call to unlockPixels() when the device is removed from a Canvas.
virtual void SkDevice::onAccessBitmap | ( | SkBitmap * | ) | [protected, virtual] |
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.
Called with the correct matrix and clip before this device is drawn to using those settings. If your subclass overrides this, be sure to call through to the base class as well.
virtual void SkDevice::unlockPixels | ( | ) | [virtual] |
int SkDevice::width | ( | ) | const [inline] |
Return the width of the device (in pixels).
Definition at line 47 of file SkDevice.h.