SMIL  0.9.1
Draw Operations
+ Collaboration diagram for Draw Operations:

Functions

std::vector< IntPoint > bresenhamPoints (int p1x, int p1y, int p2x, int p2y, int xMax=0, int yMax=0)
 
template<class T >
RES_T drawLine (Image< T > &im, int x0, int y0, int x1, int y1, T value=ImDtTypes< T >::max())
 Draws a line between two points P0(x0,y0) and P1(x1,y1). More...
 
template<class T >
RES_T drawLine (Image< T > &imOut, vector< UINT > coords, T 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. More...
 
template<class T >
RES_T drawRectangle (Image< T > &imOut, int x0, int y0, size_t width, size_t height, T value=ImDtTypes< T >::max(), bool fill=false, size_t zSlice=0)
 Draw a rectangle. More...
 
template<class T >
RES_T drawRectangle (Image< T > &imOut, vector< UINT > coords, T value=ImDtTypes< T >::max(), bool fill=false)
 
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. More...
 
template<class T >
RES_T drawCircle (Image< T > &imOut, int x0, int y0, int radius, T value=ImDtTypes< T >::max(), size_t zSlice=0)
 Draw a circle. More...
 
template<class T >
RES_T drawSphere (Image< T > &imOut, int x0, int y0, int z0, int radius, T value=ImDtTypes< T >::max())
 Draw a sphere. More...
 
template<class T >
RES_T drawDisc (Image< T > &imOut, int x0, int y0, size_t zSlice, int radius, T value=ImDtTypes< T >::max())
 Draw a disc. More...
 
template<class T >
RES_T drawDisc (Image< T > &imOut, int x0, int y0, int radius, T value=ImDtTypes< T >::max())
 
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, T value=ImDtTypes< T >::max(), bool fill=false)
 Draw a box (3D) More...
 
template<class T >
RES_T drawText (Image< T > &imOut, size_t x, size_t y, size_t z, string txt, string font, UINT size=20, T value=ImDtTypes< T >::max())
 Draw text on image. More...
 
template<class T >
RES_T drawText (Image< T > &imOut, size_t x, size_t y, string txt, string font, UINT size=20, T value=ImDtTypes< T >::max())
 
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. More...
 
template<class T >
RES_T copyPattern (const Image< T > &imIn, int x0, int y0, int width, int height, Image< T > &imOut)
 
template<class T >
RES_T copyPattern (const Image< T > &imIn, Image< T > &imOut, int nbr_along_x, int nbr_along_y)
 
template<class T >
RES_T copyPattern (const Image< T > &imIn, Image< T > &imOut)
 

Detailed Description

Function Documentation

RES_T smil::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:

1 im1 = Image(256,256)
2 im2 = Image(im1)
3 drawDisc(im1, 100,100, 15)
4 copyPattern(im1, 80, 80, 40, 40, im2)
5 im2.show()
RES_T smil::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
RES_T smil::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)
RES_T smil::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)
RES_T smil::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
imModified image
x0,y0Coordinates of the first point
x1,y1Coordinates of the second point
valuePixel value on the line
RES_T smil::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
imOutModified image
coordsVector containing the coordiantes of the two end points (x0, y0, x1, y1)
valuePixel value on the line
RES_T smil::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
imOutOutput image.
x0,y0Coordinates of the first point
widthWidth of the rectangle
heightHeight of the rectangle
valuePixel value on the rectangle
fillFill the rectangle
zSliceSelect the slice (for 3D images)
RES_T smil::drawRectangles ( Image< T > &  imOut,
const map< MapT, vector< size_t > > &  coordsVectMap,
bool  fill = false 
)

Draw a list of rectangles.

RES_T smil::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
RES_T smil::drawText ( Image< T > &  imOut,
size_t  x,
size_t  y,
size_t  z,
string  txt,
string  font,
UINT  size = 20,
value = ImDtTypes<T>::max() 
)

Draw text on image.

Requires the FreeType library