Package com.stripe.android.camera.framework.image

Types

Link copied to clipboard
class NV21Image(    val width: Int,     val height: Int,     val nv21Data: ByteArray)

An image made of data in the NV21 format.

Functions

Link copied to clipboard
fun Bitmap.constrainToSize(size: Size, filter: Boolean = false): Bitmap

Constrain a bitmap to a given size, while maintaining its original aspect ratio.

Link copied to clipboard
fun Bitmap.crop(crop: Rect): Bitmap

Crop a Bitmap to a given Rect. The crop must have a positive area and must be contained within the bounds of the source Bitmap.

Link copied to clipboard
fun cropCameraPreviewToSquare(    cameraPreviewImage: Bitmap,     previewBounds: Rect,     viewFinder: Rect): Bitmap

Crop the preview image from the camera based on a square surrounding the view finder's position in the preview bounds.

Link copied to clipboard
fun cropCameraPreviewToViewFinder(    cameraPreviewImage: Bitmap,     previewBounds: Rect,     viewFinder: Rect): Bitmap

Crop the preview image from the camera based on the view finder's position in the preview bounds.

Link copied to clipboard
fun Bitmap.cropCenter(size: Size): Bitmap
Link copied to clipboard
fun Bitmap.cropWithFill(cropRegion: Rect): Bitmap

Crops and image using originalImageRect and places it on finalImageRect, which is filled with gray for the best results

Link copied to clipboard
fun determineViewFinderCrop(    cameraPreviewImageSize: Size,     previewBounds: Rect,     viewFinder: Rect): Rect

Determine how to crop the preview image from the camera based on the view finder's position in the preview bounds.

Link copied to clipboard
fun hasOpenGl31(context: Context): Boolean

Determine if the device supports OpenGL version 3.1.

Link copied to clipboard
fun Bitmap.longerEdge(): Int
Link copied to clipboard
fun Bitmap.rearrangeBySegments(segmentMap: Map<Rect, Rect>): Bitmap

Fragments the Bitmap into multiple segments and places them in new segments.

Link copied to clipboard
fun Bitmap.scale(size: Size, filter: Boolean = false): Bitmap

fun Bitmap.scale(percentage: Float, filter: Boolean = false): Bitmap

Scale a Bitmap by a given percentage.

Link copied to clipboard
fun Bitmap.scaleAndCrop(size: Size, filter: Boolean = false): Bitmap

Scale the Bitmap to circumscribe the given Size, then crop the excess.

Link copied to clipboard
fun Bitmap.shorterEdge(): Int
Link copied to clipboard
fun Bitmap.size(): Size

Get the size of a Bitmap.

Link copied to clipboard
fun Bitmap.toJpeg(quality: Int = 92): ByteArray
Link copied to clipboard
fun Bitmap.toWebP(quality: Int = 92): ByteArray
Link copied to clipboard
fun Bitmap.zoom(    originalRegion: Rect,     newRegion: Rect,     newImageSize: Size): Bitmap

Selects a region from the source Bitmap, resizing that to a new region, and transforms the remainder of the Bitmap into a border. See resizeRegion and rearrangeBySegments.