zxing-cpp v3.0
Loading...
Searching...
No Matches
ZXing::ImageView Class Reference

#include <ImageView.h>

Inherited by ZXing::Image.

Public Member Functions

 ImageView ()=default
 ImageView (const uint8_t *data, int width, int height, ImageFormat format, int rowStride=0, int pixStride=0)
 ImageView (const uint8_t *data, int size, int width, int height, ImageFormat format, int rowStride=0, int pixStride=0)
int width () const
int height () const
int pixStride () const
int rowStride () const
ImageFormat format () const
const uint8_t * data () const
const uint8_t * data (int x, int y) const
ImageView cropped (int left, int top, int width, int height) const
ImageView rotated (int degree) const
ImageView subsampled (int scale) const

Detailed Description

Simple class that stores a non-owning const pointer to image data plus layout and format information.

Constructor & Destructor Documentation

◆ ImageView() [1/3]

ZXing::ImageView::ImageView ( )
default

ImageView default constructor creates a 'null' image view

◆ ImageView() [2/3]

ZXing::ImageView::ImageView ( const uint8_t * data,
int width,
int height,
ImageFormat format,
int rowStride = 0,
int pixStride = 0 )
inline

ImageView constructor

Parameters
datapointer to image buffer
widthimage width in pixels
heightimage height in pixels
formatimage/pixel format
rowStrideoptional row stride in bytes, default is width * pixStride
pixStrideoptional pixel stride in bytes, default is calculated from format

◆ ImageView() [3/3]

ZXing::ImageView::ImageView ( const uint8_t * data,
int size,
int width,
int height,
ImageFormat format,
int rowStride = 0,
int pixStride = 0 )
inline

ImageView constructor with bounds checking.

This constructor checks if the provided size is consistent with the width, height, row stride and pixel stride parameters to prevent out of bounds access when using the ImageView.

Parameters
datapointer to image buffer
sizesize of the image buffer in bytes
widthimage width in pixels
heightimage height in pixels
formatimage/pixel format
rowStrideoptional row stride in bytes, default is width * pixStride
pixStrideoptional pixel stride in bytes, default is calculated from format

Member Function Documentation

◆ width()

int ZXing::ImageView::width ( ) const
inline

◆ height()

int ZXing::ImageView::height ( ) const
inline

◆ pixStride()

int ZXing::ImageView::pixStride ( ) const
inline

◆ rowStride()

int ZXing::ImageView::rowStride ( ) const
inline

◆ format()

ImageFormat ZXing::ImageView::format ( ) const
inline

◆ data() [1/2]

const uint8_t * ZXing::ImageView::data ( ) const
inline

◆ data() [2/2]

const uint8_t * ZXing::ImageView::data ( int x,
int y ) const
inline

◆ cropped()

ImageView ZXing::ImageView::cropped ( int left,
int top,
int width,
int height ) const
inline

Create a new ImageView that is a cropped version of this one. Negative width/height will be interpreted as "until the end of the line/image".

◆ rotated()

ImageView ZXing::ImageView::rotated ( int degree) const
inline

Create a new ImageView that is a rotated version of this one. Rotation is clockwise and only supports 90 degree steps.

◆ subsampled()

ImageView ZXing::ImageView::subsampled ( int scale) const
inline

Create a new ImageView that is a subsampled version of this one. The subsampled image will have width/height of original divided by scale.


The documentation for this class was generated from the following file: