QBarcode
Loading...
Searching...
No Matches
qbar::Renderer Class Reference

Allow to render a barcode. More...

Inheritance diagram for qbar::Renderer:

Public Member Functions

 Renderer (Renderer &&other) noexcept
 
Rendereroperator= (Renderer &&) noexcept
 
QSize getSizeRequested () const
 Retrieve requested size.
 
QMargins getMargins () const
 Retrieve margins.
 
QColor getColorBackground () const
 Retrieve color background.
 
QColor getColorForeground () const
 Retrieve color foreground.
 
void setSizeRequested (const QSize &size)
 Allow to set requested size.
 
void setMargins (const QMargins &margins)
 Allow to set margins to use.
 
void setColorBackground (const QColor &color)
 Allow to set background color.
 
void setColorForeground (const QColor &color)
 Allow to set foreground color.
 
QImage toImage (const Barcode &barcode)
 Use to render a barcode to an image.
 

Detailed Description

Allow to render a barcode.

This class allow to share common properties/methods accross all renderer types.
A render entity represent how a barcode should "look", so only one renderer is generally used but can render multiples barcodes.
Each types of barcode can have their specific appearance customization, so each type will have a dedicated renderer.

Member Function Documentation

◆ getSizeRequested()

QSize qbar::Renderer::getSizeRequested ( ) const

Retrieve requested size.

Returns
Returns barcode requested size in pixels.
See also
setSizeRequested()
getMargins(), setMargins()

◆ getMargins()

QMargins qbar::Renderer::getMargins ( ) const

Retrieve margins.

Returns
Returns barcode margins in pixels to use.
See also
setMargins()
getSizeRequested(), setSizeRequested()

◆ getColorBackground()

QColor qbar::Renderer::getColorBackground ( ) const

Retrieve color background.

Returns
Returns barcode background color to use.
See also
setColorBackground()
getColorForeground(), setColorForeground()

◆ getColorForeground()

QColor qbar::Renderer::getColorForeground ( ) const

Retrieve color foreground.

Returns
Returns barcode foreground color to use.
See also
setColorForeground()
getColorBackground(), setColorBackground()

◆ setSizeRequested()

void qbar::Renderer::setSizeRequested ( const QSize & size)

Allow to set requested size.

"Requested size" means that we will try to render barcode at this requested size.
But that is not always possible since it will depends of multiple factors:

Parameters
[in]sizeRequested size in pixels.
See also
getSizeRequested()
setMargins(), getMargins()

◆ setMargins()

void qbar::Renderer::setMargins ( const QMargins & margins)

Allow to set margins to use.

Parameters
[in]marginsMargins to use in pixels.
See also
getMargins()
setSizeRequested(), getSizeRequested()

◆ setColorBackground()

void qbar::Renderer::setColorBackground ( const QColor & color)

Allow to set background color.

Parameters
[in]colorBackground color to use.
See also
getColorBackground()
setColorForeground(), getColorForeground()

◆ setColorForeground()

void qbar::Renderer::setColorForeground ( const QColor & color)

Allow to set foreground color.

Parameters
[in]colorforeground color to use.
See also
getColorForeground()
setColorBackground(), getColorBackground()

◆ toImage()

QImage qbar::Renderer::toImage ( const Barcode & barcode)

Use to render a barcode to an image.

Parameters
[in]barcodeBarcode to render.
Returns
Returns image rendered of the barcode.
It can be invalid, verify it via isNull() before using it.

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