Package com.journeyapps.barcodescanner
Class SourceData
- java.lang.Object
-
- com.journeyapps.barcodescanner.SourceData
-
public class SourceData extends Object
Raw preview data from a camera.
-
-
Constructor Summary
Constructors Constructor Description SourceData(byte[] data, int dataWidth, int dataHeight, int imageFormat, int rotation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.zxing.PlanarYUVLuminanceSourcecreateSource()BitmapgetBitmap()Return the source bitmap (cropped; in display orientation).BitmapgetBitmap(int scaleFactor)Return the source bitmap (cropped; in display orientation).BitmapgetBitmap(Rect cropRect, int scaleFactor)RectgetCropRect()byte[]getData()intgetDataHeight()intgetDataWidth()intgetImageFormat()intgetScalingFactor()booleanisPreviewMirrored()booleanisRotated()voidsetCropRect(Rect cropRect)Set the crop rectangle.voidsetPreviewMirrored(boolean previewMirrored)voidsetScalingFactor(int scalingFactor)com.google.zxing.ResultPointtranslateResultPoint(com.google.zxing.ResultPoint point)
-
-
-
Constructor Detail
-
SourceData
public SourceData(byte[] data, int dataWidth, int dataHeight, int imageFormat, int rotation)- Parameters:
data- the image datadataWidth- width of the datadataHeight- height of the dataimageFormat- ImageFormat.NV21 or ImageFormat.YUY2rotation- camera rotation relative to display rotation, in degrees (0, 90, 180 or 270).
-
-
Method Detail
-
getCropRect
public Rect getCropRect()
-
setCropRect
public void setCropRect(Rect cropRect)
Set the crop rectangle.- Parameters:
cropRect- the new crop rectangle.
-
isPreviewMirrored
public boolean isPreviewMirrored()
-
setPreviewMirrored
public void setPreviewMirrored(boolean previewMirrored)
-
getScalingFactor
public int getScalingFactor()
-
setScalingFactor
public void setScalingFactor(int scalingFactor)
-
getData
public byte[] getData()
-
getDataWidth
public int getDataWidth()
- Returns:
- width of the data
-
getDataHeight
public int getDataHeight()
- Returns:
- height of the data
-
translateResultPoint
public com.google.zxing.ResultPoint translateResultPoint(com.google.zxing.ResultPoint point)
-
isRotated
public boolean isRotated()
- Returns:
- true if the preview image is rotated orthogonal to the display
-
getImageFormat
public int getImageFormat()
-
createSource
public com.google.zxing.PlanarYUVLuminanceSource createSource()
-
getBitmap
public Bitmap getBitmap()
Return the source bitmap (cropped; in display orientation).- Returns:
- the bitmap
-
getBitmap
public Bitmap getBitmap(int scaleFactor)
Return the source bitmap (cropped; in display orientation).- Parameters:
scaleFactor- factor to scale down by. Must be a power of 2.- Returns:
- the bitmap
-
-