Class SourceData


  • public class SourceData
    extends Object
    Raw preview data from a camera.
    • Constructor Detail

      • SourceData

        public SourceData​(byte[] data,
                          int dataWidth,
                          int dataHeight,
                          int imageFormat,
                          int rotation)
        Parameters:
        data - the image data
        dataWidth - width of the data
        dataHeight - height of the data
        imageFormat - ImageFormat.NV21 or ImageFormat.YUY2
        rotation - 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
      • getBitmap

        public Bitmap getBitmap​(Rect cropRect,
                                int scaleFactor)