From 78de7519692ea93a2d2c70f8c0e773668df49fce Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Wed, 7 Feb 2018 07:27:09 -0500 Subject: add subtopics to all methods add self-check looking for #In markup on every method, pointing to an existing #Subtopic to reference the method. Docs-Preview: https://skia.org/?cl=104325 Bug: skia:6898 Change-Id: I749a25b9a43033ae68d193249b2c0b810dcf8fc8 Reviewed-on: https://skia-review.googlesource.com/104325 Commit-Queue: Cary Clark Reviewed-by: Cary Clark --- site/user/api/SkBitmap_Reference.md | 144 +++++++++++++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 11 deletions(-) (limited to 'site/user/api/SkBitmap_Reference.md') diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md index edef11b2ec..f53ecaacc9 100644 --- a/site/user/api/SkBitmap_Reference.md +++ b/site/user/api/SkBitmap_Reference.md @@ -49,7 +49,13 @@ is useful to position one or more Bitmaps within a shared | name | description | | --- | --- | +| Allocate | allocates storage for pixels | +| Draw | set pixels to Color | +| Pixels | read and write pixel values | +| Property | metrics and attributes | | Row Bytes | interval from one row to the next | +| Set | updates values and attributes | +| Utility | rarely called management functions | ## Constant @@ -71,6 +77,12 @@ is useful to position one or more Bitmaps within a shared | SkBitmap() | constructs with default values | | SkBitmap(SkBitmap&& src) | takes ownership of pixels | | SkBitmap(const SkBitmap& src) | shares ownership of pixels | +| extractAlpha | creates Bitmap containing Alpha of pixels | +| | extractAlpha(SkBitmap* dst) const | +| | extractAlpha(SkBitmap* dst, const SkPaint* paint, SkIPoint* offset) const | +| | extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, SkIPoint* offset) const | +| extractSubset | creates Bitmap, sharing pixels if possible | +| reset | sets to default values, releases pixel ownership | | ~SkBitmap() | releases ownership of pixels | ## Operator @@ -493,6 +505,44 @@ two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaT --- +## Property + +| name | description | +| --- | --- | +| alphaType | returns Image Info Alpha Type | +| bounds | returns width and height as Rectangle | +| bytesPerPixel | returns number of bytes in pixel based on Color Type | +| colorSpace | returns Image Info Color Space | +| colorType | returns Image Info Color Type | +| dimensions | returns width and height | +| drawsNothing | returns true if no width, no height, or no Pixel Ref | +| empty | returns true if Image Info has zero width or height | +| getAddr | returns readable pixel address as void pointer | +| getAddr16 | returns readable pixel address as 16-bit pointer | +| getAddr32 | returns readable pixel address as 32-bit pointer | +| getAddr8 | returns readable pixel address as 8-bit pointer | +| getBounds | returns width and height as Rectangle | +| | getBounds(SkRect* bounds) const | +| | getBounds(SkIRect* bounds) const | +| getColor | returns one pixel as Unpremultiplied Color | +| getPixels | returns address of pixels | +| getSubset | returns bounds offset by origin | +| hasHardwareMipMap | returns Mip_Map support present; Android only | +| height | returns pixel row count | +| info | returns Image Info | +| isImmutable | returns true if pixels will not change | +| isNull | returns true if Pixel Ref is nullptr | +| isOpaque | returns true if Image Info describes opaque pixels | +| isVolatile | returns true if pixels should not be cached | +| pixelRef | returns Pixel Ref, or nullptr | +| pixelRefOrigin | returns offset within Pixel Ref | +| pixmap | returns Pixmap | +| refColorSpace | returns Image Info Color Space | +| rowBytes | returns interval between rows in bytes | +| rowBytesAsPixels | returns interval between rows in pixels | +| shiftPerPixel | returns bit shift from pixels to bytes | +| width | returns pixel column count | + ## pixmap @@ -1611,6 +1661,29 @@ enum AllocFlags { +## Allocate + +| name | description | +| --- | --- | +| allocN32Pixels | allocates compatible Color ARGB pixels, or aborts | +| allocPixels | allocates pixels from Image Info, or aborts | +| | allocPixels(const SkImageInfo& info, size t rowBytes) | +| | allocPixels(const SkImageInfo& info) | +| | allocPixels | +| | allocPixels(Allocator* allocator) | +| allocPixelsFlags | allocates pixels from Image Info with options, or aborts | +| installPixels | creates Pixel Ref, with optional release function | +| | installPixels(const SkImageInfo& info, void* pixels, size t rowBytes, void (*releaseProc) (void* addr, void* context) , void* context) | +| | installPixels(const SkImageInfo& info, void* pixels, size t rowBytes) | +| | installPixels(const SkPixmap& pixmap) | +| tryAllocN32Pixels | allocates compatible Color ARGB pixels if possible | +| tryAllocPixels | allocates pixels from Image Info if possible | +| | tryAllocPixels(const SkImageInfo& info, size t rowBytes) | +| | tryAllocPixels(const SkImageInfo& info) | +| | tryAllocPixels | +| | tryAllocPixels(Allocator* allocator) | +| tryAllocPixelsFlags | allocates pixels from Image Info with options if possible | + ## tryAllocPixelsFlags @@ -2075,7 +2148,7 @@ true if Image Info was set to pix ### Example -
Draw a five by five bitmap, and draw it again with a center white pixel.
+
Draw a five by five bitmap, and draw it again with a center white pixel.
### See Also @@ -2094,6 +2167,23 @@ soon --- +## Pixels + +| name | description | +| --- | --- | +| notifyPixelsChanged | marks pixels as changed, altering the unique ID | +| peekPixels | returns Pixmap if possible | +| readPixels | copies and converts pixels | +| | readPixels(const SkImageInfo& dstInfo, void* dstPixels, size t dstRowBytes, int srcX, int srcY, SkTransferFunctionBehavior behavior) const | +| | readPixels(const SkImageInfo& dstInfo, void* dstPixels, size t dstRowBytes, int srcX, int srcY) const | +| | readPixels(const SkPixmap& dst, int srcX, int srcY) const | +| | readPixels(const SkPixmap& dst) const | +| setPixels | sets Pixel Ref without an offset | +| writePixels | copies and converts pixels | +| | writePixels(const SkPixmap& src, int dstX, int dstY) | +| | writePixels(const SkPixmap& src) | +| | writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior) | + ## setPixels @@ -2189,7 +2279,7 @@ Allocates pixel memory with alloc The allocation size is determined by Image Info width, height, and Color Type. If allocator is nullptr, use HeapAllocator instead. -Returns false if allocator allocPixelRef return false. +Returns false if Allocator::allocPixelRef return false. ### Parameters @@ -2225,7 +2315,7 @@ Allocates pixel memory with allocato The allocation size is determined by Image Info width, height, and Color Type. If allocator is nullptr, use HeapAllocator instead. -Aborts if allocator allocPixelRef return false. Abort steps may be provided by +Aborts if Allocator::allocPixelRef return false. Abort steps may be provided by the user at compile time by defining SK_ABORT. ### Parameters @@ -2310,6 +2400,17 @@ subset origin: 32, 64 --- +## Set + +| name | description | +| --- | --- | +| setAlphaType | sets Alpha Type of shared pixels | +| setHasHardwareMipMap | sets Mip_Map support present; Android only | +| setImmutable | marks that pixels will not change | +| setInfo | sets height, width, Color Type, and so on, releasing pixels | +| setIsVolatile | marks if pixels should not be cached | +| setPixelRef | sets Pixel Ref and offset | + ## setPixelRef @@ -2428,6 +2529,15 @@ Marks that pixels in Pixel Ref have changed --- +## Draw + +| name | description | +| --- | --- | +| erase | writes Color to rectangle of pixels | +| eraseARGB | writes Color to pixels | +| eraseColor | writes Color to pixels | +| eraseRGB | deprecated | + ## eraseColor @@ -2821,7 +2931,7 @@ unsigned 8-bit pointer to pixel at (x, -Shares Pixel Ref with dst. Pixels are not copied; Bitmap and dst point +Shares Pixel Ref with dst. Pixels are not copied; Bitmap and dst point to the same pixels; dst bounds are set to the intersection of subset and the original bounds. @@ -2902,7 +3012,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; dstInfo.colorType must match. If Bitmap colorType is kGray 8 SkColorType, dstInfo.colorSpace must match. If Bitmap alphaType is kOpaque SkAlphaType, dstInfo.alphaType must @@ -2969,7 +3079,7 @@ Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; dstInfo.colorType must match. If Bitmap colorType is kGray 8 SkColorType, dstInfo.colorSpace must match. If Bitmap alphaType is kOpaque SkAlphaType, dstInfo.alphaType must @@ -3029,7 +3139,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; dst Color Type must match. If Bitmap colorType is kGray 8 SkColorType, dst Color Space must match. If Bitmap alphaType is kOpaque SkAlphaType, dst Alpha Type must @@ -3084,7 +3194,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; dst Color Type must match. If Bitmap colorType is kGray 8 SkColorType, dst Color Space must match. If Bitmap alphaType is kOpaque SkAlphaType, dst Alpha Type must @@ -3132,7 +3242,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; src Color Type must match. If Bitmap colorType is kGray 8 SkColorType, src Color Space must match. If Bitmap alphaType is kOpaque SkAlphaType, src Alpha Type must @@ -3187,7 +3297,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; src Color Type must match. If Bitmap colorType is kGray 8 SkColorType, src Color Space must match. If Bitmap alphaType is kOpaque SkAlphaType, src Alpha Type must @@ -3234,7 +3344,7 @@ row to the next. Returns true if pixels are copied. Returns false if: Pixel Ref is nullptr -Pixels are copied only if pixel conversion is possible. If Bitmap colorType is +Pixels are copied only if pixel conversion is possible. If Bitmap colorType is kGray 8 SkColorType, or kAlpha 8 SkColorType; src Color Type must match. If Bitmap colorType is kGray 8 SkColorType, src Color Space must match. If Bitmap alphaType is kOpaque SkAlphaType, src Alpha Type must @@ -3478,6 +3588,18 @@ x---x- --- +## Utility + +| name | description | +| --- | --- | +| ComputeIsOpaque | returns true if all pixels are opaque | +| computeByteSize | returns size required for pixels | +| getGenerationID | returns unique ID | +| readyToDraw | returns true if address of pixels is not nullptr | +| swap | exchanges Bitmap pair | +| toString | converts Bitmap to machine readable form | +| validate | asserts if Bitmap is invalid (debug only) | + ## validate -- cgit v1.2.3