SMIL 1.1.2
Loading...
Searching...
No Matches
Draw Operations

Detailed Description

+ Collaboration diagram for Draw Operations:

Classes

class  Bresenham
 Bresenham Class. More...
 

Functions

vector< IntPointbresenhamPoints (int p1x, int p1y, int p2x, int p2y, int xMax=0, int yMax=0)
 Find intermediate points forming a line between two end points, using the Bresenham Line Draw Algorithm.
 
vector< IntPointbresenhamLine (int p1x, int p1y, int p2x, int p2y)
 Find intermediate points forming a line between two end points, using the Bresenham Line Draw Algorithm.
 

Function Documentation

◆ bresenhamPoints()

vector< IntPoint > bresenhamPoints ( int  p1x,
int  p1y,
int  p2x,
int  p2y,
int  xMax = 0,
int  yMax = 0 
)
inline

Find intermediate points forming a line between two end points, using the Bresenham Line Draw Algorithm.

Parameters
[in](p1x,p1y),(p2x,p2y): end points
[in]xMax,yMax: maximum values of X and y
Returns
vector with the intermediate points between extreme points.
Note
  • 2D only
See also

◆ bresenhamLine()

std::vector< IntPoint > bresenhamLine ( int  p1x,
int  p1y,
int  p2x,
int  p2y 
)

Find intermediate points forming a line between two end points, using the Bresenham Line Draw Algorithm.

Parameters
[in](p1x,p1y),(p2x,p2y): end points
Returns
vector with intermediate points between extreme points
Note
  • 2D only
See also

◆ drawLine() [1/2]

template<class T >
RES_T drawLine ( Image< T > &  im,
int  x0,
int  y0,
int  x1,
int  y1,
value = ImDtTypes<T>::max() 
)

Draws a line between two points P0(x0,y0) and P1(x1,y1).

This function is based on the Bresenham's line algorithm. (works only on 2D images)

Parameters
[in,out]im: Modified image
[in]x0,y0: Coordinates of the first point
[in]x1,y1: Coordinates of the second point
[in]value: value to set pixels in the line

◆ drawLine() [2/2]

template<class T >
RES_T drawLine ( Image< T > &  imOut,
vector< UINT >  coords,
value = ImDtTypes<T>::max() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Draw line from vector

Parameters
[in,out]imOut: Modified image
[in]coords: Vector containing the coordiantes of the two end points (x0, y0, x1, y1)
[in]value: value to set pixels in the line

◆ drawRectangle() [1/2]

template<class T >
RES_T drawRectangle ( Image< T > &  imOut,
int  x0,
int  y0,
size_t  width,
size_t  height,
value = ImDtTypes<T>::max(),
bool  fill = false,
size_t  zSlice = 0 
)

Draw a rectangle.

Parameters
[in,out]imOut: Output image.
[in]x0,y0: Coordinates of the first point
[in]width: Width of the rectangle
[in]height: Height of the rectangle
[in]value: value to set pixels in the rectangle
[in]fill: Fill the rectangle
[in]zSlice: Select the slice (for 3D images)

◆ drawRectangle() [2/2]

template<class T >
RES_T drawRectangle ( Image< T > &  imOut,
vector< UINT >  coords,
value = ImDtTypes<T>::max(),
bool  fill = false 
)

Draw a rectangle.

As drawRectangle but with a vector parameter to define all coordinates of rectangles.

Parameters
[in,out]imOut: Output image.
[in]coords: A vector with the coordinates of the rectangle
[in]value: value to set pixels in the rectangle
[in]fill: Fill the rectangle
Note
The order of coordinates in the vector parameter coords is x0, y0, x1, y1

◆ drawRectangles()

template<class T , class MapT >
RES_T drawRectangles ( Image< T > &  imOut,
const map< MapT, vector< size_t > > &  coordsVectMap,
bool  fill = false 
)

Draw a list of rectangles.

Parameters
[in,out]imOut: output image
[in]coordsVectMap: a map defining rectangles to draw
[in]fill: fill rectangles
Note
coordsVectMap is a map with a pair for each rectangle :
  • the key is val a value to set pixels in the rectangle
  • the value is a vector with the coordinates of the rectangle (x0, y0, x1, y1)

◆ drawCircle()

template<class T >
RES_T drawCircle ( Image< T > &  imOut,
int  x0,
int  y0,
int  radius,
value = ImDtTypes<T>::max(),
size_t  zSlice = 0 
)

Draw a circle.

Bressenham's Midpoint Circle algoritm

See also
drawDisc
Parameters
imOutOutput image.
x0,y0Coordinates of the center
radiusRadius of the circle
valuePixel value on the circle
zSliceSelect the slice (for 3D images)

◆ drawSphere()

template<class T >
RES_T drawSphere ( Image< T > &  imOut,
int  x0,
int  y0,
int  z0,
int  radius,
value = ImDtTypes<T>::max() 
)

Draw a sphere.

Parameters
imOutOutput image.
x0,y0,z0Coordinates of the center
radiusRadius of the circle
valuePixel value on the sphere

◆ drawDisc()

template<class T >
RES_T drawDisc ( Image< T > &  imOut,
int  x0,
int  y0,
size_t  zSlice,
int  radius,
value = ImDtTypes<T>::max() 
)

Draw a disc.

See also
drawCircle
Parameters
imOutOutput image.
x0,y0Coordinates of the center
radiusRadius of the circle
valuePixel value on the circle
zSliceSelect the slice (for 3D images)

◆ drawBox()

template<class T >
RES_T drawBox ( Image< T > &  imOut,
size_t  x0,
size_t  y0,
size_t  z0,
size_t  width,
size_t  height,
size_t  depth,
value = ImDtTypes<T>::max(),
bool  fill = false 
)

Draw a box (3D)

Parameters
imOutOutput image.
x0,y0,z0Coordinates of the first point
width,height,depthDimensions of the box
valuePixel value on the box
fillFill the box

◆ copyPattern()

template<class T >
RES_T copyPattern ( const Image< T > &  imIn,
int  x0,
int  y0,
int  width,
int  height,
Image< T > &  imOut,
int  nbr_along_x,
int  nbr_along_y 
)

Copy a given pattern (zone of input image) several times in an output image.

Only 2D for now.

If nbr_along_x and int nbr_along_y are not specified, fill completely the output image with a maximum number of parterns. If x0, y0, width and height are not specified, the full image imIn will be copied.

Python example:

im1 = Image(256,256)
im2 = Image(im1)
drawDisc(im1, 100,100, 15)
copyPattern(im1, 80, 80, 40, 40, im2)
im2.show()