diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh index d17dd649d3..606886a7e5 100644 --- a/docs/SkBitmap_Reference.bmh +++ b/docs/SkBitmap_Reference.bmh @@ -2513,10 +2513,31 @@ Unpremultiplied: ## ## -#SeeAlso getAddr readPixels +#SeeAlso getAlphaf getAddr readPixels ## +#Method float getAlphaf(int x, int y) const +#In Property +#Line # returns Alpha normalized from zero to one ## + +Looks up the pixel at (x,y) and return its alpha component, normalized to [0..1]. +This is roughly equivalent to #Formula # SkGetColorA(getColor()) ##, but can be more efficent +(and more precise if the pixels store more than 8 bits per component). + +#Param x column index, zero or greater, and less than width() ## +#Param y row index, zero or greater, and less than height() ## + +#Return alpha converted to normalized float ## + +#NoExample +## + +#SeeAlso getColor + +## + + # ------------------------------------------------------------------------------ #Method void* getAddr(int x, int y) const diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh index 9dbb1a5c37..ada8bfc808 100644 --- a/docs/SkPixmap_Reference.bmh +++ b/docs/SkPixmap_Reference.bmh @@ -804,7 +804,27 @@ Unpremultiplied: ## ## -#SeeAlso addr() readPixels +#SeeAlso getAlphaf addr() readPixels + +## + +#Method float getAlphaf(int x, int y) const +#In Property +#Line # returns Alpha normalized from zero to one ## + +Looks up the pixel at (x,y) and return its alpha component, normalized to [0..1]. +This is roughly equivalent to #Formula # SkGetColorA(getColor()) ##, but can be more efficent +(and more precise if the pixels store more than 8 bits per component). + +#Param x column index, zero or greater, and less than width() ## +#Param y row index, zero or greater, and less than height() ## + +#Return alpha converted to normalized float ## + +#NoExample +## + +#SeeAlso getColor ## diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md index 943f5a2a0b..b898b663db 100644 --- a/site/user/api/SkBitmap_Reference.md +++ b/site/user/api/SkBitmap_Reference.md @@ -297,158 +297,162 @@ SkBitmap member functions read and modify the structure properties. returns readable pixel address as 8-bit pointer + getAlphaf + returns Alpha normalized from zero to one + + getBounds returns width and height as Rectangle - + getColor returns one pixel as Unpremultiplied Color - + getGenerationID returns unique ID - + 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 - + installPixels creates Pixel Ref, with optional release function - + 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 - + notifyPixelsChanged marks pixels as changed, altering the unique ID - + peekPixels returns Pixmap if possible - + pixelRef returns Pixel Ref, or nullptr - + pixelRefOrigin returns offset within Pixel Ref - + pixmap returns Pixmap - + readPixels copies and converts pixels - + readyToDraw returns true if address of pixels is not nullptr - + refColorSpace returns Image Info Color Space - + reset sets to default values, releases pixel ownership - + rowBytes returns interval between rows in bytes - + rowBytesAsPixels returns interval between rows in pixels - + 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 - + setPixels sets Pixel Ref without an offset - + shiftPerPixel returns bit shift from pixels to bytes - + swap exchanges Bitmap pair - + tryAllocN32Pixels allocates compatible ARGB pixels if possible - + tryAllocPixels allocates pixels from Image Info if possible - + tryAllocPixelsFlags allocates pixels from Image Info with options if possible - + validate asserts if Bitmap is invalid (debug only) - + width returns pixel column count - + writePixels copies and converts pixels @@ -882,86 +886,90 @@ two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaT returns readable pixel address as 8-bit pointer + getAlphaf + returns Alpha normalized from zero to one + + 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 @@ -3320,7 +3328,38 @@ Unpremultiplied: ### See Also -getAddr readPixels[2][3] +getAlphaf getAddr readPixels[2][3] + +--- + + +## getAlphaf + +
+float getAlphaf(int x, int y) const
+
+ +Looks up the pixel at (x,y) and return its alpha component, normalized to [0..1]. +This is roughly equivalent to SkGetColorA(getColor()\), but can be more efficent +(and more precise if the pixels store more than 8 bits per component). + +### Parameters + + + + + + + +
xcolumn index, zero or greater, and less than width
yrow index, zero or greater, and less than height
+ +### Return Value + +alpha converted to normalized float + +### See Also + +getColor --- diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md index 4869b66f41..c1457d5ee9 100644 --- a/site/user/api/SkPixmap_Reference.md +++ b/site/user/api/SkPixmap_Reference.md @@ -149,74 +149,78 @@ SkPixmap member functions read and modify the structure properties. sets pointer to portion of original + getAlphaf + returns Alpha normalized from zero to one + + getColor returns one pixel as Unpremultiplied Color - + height returns pixel row count - + info returns Image Info - + isOpaque returns true if Image Info describes opaque pixels - + readPixels copies and converts pixels - + reset reuses existing Pixmap with replacement values - + rowBytes returns interval between rows in bytes - + rowBytesAsPixels returns interval between rows in pixels - + scalePixels scales and converts pixels - + setColorSpace sets Image Info Color Space - + shiftPerPixel returns bit shift from pixels to bytes - + width returns pixel column count - + writable addr returns writable pixel address as void pointer - + writable addr16 returns writable pixel address as 16-bit pointer - + writable addr32 returns writable pixel address as 32-bit pointer - + writable addr64 returns writable pixel address as 64-bit pointer - + writable addr8 returns writable pixel address as 8-bit pointer - + writable addrF16 returns writable pixel component address as 16-bit pointer @@ -1035,7 +1039,38 @@ Unpremultiplied: ### See Also -addr[2] readPixels[2][3][4] +getAlphaf addr[2] readPixels[2][3][4] + +--- + + +## getAlphaf + +
+float getAlphaf(int x, int y) const
+
+ +Looks up the pixel at (x,y) and return its alpha component, normalized to [0..1]. +This is roughly equivalent to SkGetColorA(getColor()\), but can be more efficent +(and more precise if the pixels store more than 8 bits per component). + +### Parameters + + + + + + + +
xcolumn index, zero or greater, and less than width
yrow index, zero or greater, and less than height
+ +### Return Value + +alpha converted to normalized float + +### See Also + +getColor ---