\texttt{cvScalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])
If you are using your own image rendering and I/O functions, you can use any channel ordering, the drawing functions process each channel independently and do not depend on the channel order or even on the color space used. The whole image can be converted from BGR to RGB or to a different color space using
If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also, many drawing functions can handle pixel coordinates specified with sub-pixel accuracy, that is, the coordinates can be passed as fixed-point numbers, encoded as integers. The number of fractional bits is specified by the
``shift``
parameter and the real point coordinates are calculated as
. This feature is especially effective wehn rendering antialiased shapes.
Also, note that the functions do not support alpha-transparency - when the target image is 4-channnel, then the
``color[3]``
is simply copied to the repainted pixels. Thus, if you want to paint semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image.
..cfunction:: void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, int thickness=1, int lineType=8, int shift=0 )
Draws a simple or thick elliptic arc or fills an ellipse sector.
:param img:Image
:param box:The enclosing box of the ellipse drawn
:param thickness:Thickness of the ellipse boundary
:param lineType:Type of the ellipse boundary, see :ref:`Line` description
:param shift:Number of fractional bits in the box vertex coordinates
The function draws a simple or thick ellipse outline, or fills an ellipse. The functions provides a convenient way to draw an ellipse approximating some shape; that is what
:ref:`CamShift`
and
:ref:`FitEllipse`
do. The ellipse drawn is clipped by ROI rectangle. A piecewise-linear approximation is used for antialiased arcs and thick arcs.
..cfunction:: void cvInitFont( CvFont* font, int fontFace, double hscale, double vscale, double shear=0, int thickness=1, int lineType=8 )
Initializes font structure.
:param font:Pointer to the font structure initialized by the function
:param fontFace:Font name identifier. Only a subset of Hershey fonts http://sources.isc.org/utils/misc/hershey-font.txt are supported now:
***CV_FONT_HERSHEY_SIMPLEX** normal size sans-serif font
***CV_FONT_HERSHEY_PLAIN** small size sans-serif font
***CV_FONT_HERSHEY_DUPLEX** normal size sans-serif font (more complex than ``CV_FONT_HERSHEY_SIMPLEX`` )
***CV_FONT_HERSHEY_COMPLEX** normal size serif font
***CV_FONT_HERSHEY_TRIPLEX** normal size serif font (more complex than ``CV_FONT_HERSHEY_COMPLEX`` )
***CV_FONT_HERSHEY_COMPLEX_SMALL** smaller version of ``CV_FONT_HERSHEY_COMPLEX``
***CV_FONT_HERSHEY_SCRIPT_SIMPLEX** hand-writing style font
***CV_FONT_HERSHEY_SCRIPT_COMPLEX** more complex variant of ``CV_FONT_HERSHEY_SCRIPT_SIMPLEX``
The parameter can be composited from one of the values above and an optional ``CV_FONT_ITALIC`` flag, which indicates italic or oblique font.
:param hscale:Horizontal scale. If equal to ``1.0f`` , the characters have the original width depending on the font type. If equal to ``0.5f`` , the characters are of half the original width.
:param vscale:Vertical scale. If equal to ``1.0f`` , the characters have the original height depending on the font type. If equal to ``0.5f`` , the characters are of half the original height.
:param shear:Approximate tangent of the character slope relative to the vertical line. A zero value means a non-italic font, ``1.0f`` means about a 45 degree slope, etc.
:param thickness:Thickness of the text strokes
:param lineType:Type of the strokes, see :ref:`Line` description
The function initializes the font structure that can be passed to text rendering functions.
..cfunction:: void cvPolyLine( CvArr* img, CvPoint** pts, int* npts, int contours, int is_closed, CvScalar color, int thickness=1, int lineType=8, int shift=0 )
Draws simple or thick polygons.
:param pts:Array of pointers to polygons
:param npts:Array of polygon vertex counters
:param contours:Number of contours that bind the filled region
:param img:Image
:param is_closed:Indicates whether the polylines must be drawn
closed. If closed, the function draws the line from the last vertex
of every contour to the first vertex.
:param color:Polyline color
:param thickness:Thickness of the polyline edges
:param lineType:Type of the line segments, see :ref:`Line` description
:param shift:Number of fractional bits in the vertex coordinates
The function draws single or multiple polygonal curves.