libimage  0.25.4
 All Classes Namespaces Files Functions Variables Enumerations Macros Pages
Public Member Functions | Public Attributes | List of all members
Line Class Reference

#include <Line.h>

Collaboration diagram for Line:
Collaboration graph

Public Member Functions

 Line (int width, int samplesize)
 Create a Line, from the width.
template<typename T >
 Line (T *imageIn, uint8_t *maskIn, int srcSpp, int width, T *transparent)
 Create a Line, from the data and transparent value.
template<typename T >
 Line (T *imageIn, uint8_t *maskIn, int srcSpp, int width)
 Create a Line from data.
template<typename T >
void store (T *imageIn, uint8_t *maskIn, int srcSpp, T *transparent)
 Data storage, with transparent value.
template<typename T >
void store (T *imageIn, uint8_t *maskIn, int srcSpp)
 Data storage.
template<typename T >
void write (T *buffer, int outChannels)
 Convert and write the data line.
void alphaBlending (Line *above)
 Merge 2 lines with alpha blending.
void multiply (Line *above)
 Merge 2 lines multiplying.
void useMask (Line *above)
 Merge 2 lines using mask.
virtual ~Line ()
 Default destructor.
template<>
void store (uint8_t *imageIn, uint8_t *maskIn, int srcSpp, uint8_t *transparent)
template<>
void store (uint8_t *imageIn, uint8_t *maskIn, int srcSpp)
template<>
void store (uint16_t *imageIn, uint8_t *maskIn, int srcSpp, uint16_t *transparent)
template<>
void store (uint16_t *imageIn, uint8_t *maskIn, int srcSpp)
template<>
void store (float *imageIn, uint8_t *maskIn, int srcSpp, float *transparent)
template<>
void store (float *imageIn, uint8_t *maskIn, int srcSpp)

Public Attributes

float * samples
 Color's samples, ignoring alpha.
float * alpha
 Alpha values, between 0 and 1.
uint8_t * mask
 Associated mask.
float coeff
 Coefficient to apply, to obtain an alpha between 0 and 1.
int width
 Line's width (pixels' number)

Detailed Description

Author
Institut national de l'information géographique et forestière

Constructor & Destructor Documentation

Line::Line ( int  width,
int  samplesize 
)
inline

Create a Line, from the width.

No data storage, just a memory allocation.

Parameters
[in]widthline's width, in pixel
template<typename T >
Line::Line ( T *  imageIn,
uint8_t *  maskIn,
int  srcSpp,
int  width,
T *  transparent 
)
inline

Create a Line, from the data and transparent value.

Data are stored and pixel containing the transparent value are stored with a null alpha.

Parameters
[in]imageIndata to store
[in]maskInassociated mask
[in]srcSppnumber of samples per pixel in input data
[in]widthline's width, in pixel
[in]transparentpixel's value to consider as transparent

Here is the call graph for this function:

template<typename T >
Line::Line ( T *  imageIn,
uint8_t *  maskIn,
int  srcSpp,
int  width 
)
inline

Create a Line from data.

Parameters
[in]imageIndata to store
[in]maskInassociated mask
[in]srcSppnumber of samples per pixel in input data
[in]widthline's width, in pixel

Here is the call graph for this function:

virtual Line::~Line ( )
inlinevirtual

Default destructor.

Desallocate memory used by the Line object.

Member Function Documentation

void Line::alphaBlending ( Line above)

Merge 2 lines with alpha blending.

Current line is merged with an above line, and result is stored in the current line.

merge_transparency.png
Parameters
[in]aboveabove line, to merge
void Line::multiply ( Line above)

Merge 2 lines multiplying.

Current line is merged with an above line, and result is stored in the current line.

merge_multiply.png
Parameters
[in]aboveabove line, to merge
template<typename T >
void Line::store ( T *  imageIn,
uint8_t *  maskIn,
int  srcSpp,
T *  transparent 
)

Data storage, with transparent value.

Data are stored, converting number of samples per pixel if needed. Alpha is stored as a float between 0 and 1. Pixels whose value is the transparent one are "cancelled" (alpha = 0). This function is a template but is implemented (specified) only for 8-bit integers and floats.

Parameters
[in]imageIndata to store
[in]maskInassociated mask
[in]srcSppnumber of samples per pixel in input data
[in]widthline's width, in pixel
[in]transparentpixel's value to consider as transparent

Here is the caller graph for this function:

template<typename T >
void Line::store ( T *  imageIn,
uint8_t *  maskIn,
int  srcSpp 
)

Data storage.

Data are stored, converting number of samples per pixel if needed. Alpha is stored as a float between 0 and 1. This function is a template but is implemented (specified) only for 8-bit integers and floats.

Parameters
[in]imageIndata to store
[in]maskInassociated mask
[in]srcSppnumber of samples per pixel in input data
[in]widthline's width, in pixel
void Line::useMask ( Line above)

Merge 2 lines using mask.

Current line is merged with an above line, and result is stored in the current line.

merge_mask.png
Parameters
[in]aboveabove line, to merge
template<typename T >
void Line::write ( T *  buffer,
int  outChannels 
)

Convert and write the data line.

This function is a template but is implemented (specified) only for 8-bit integers and floats.

Parameters
[in]buffermemory to write data
[in]outChannelsnumber of samples per pixel in the buffer

Member Data Documentation

float Line::coeff

Coefficient to apply, to obtain an alpha between 0 and 1.

  • 8-bit data -> 255.
  • 32-bit data (float) -> 1.
uint8_t* Line::mask

Associated mask.

  • 0 = nodata
  • 1 -> 255 = data

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