|
Packit Service |
e3b512 |
/* Copyright (C) 2005 The cairomm Development Team
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
e3b512 |
* modify it under the terms of the GNU Library General Public
|
|
Packit Service |
e3b512 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
e3b512 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
e3b512 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
e3b512 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
e3b512 |
* Library General Public License for more details.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* You should have received a copy of the GNU Library General Public
|
|
Packit Service |
e3b512 |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
e3b512 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
e3b512 |
* 02110-1301, USA.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifndef __CAIROMM_CONTEXT_H
|
|
Packit Service |
e3b512 |
#define __CAIROMM_CONTEXT_H
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#include <vector>
|
|
Packit Service |
e3b512 |
#include <utility>
|
|
Packit Service |
e3b512 |
#include <cairomm/surface.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/fontface.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/matrix.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/pattern.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/path.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/scaledfont.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/types.h>
|
|
Packit Service |
e3b512 |
#include <valarray>
|
|
Packit Service |
e3b512 |
#include <vector>
|
|
Packit Service |
e3b512 |
#include <cairo.h>
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
namespace Cairo
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Context is the main class used to draw in cairomm. It contains the current
|
|
Packit Service |
e3b512 |
* state of the rendering device, including coordinates of yet to be drawn
|
|
Packit Service |
e3b512 |
* shapes.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* In the simplest case, create a Context with its target Surface, set its
|
|
Packit Service |
e3b512 |
* drawing options (line width, color, etc), create shapes with methods like
|
|
Packit Service |
e3b512 |
* move_to() and line_to(), and then draw the shapes to the Surface using
|
|
Packit Service |
e3b512 |
* methods such as stroke() or fill().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Context is a reference-counted object that should be used via Cairo::RefPtr.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
class Context
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
protected:
|
|
Packit Service |
e3b512 |
explicit Context(const RefPtr<Surface>& target);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
public:
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Create a C++ wrapper for the C instance. This C++ instance should then be
|
|
Packit Service |
e3b512 |
* given to a RefPtr.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param cobject The C instance.
|
|
Packit Service |
e3b512 |
* @param has_reference Whether we already have a reference. Otherwise, the
|
|
Packit Service |
e3b512 |
* constructor will take an extra reference.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
explicit Context(cairo_t* cobject, bool has_reference = false);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
Context(const Context&) = delete;
|
|
Packit Service |
e3b512 |
Context& operator=(const Context&) = delete;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
static RefPtr<Context> create(const RefPtr<Surface>& target);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
virtual ~Context();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Makes a copy of the current state of the Context and saves it on an
|
|
Packit Service |
e3b512 |
* internal stack of saved states. When restore() is called, it will be
|
|
Packit Service |
e3b512 |
* restored to the saved state. Multiple calls to save() and restore() can be
|
|
Packit Service |
e3b512 |
* nested; each call to restore() restores the state from the matching paired
|
|
Packit Service |
e3b512 |
* save().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It isn't necessary to clear all saved states before a cairo_t is freed.
|
|
Packit Service |
e3b512 |
* Any saved states will be freed when the Context is destroyed.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa restore()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void save();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Restores cr to the state saved by a preceding call to save() and removes
|
|
Packit Service |
e3b512 |
* that state from the stack of saved states.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa save()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void restore();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the compositing operator to be used for all drawing operations. See
|
|
Packit Service |
e3b512 |
* Operator for details on the semantics of each available compositing
|
|
Packit Service |
e3b512 |
* operator.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param op a compositing operator, specified as a Operator
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_operator(Operator op);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the source pattern within the Context to source. This Pattern will
|
|
Packit Service |
e3b512 |
* then be used for any subsequent drawing operation until a new source
|
|
Packit Service |
e3b512 |
* pattern is set.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: The Pattern's transformation matrix will be locked to the user space
|
|
Packit Service |
e3b512 |
* in effect at the time of set_source(). This means that further
|
|
Packit Service |
e3b512 |
* modifications of the current transformation matrix will not affect the
|
|
Packit Service |
e3b512 |
* source pattern.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param source a Pattern to be used as the source for subsequent drawing
|
|
Packit Service |
e3b512 |
* operations.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa Pattern::set_matrix()
|
|
Packit Service |
e3b512 |
* @sa set_source_rgb()
|
|
Packit Service |
e3b512 |
* @sa set_source_rgba()
|
|
Packit Service |
e3b512 |
* @sa set_source(const RefPtr<Surface>& surface, double x, double y)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_source(const RefPtr<const Pattern>& source);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the source pattern within the Context to an opaque color. This
|
|
Packit Service |
e3b512 |
* opaque color will then be used for any subsequent drawing operation until
|
|
Packit Service |
e3b512 |
* a new source pattern is set.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The color components are floating point numbers in the range 0 to 1. If
|
|
Packit Service |
e3b512 |
* the values passed in are outside that range, they will be clamped.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param red red component of color
|
|
Packit Service |
e3b512 |
* @param green green component of color
|
|
Packit Service |
e3b512 |
* @param blue blue component of color
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_source_rgba()
|
|
Packit Service |
e3b512 |
* @sa set_source()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_source_rgb(double red, double green, double blue);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the source pattern within the Context to a translucent color. This
|
|
Packit Service |
e3b512 |
* color will then be used for any subsequent drawing operation until a new
|
|
Packit Service |
e3b512 |
* source pattern is set.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The color and alpha components are floating point numbers in the range 0
|
|
Packit Service |
e3b512 |
* to 1. If the values passed in are outside that range, they will be
|
|
Packit Service |
e3b512 |
* clamped.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param red red component of color
|
|
Packit Service |
e3b512 |
* @param green green component of color
|
|
Packit Service |
e3b512 |
* @param blue blue component of color
|
|
Packit Service |
e3b512 |
* @param alpha alpha component of color
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_source_rgb()
|
|
Packit Service |
e3b512 |
* @sa set_source()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_source_rgba(double red, double green, double blue, double alpha);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** This is a convenience function for creating a pattern from a Surface and
|
|
Packit Service |
e3b512 |
* setting it as the source
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The x and y parameters give the user-space coordinate at which the Surface
|
|
Packit Service |
e3b512 |
* origin should appear. (The Surface origin is its upper-left corner before
|
|
Packit Service |
e3b512 |
* any transformation has been applied.) The x and y patterns are negated and
|
|
Packit Service |
e3b512 |
* then set as translation values in the pattern matrix.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Other than the initial translation pattern matrix, as described above, all
|
|
Packit Service |
e3b512 |
* other pattern attributes, (such as its extend mode), are set to the
|
|
Packit Service |
e3b512 |
* default values as in Context::create(const RefPtr<Surface>& target). The
|
|
Packit Service |
e3b512 |
* resulting pattern can be queried with get_source() so that these
|
|
Packit Service |
e3b512 |
* attributes can be modified if desired, (eg. to create a repeating pattern
|
|
Packit Service |
e3b512 |
* with Pattern::set_extend()).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param surface a Surface to be used to set the source pattern
|
|
Packit Service |
e3b512 |
* @param x User-space X coordinate for surface origin
|
|
Packit Service |
e3b512 |
* @param y User-space Y coordinate for surface origin
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_source(const RefPtr<Surface>& surface, double x, double y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the tolerance used when converting paths into trapezoids. Curved
|
|
Packit Service |
e3b512 |
* segments of the path will be subdivided until the maximum deviation
|
|
Packit Service |
e3b512 |
* between the original path and the polygonal approximation is less than
|
|
Packit Service |
e3b512 |
* tolerance. The default value is 0.1. A larger value will give better
|
|
Packit Service |
e3b512 |
* performance, a smaller value, better appearance. (Reducing the value from
|
|
Packit Service |
e3b512 |
* the default value of 0.1 is unlikely to improve appearance significantly.)
|
|
Packit Service |
e3b512 |
* The accuracy of paths within Cairo is limited by the precision of its
|
|
Packit Service |
e3b512 |
* internal arithmetic, and the prescribed @tolerance is restricted to the
|
|
Packit Service |
e3b512 |
* smallest representable internal value.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param tolerance the tolerance, in device units (typically pixels)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_tolerance(double tolerance);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Set the antialiasing mode of the rasterizer used for drawing shapes. This
|
|
Packit Service |
e3b512 |
* value is a hint, and a particular backend may or may not support a
|
|
Packit Service |
e3b512 |
* particular value. At the current time, no backend supports
|
|
Packit Service |
e3b512 |
* Cairo::ANTIALIAS_SUBPIXEL when drawing shapes.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that this option does not affect text rendering, instead see
|
|
Packit Service |
e3b512 |
* FontOptions::set_antialias().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param antialias the new antialiasing mode
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_antialias(Antialias antialias);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Set the current fill rule within the cairo Context. The fill rule is used
|
|
Packit Service |
e3b512 |
* to determine which regions are inside or outside a complex (potentially
|
|
Packit Service |
e3b512 |
* self-intersecting) path. The current fill rule affects both fill() and
|
|
Packit Service |
e3b512 |
* clip(). See FillRule for details on the semantics of each available fill
|
|
Packit Service |
e3b512 |
* rule.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The default fill rule is Cairo::FILL_RULE_WINDING.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param fill_rule a fill rule, specified as a FillRule
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_fill_rule(FillRule fill_rule);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the current line width within the cairo Context. The line width
|
|
Packit Service |
e3b512 |
* specifies the diameter of a pen that is circular in user-space, (though
|
|
Packit Service |
e3b512 |
* device-space pen may be an ellipse in general due to scaling/shear/rotation
|
|
Packit Service |
e3b512 |
* of the CTM).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: When the description above refers to user space and CTM it refers to
|
|
Packit Service |
e3b512 |
* the user space and CTM in effect at the time of the stroking operation,
|
|
Packit Service |
e3b512 |
* not the user space and CTM in effect at the time of the call to
|
|
Packit Service |
e3b512 |
* set_line_width(). The simplest usage makes both of these spaces
|
|
Packit Service |
e3b512 |
* identical. That is, if there is no change to the CTM between a call to
|
|
Packit Service |
e3b512 |
* set_line_width() and the stroking operation, then one can just pass
|
|
Packit Service |
e3b512 |
* user-space values to set_line_width() and ignore this note.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* As with the other stroke parameters, the current line cap style is
|
|
Packit Service |
e3b512 |
* examined by stroke(), stroke_extents(), and stroke_to_path(), but does not
|
|
Packit Service |
e3b512 |
* have any effect during path construction.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The default line width value is 2.0.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param width a line width, as a user-space value
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_line_width(double width);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the current line cap style within the cairo Context. See
|
|
Packit Service |
e3b512 |
* LineCap for details about how the available line cap styles are drawn.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* As with the other stroke parameters, the current line cap style is
|
|
Packit Service |
e3b512 |
* examined by stroke(), stroke_extents(), and stroke_to_path(), but does not
|
|
Packit Service |
e3b512 |
* have any effect during path construction.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The default line cap style is Cairo::LINE_CAP_BUTT.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param line_cap a line cap style, as a LineCap
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_line_cap(LineCap line_cap);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the current line join style within the cairo Context. See LineJoin
|
|
Packit Service |
e3b512 |
* for details about how the available line join styles are drawn.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* As with the other stroke parameters, the current line join style is
|
|
Packit Service |
e3b512 |
* examined by stroke(), stroke_extents(), and stroke_to_path(), but does not
|
|
Packit Service |
e3b512 |
* have any effect during path construction.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The default line join style is Cairo::LINE_JOIN_MITER.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param line_join a line joint style, as a LineJoin
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_line_join(LineJoin line_join);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifndef CAIROMM_DISABLE_DEPRECATED
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Alternate version of set_dash(). You'll probably want to use the one that
|
|
Packit Service |
e3b512 |
* takes a std::vector argument instead.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Instead use the version that takes a const dashes parameter.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_dash(std::valarray<double>& dashes, double offset);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the dash pattern to be used by stroke(). A dash pattern is specified
|
|
Packit Service |
e3b512 |
* by dashes, an array of positive values. Each value provides the user-space
|
|
Packit Service |
e3b512 |
* length of altenate "on" and "off" portions of the stroke. The offset
|
|
Packit Service |
e3b512 |
* specifies an offset into the pattern at which the stroke begins.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If dashes is empty dashing is disabled. If the size of dashes is 1, a
|
|
Packit Service |
e3b512 |
* symmetric pattern is assumed with alternating on and off portions of the
|
|
Packit Service |
e3b512 |
* size specified by the single value in dashes.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is invalid for any value in dashes to be negative, or for all values to
|
|
Packit Service |
e3b512 |
* be 0. If this is the case, an exception will be thrown
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dashes an array specifying alternate lengths of on and off portions
|
|
Packit Service |
e3b512 |
* @param offset an offset into the dash pattern at which the stroke should start
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @exception
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Instead use the version that takes a const dashes parameter.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_dash(std::vector<double>& dashes, double offset);
|
|
Packit Service |
e3b512 |
#endif //CAIROMM_DISABLE_DEPRECATED
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Alternate version of set_dash(). You'll probably want to use the one that
|
|
Packit Service |
e3b512 |
* takes a std::vector argument instead.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_dash(const std::valarray<double>& dashes, double offset);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Sets the dash pattern to be used by stroke(). A dash pattern is specified
|
|
Packit Service |
e3b512 |
* by dashes, an array of positive values. Each value provides the user-space
|
|
Packit Service |
e3b512 |
* length of altenate "on" and "off" portions of the stroke. The offset
|
|
Packit Service |
e3b512 |
* specifies an offset into the pattern at which the stroke begins.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Each "on" segment will have caps applied as if the segment were a separate
|
|
Packit Service |
e3b512 |
* sub-path. In particular, it is valid to use an "on" length of 0.0 with
|
|
Packit Service |
e3b512 |
* Cairo::LINE_CAP_ROUND or Cairo::LINE_CAP_SQUARE in order to distributed
|
|
Packit Service |
e3b512 |
* dots or squares along a path.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: The length values are in user-space units as evaluated at the time
|
|
Packit Service |
e3b512 |
* of stroking. This is not necessarily the same as the user space at the
|
|
Packit Service |
e3b512 |
* time of set_dash().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If dashes is empty dashing is disabled. If the size of dashes is 1, a
|
|
Packit Service |
e3b512 |
* symmetric pattern is assumed with alternating on and off portions of the
|
|
Packit Service |
e3b512 |
* size specified by the single value in dashes.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is invalid for any value in dashes to be negative, or for all values to
|
|
Packit Service |
e3b512 |
* be 0. If this is the case, an exception will be thrown
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dashes an array specifying alternate lengths of on and off portions
|
|
Packit Service |
e3b512 |
* @param offset an offset into the dash pattern at which the stroke should start
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @exception
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_dash(const std::vector<double>& dashes, double offset);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** This function disables a dash pattern that was set with set_dash()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void unset_dash();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Sets the current miter limit within the cairo context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If the current line join style is set to Cairo::LINE_JOIN_MITER (see
|
|
Packit Service |
e3b512 |
* set_line_join()), the miter limit is used to determine whether the lines
|
|
Packit Service |
e3b512 |
* should be joined with a bevel instead of a miter. Cairo divides the length
|
|
Packit Service |
e3b512 |
* of the miter by the line width. If the result is greater than the miter
|
|
Packit Service |
e3b512 |
* limit, the style is converted to a bevel.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* As with the other stroke parameters, the current line miter limit is
|
|
Packit Service |
e3b512 |
* examined by stroke(), stroke_extents(), and stroke_to_path(), but does not
|
|
Packit Service |
e3b512 |
* have any effect during path construction.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The default miter limit value is 10.0, which will convert joins with
|
|
Packit Service |
e3b512 |
* interior angles less than 11 degrees to bevels instead of miters. For
|
|
Packit Service |
e3b512 |
* reference, a miter limit of 2.0 makes the miter cutoff at 60 degrees, and
|
|
Packit Service |
e3b512 |
* a miter limit of 1.414 makes the cutoff at 90 degrees.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* A miter limit for a desired angle can be computed as: miter_limit =
|
|
Packit Service |
e3b512 |
* 1/sin(angle/2)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param limit miter limit to set
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void set_miter_limit(double limit);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Modifies the current transformation matrix (CTM) by translating the
|
|
Packit Service |
e3b512 |
* user-space origin by (tx, ty). This offset is interpreted as a user-space
|
|
Packit Service |
e3b512 |
* coordinate according to the CTM in place before the new call to
|
|
Packit Service |
e3b512 |
* translate. In other words, the translation of the user-space origin
|
|
Packit Service |
e3b512 |
* takes place after any existing transformation.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param tx amount to translate in the X direction
|
|
Packit Service |
e3b512 |
* @param ty amount to translate in the Y direction
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void translate(double tx, double ty);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Modifies the current transformation matrix (CTM) by scaling the X and Y
|
|
Packit Service |
e3b512 |
* user-space axes by sx and sy respectively. The scaling of the axes takes
|
|
Packit Service |
e3b512 |
* place after any existing transformation of user space.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param sx scale factor for the X dimension
|
|
Packit Service |
e3b512 |
* @param sy scale factor for the Y dimension
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void scale(double sx, double sy);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Modifies the current transformation matrix (CTM) by rotating the
|
|
Packit Service |
e3b512 |
* user-space axes by angle radians. The rotation of the axes takes places
|
|
Packit Service |
e3b512 |
* after any existing transformation of user space. The rotation direction
|
|
Packit Service |
e3b512 |
* for positive angles is from the positive X axis toward the positive Y
|
|
Packit Service |
e3b512 |
* axis.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param angle angle (in radians) by which the user-space axes will be
|
|
Packit Service |
e3b512 |
* rotated
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rotate(double angle_radians);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A convenience wrapper around rotate() that accepts angles in degrees
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param angle_degrees angle (in degrees) by which the user-space axes
|
|
Packit Service |
e3b512 |
* should be rotated
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rotate_degrees(double angle_degres);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Modifies the current transformation matrix (CTM) by applying matrix as an
|
|
Packit Service |
e3b512 |
* additional transformation. The new transformation of user space takes
|
|
Packit Service |
e3b512 |
* place after any existing transformation.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param matrix a transformation to be applied to the user-space axes
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void transform(const Matrix& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/* To keep 1.6.x ABI */
|
|
Packit Service |
e3b512 |
void transform(const cairo_matrix_t& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Modifies the current transformation matrix (CTM) by setting it equal to
|
|
Packit Service |
e3b512 |
* matrix.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param matrix a transformation matrix from user space to device space
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_matrix(const Matrix& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/* To keep 1.6.x ABI */
|
|
Packit Service |
e3b512 |
void set_matrix(const cairo_matrix_t& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Resets the current transformation matrix (CTM) by setting it equal to the
|
|
Packit Service |
e3b512 |
* identity matrix. That is, the user-space and device-space axes will be
|
|
Packit Service |
e3b512 |
* aligned and one user-space unit will transform to one device-space unit.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_identity_matrix();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifndef CAIROMM_DISABLE_DEPRECATED
|
|
Packit Service |
e3b512 |
/** Transform a coordinate from user space to device space by multiplying the
|
|
Packit Service |
e3b512 |
* given point by the current transformation matrix (CTM).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param y Y value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Use the const version.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void user_to_device(double& x, double& y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a distance vector from user space to device space. This
|
|
Packit Service |
e3b512 |
* function is similar to user_to_device() except that the translation
|
|
Packit Service |
e3b512 |
* components of the CTM will be ignored when transforming (dx,dy).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx X component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param dy Y component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Use the const version.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void user_to_device_distance(double& dx, double& dy);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a coordinate from device space to user space by multiplying the
|
|
Packit Service |
e3b512 |
* given point by the inverse of the current transformation matrix (CTM).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param y Y value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Use the const version.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void device_to_user(double& x, double& y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a distance vector from device space to user space. This
|
|
Packit Service |
e3b512 |
* function is similar to device_to_user() except that the translation
|
|
Packit Service |
e3b512 |
* components of the inverse CTM will be ignored when transforming (dx,dy).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx X component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param dy Y component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @deprecated Use the const version.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void device_to_user_distance(double& dx, double& dy);
|
|
Packit Service |
e3b512 |
#endif //CAIROMM_DISABLE_DEPRECATED
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a coordinate from user space to device space by multiplying the
|
|
Packit Service |
e3b512 |
* given point by the current transformation matrix (CTM).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param y Y value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void user_to_device(double& x, double& y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a distance vector from user space to device space. This
|
|
Packit Service |
e3b512 |
* function is similar to user_to_device() except that the translation
|
|
Packit Service |
e3b512 |
* components of the CTM will be ignored when transforming (dx,dy).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx X component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param dy Y component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void user_to_device_distance(double& dx, double& dy) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a coordinate from device space to user space by multiplying the
|
|
Packit Service |
e3b512 |
* given point by the inverse of the current transformation matrix (CTM).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param y Y value of coordinate (in/out parameter)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void device_to_user(double& x, double& y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Transform a distance vector from device space to user space. This
|
|
Packit Service |
e3b512 |
* function is similar to device_to_user() except that the translation
|
|
Packit Service |
e3b512 |
* components of the inverse CTM will be ignored when transforming (dx,dy).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx X component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
* @param dy Y component of a distance vector (in/out parameter)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void device_to_user_distance(double& dx, double& dy) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Clears the current path. After this call there will be no current point.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void begin_new_path();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Begin a new subpath. Note that the existing path is not affected. After
|
|
Packit Service |
e3b512 |
* this call there will be no current point.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* In many cases, this call is not needed since new subpaths are frequently
|
|
Packit Service |
e3b512 |
* started with move_to().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* A call to begin_new_sub_path() is particularly useful when beginning a new
|
|
Packit Service |
e3b512 |
* subpath with one of the arc() calls. This makes things easier as it is no
|
|
Packit Service |
e3b512 |
* longer necessary to manually compute the arc's initial coordinates for a
|
|
Packit Service |
e3b512 |
* call to move_to().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void begin_new_sub_path();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** If the current subpath is not empty, begin a new subpath. After this call
|
|
Packit Service |
e3b512 |
* the current point will be (x, y).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x the X coordinate of the new position
|
|
Packit Service |
e3b512 |
* @param y the Y coordinate of the new position
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void move_to(double x, double y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a line to the path from the current point to position (x, y) in
|
|
Packit Service |
e3b512 |
* user-space coordinates. After this call the current point will be (x, y).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If there is no current point before the call to line_to()
|
|
Packit Service |
e3b512 |
* this function will behave as move_to(x, y).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x the X coordinate of the end of the new line
|
|
Packit Service |
e3b512 |
* @param y the Y coordinate of the end of the new line
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void line_to(double x, double y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a cubic Bezier spline to the path from the current point to position
|
|
Packit Service |
e3b512 |
* (x3, y3) in user-space coordinates, using (x1, y1) and (x2, y2) as the
|
|
Packit Service |
e3b512 |
* control points. After this call the current point will be (x3, y3).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If there is no current point before the call to curve_to()
|
|
Packit Service |
e3b512 |
* this function will behave as if preceded by a call to
|
|
Packit Service |
e3b512 |
* move_to(x1, y1).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x1 the X coordinate of the first control point
|
|
Packit Service |
e3b512 |
* @param y1 the Y coordinate of the first control point
|
|
Packit Service |
e3b512 |
* @param x2 the X coordinate of the second control point
|
|
Packit Service |
e3b512 |
* @param y2 the Y coordinate of the second control point
|
|
Packit Service |
e3b512 |
* @param x3 the X coordinate of the end of the curve
|
|
Packit Service |
e3b512 |
* @param y3 the Y coordinate of the end of the curve
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void curve_to(double x1, double y1, double x2, double y2, double x3, double y3);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a circular arc of the given radius to the current path. The arc is
|
|
Packit Service |
e3b512 |
* centered at (@a xc, @a yc), begins at @a angle1 and proceeds in the direction of
|
|
Packit Service |
e3b512 |
* increasing angles to end at @a angle2. If @a angle2 is less than @a angle1 it will
|
|
Packit Service |
e3b512 |
* be progressively increased by 2*M_PI until it is greater than @a angle1.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If there is a current point, an initial line segment will be added to the
|
|
Packit Service |
e3b512 |
* path to connect the current point to the beginning of the arc. If this
|
|
Packit Service |
e3b512 |
* initial line is undesired, it can be avoided by calling
|
|
Packit Service |
e3b512 |
* begin_new_sub_path() before calling arc().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Angles are measured in radians. An angle of 0 is in the direction of the
|
|
Packit Service |
e3b512 |
* positive X axis (in user-space). An angle of M_PI/2.0 radians (90 degrees) is
|
|
Packit Service |
e3b512 |
* in the direction of the positive Y axis (in user-space). Angles increase
|
|
Packit Service |
e3b512 |
* in the direction from the positive X axis toward the positive Y axis. So
|
|
Packit Service |
e3b512 |
* with the default transformation matrix, angles increase in a clockwise
|
|
Packit Service |
e3b512 |
* direction.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* ( To convert from degrees to radians, use degrees * (M_PI / 180.0). )
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function gives the arc in the direction of increasing angles; see
|
|
Packit Service |
e3b512 |
* arc_negative() to get the arc in the direction of decreasing angles.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The arc is circular in user-space. To achieve an elliptical arc, you can
|
|
Packit Service |
e3b512 |
* scale the current transformation matrix by different amounts in the X and
|
|
Packit Service |
e3b512 |
* Y directions. For example, to draw an ellipse in the box given by x, y,
|
|
Packit Service |
e3b512 |
* width, height:
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* context->save();
|
|
Packit Service |
e3b512 |
* context->translate(x, y);
|
|
Packit Service |
e3b512 |
* context->scale(width / 2.0, height / 2.0);
|
|
Packit Service |
e3b512 |
* context->arc(0.0, 0.0, 1.0, 0.0, 2 * M_PI);
|
|
Packit Service |
e3b512 |
* context->restore();
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param xc X position of the center of the arc
|
|
Packit Service |
e3b512 |
* @param yc Y position of the center of the arc
|
|
Packit Service |
e3b512 |
* @param radius the radius of the arc
|
|
Packit Service |
e3b512 |
* @param angle1 the start angle, in radians
|
|
Packit Service |
e3b512 |
* @param angle2 the end angle, in radians
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void arc(double xc, double yc, double radius, double angle1, double angle2);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a circular arc of the given @a radius to the current path. The arc is
|
|
Packit Service |
e3b512 |
* centered at (@a xc, @a yc), begins at @a angle1 and proceeds in the direction of
|
|
Packit Service |
e3b512 |
* decreasing angles to end at @a angle2. If @a angle2 is greater than @a angle1 it
|
|
Packit Service |
e3b512 |
* will be progressively decreased by 2*M_PI until it is greater than @a angle1.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* See arc() for more details. This function differs only in the direction of
|
|
Packit Service |
e3b512 |
* the arc between the two angles.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param xc X position of the center of the arc
|
|
Packit Service |
e3b512 |
* @param yc Y position of the center of the arc
|
|
Packit Service |
e3b512 |
* @param radius the radius of the arc
|
|
Packit Service |
e3b512 |
* @param angle1 the start angle, in radians
|
|
Packit Service |
e3b512 |
* @param angle2 the end angle, in radians
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void arc_negative(double xc, double yc, double radius, double angle1, double angle2);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** If the current subpath is not empty, begin a new subpath. After this call
|
|
Packit Service |
e3b512 |
* the current point will offset by (x, y).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Given a current point of (x, y),
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* rel_move_to(dx, dy)
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
* is logically equivalent to
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* move_to(x + dx, y + dy)
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx the X offset
|
|
Packit Service |
e3b512 |
* @param dy the Y offset
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is an error to call this function with no current point. Doing
|
|
Packit Service |
e3b512 |
* so will cause this to shutdown with a status of
|
|
Packit Service |
e3b512 |
* CAIRO_STATUS_NO_CURRENT_POINT. Cairomm will then throw an exception.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rel_move_to(double dx, double dy);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Relative-coordinate version of line_to(). Adds a line to the path from
|
|
Packit Service |
e3b512 |
* the current point to a point that is offset from the current point by (dx,
|
|
Packit Service |
e3b512 |
* dy) in user space. After this call the current point will be offset by
|
|
Packit Service |
e3b512 |
* (dx, dy).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Given a current point of (x, y),
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* rel_line_to(dx, dy)
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
* is logically equivalent to
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* line_to(x + dx, y + dy).
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx the X offset to the end of the new line
|
|
Packit Service |
e3b512 |
* @param dy the Y offset to the end of the new line
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is an error to call this function with no current point. Doing
|
|
Packit Service |
e3b512 |
* so will cause this to shutdown with a status of
|
|
Packit Service |
e3b512 |
* CAIRO_STATUS_NO_CURRENT_POINT. Cairomm will then throw an exception.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rel_line_to(double dx, double dy);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Relative-coordinate version of curve_to(). All offsets are relative to
|
|
Packit Service |
e3b512 |
* the current point. Adds a cubic Bezier spline to the path from the current
|
|
Packit Service |
e3b512 |
* point to a point offset from the current point by (dx3, dy3), using points
|
|
Packit Service |
e3b512 |
* offset by (dx1, dy1) and (dx2, dy2) as the control points. After this
|
|
Packit Service |
e3b512 |
* call the current point will be offset by (dx3, dy3).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Given a current point of (x, y),
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* rel_curve_to(dx1, dy1, dx2, dy2, dx3, dy3)
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
* is logically equivalent to
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* curve_to(x + dx1, y + dy1, x + dx2, y + dy2, x + dx3, y + dy3).
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dx1 the X offset to the first control point
|
|
Packit Service |
e3b512 |
* @param dy1 the Y offset to the first control point
|
|
Packit Service |
e3b512 |
* @param dx2 the X offset to the second control point
|
|
Packit Service |
e3b512 |
* @param dy2 the Y offset to the second control point
|
|
Packit Service |
e3b512 |
* @param dx3 the X offset to the end of the curve
|
|
Packit Service |
e3b512 |
* @param dy3 the Y offset to the end of the curve
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is an error to call this function with no current point. Doing
|
|
Packit Service |
e3b512 |
* so will cause this to shutdown with a status of
|
|
Packit Service |
e3b512 |
* CAIRO_STATUS_NO_CURRENT_POINT. Cairomm will then throw an exception.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rel_curve_to(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a closed-subpath rectangle of the given size to the current path at
|
|
Packit Service |
e3b512 |
* position (x, y) in user-space coordinates.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function is logically equivalent to:
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* context->move_to(x, y);
|
|
Packit Service |
e3b512 |
* context->rel_line_to(width, 0);
|
|
Packit Service |
e3b512 |
* context->rel_line_to(0, height);
|
|
Packit Service |
e3b512 |
* context->rel_line_to(-width, 0);
|
|
Packit Service |
e3b512 |
* context->close_path();
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x the X coordinate of the top left corner of the rectangle
|
|
Packit Service |
e3b512 |
* @param y the Y coordinate to the top left corner of the rectangle
|
|
Packit Service |
e3b512 |
* @param width the width of the rectangle
|
|
Packit Service |
e3b512 |
* @param height the height of the rectangle
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void rectangle(double x, double y, double width, double height);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds a line segment to the path from the current point to the beginning
|
|
Packit Service |
e3b512 |
* of the current subpath, (the most recent point passed to move_to()), and
|
|
Packit Service |
e3b512 |
* closes this subpath. After this call the current point will be at the
|
|
Packit Service |
e3b512 |
* joined endpoint of the sub-path.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The behavior of close_path() is distinct from simply calling line_to()
|
|
Packit Service |
e3b512 |
* with the equivalent coordinate in the case of stroking. When a closed
|
|
Packit Service |
e3b512 |
* subpath is stroked, there are no caps on the ends of the subpath. Instead,
|
|
Packit Service |
e3b512 |
* there is a line join connecting the final and initial segments of the
|
|
Packit Service |
e3b512 |
* subpath.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If there is no current point before the call to close_path(),
|
|
Packit Service |
e3b512 |
* this function will have no effect.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void close_path();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that paints the current source everywhere within the
|
|
Packit Service |
e3b512 |
* current clip region.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void paint();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that paints the current source everywhere within the
|
|
Packit Service |
e3b512 |
* current clip region using a mask of constant alpha value alpha. The effect
|
|
Packit Service |
e3b512 |
* is similar to paint(), but the drawing is faded out using the alpha
|
|
Packit Service |
e3b512 |
* value.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param alpha an alpha value, between 0 (transparent) and 1 (opaque)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void paint_with_alpha(double alpha);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that paints the current source using the alpha channel
|
|
Packit Service |
e3b512 |
* of pattern as a mask. (Opaque areas of mask are painted with the source,
|
|
Packit Service |
e3b512 |
* transparent areas are not painted.)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param pattern a Pattern
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void mask(const RefPtr<const Pattern>& pattern);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that paints the current source using the alpha channel
|
|
Packit Service |
e3b512 |
* of surface as a mask. (Opaque areas of surface are painted with the
|
|
Packit Service |
e3b512 |
* source, transparent areas are not painted.)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param surface a Surface
|
|
Packit Service |
e3b512 |
* @param surface_x X coordinate at which to place the origin of surface
|
|
Packit Service |
e3b512 |
* @param surface_y Y coordinate at which to place the origin of surface
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void mask(const RefPtr<const Surface>& surface, double surface_x, double surface_y);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that strokes the current Path according to the current
|
|
Packit Service |
e3b512 |
* line width, line join, line cap, and dash settings. After stroke(),
|
|
Packit Service |
e3b512 |
* the current Path will be cleared from the cairo Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_line_width()
|
|
Packit Service |
e3b512 |
* @sa set_line_join()
|
|
Packit Service |
e3b512 |
* @sa set_line_cap()
|
|
Packit Service |
e3b512 |
* @sa set_dash()
|
|
Packit Service |
e3b512 |
* @sa stroke_preserve().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: Degenerate segments and sub-paths are treated specially and
|
|
Packit Service |
e3b512 |
* provide a useful result. These can result in two different
|
|
Packit Service |
e3b512 |
* situations:
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* 1. Zero-length "on" segments set in set_dash(). If the cap style is
|
|
Packit Service |
e3b512 |
* Cairo::LINE_CAP_ROUND or Cairo::LINE_CAP_SQUARE then these segments will
|
|
Packit Service |
e3b512 |
* be drawn as circular dots or squares respectively. In the case of
|
|
Packit Service |
e3b512 |
* Cairo::LINE_CAP_SQUARE, the orientation of the squares is determined by
|
|
Packit Service |
e3b512 |
* the direction of the underlying path.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* 2. A sub-path created by move_to() followed by either a close_path() or
|
|
Packit Service |
e3b512 |
* one or more calls to line_to() to the same coordinate as the move_to(). If
|
|
Packit Service |
e3b512 |
* the cap style is Cairo::LINE_CAP_ROUND then these sub-paths will be drawn
|
|
Packit Service |
e3b512 |
* as circular dots. Note that in the case of Cairo::LINE_CAP_SQUARE a
|
|
Packit Service |
e3b512 |
* degenerate sub-path will not be drawn at all, (since the correct
|
|
Packit Service |
e3b512 |
* orientation is indeterminate).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* In no case will a cap style of Cairo::LINE_CAP_BUTT cause anything to be
|
|
Packit Service |
e3b512 |
* drawn in the case of either degenerate segments or sub-paths.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void stroke();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that strokes the current Path according to the current
|
|
Packit Service |
e3b512 |
* line width, line join, line cap, and dash settings. Unlike stroke(),
|
|
Packit Service |
e3b512 |
* stroke_preserve() preserves the Path within the cairo Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_line_width()
|
|
Packit Service |
e3b512 |
* @sa set_line_join()
|
|
Packit Service |
e3b512 |
* @sa set_line_cap()
|
|
Packit Service |
e3b512 |
* @sa set_dash()
|
|
Packit Service |
e3b512 |
* @sa stroke_preserve().
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void stroke_preserve();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that fills the current path according to the current
|
|
Packit Service |
e3b512 |
* fill rule, (each sub-path is implicitly closed before being filled). After
|
|
Packit Service |
e3b512 |
* fill(), the current path will be cleared from the cairo context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
* @sa fill_preserve()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void fill();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** A drawing operator that fills the current path according to the current
|
|
Packit Service |
e3b512 |
* fill rule, (each sub-path is implicitly closed before being filled).
|
|
Packit Service |
e3b512 |
* Unlike fill(), fill_preserve() preserves the path within the
|
|
Packit Service |
e3b512 |
* cairo Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
* @sa fill().
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void fill_preserve();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Emits the current page for backends that support multiple pages, but
|
|
Packit Service |
e3b512 |
* doesn't clear it, so, the contents of the current page will be retained
|
|
Packit Service |
e3b512 |
* for the next page too. Use show_page() if you want to get an
|
|
Packit Service |
e3b512 |
* empty page after the emission.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This is a convenience function that simply calls Surface::copy_page() on
|
|
Packit Service |
e3b512 |
* @a cr's target.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void copy_page();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Emits and clears the current page for backends that support multiple
|
|
Packit Service |
e3b512 |
* pages. Use copy_page() if you don't want to clear the page.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This is a convenience function that simply calls
|
|
Packit Service |
e3b512 |
* Surface::show_page() on @a cr's target.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void show_page();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Tests whether the given point is inside the area that would be
|
|
Packit Service |
e3b512 |
* affected by a stroke() operation given the current path and
|
|
Packit Service |
e3b512 |
* stroking parameters. Surface dimensions and clipping are not taken
|
|
Packit Service |
e3b512 |
* into account.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X coordinate of the point to test
|
|
Packit Service |
e3b512 |
* @param y Y coordinate of the point to test
|
|
Packit Service |
e3b512 |
* @returns A non-zero value if the point is inside, or zero if outside.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa stroke()
|
|
Packit Service |
e3b512 |
* @sa set_line_width()
|
|
Packit Service |
e3b512 |
* @sa set_line_join()
|
|
Packit Service |
e3b512 |
* @sa set_line_cap()
|
|
Packit Service |
e3b512 |
* @sa set_dash()
|
|
Packit Service |
e3b512 |
* @sa stroke_preserve().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
bool in_stroke(double x, double y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Tests whether the given point is inside the area that would be
|
|
Packit Service |
e3b512 |
* affected by a fill() operation given the current path and
|
|
Packit Service |
e3b512 |
* filling parameters. Surface dimensions and clipping are not taken
|
|
Packit Service |
e3b512 |
* into account.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X coordinate of the point to test
|
|
Packit Service |
e3b512 |
* @param y Y coordinate of the point to test
|
|
Packit Service |
e3b512 |
* @returns A non-zero value if the point is inside, or zero if outside.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa fill()
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
* @sa fill_preserve()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
bool in_fill(double x, double y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Tests whether the given point is inside the area that would be visible
|
|
Packit Service |
e3b512 |
* through the current clip, i.e. the area that would be filled by a paint()
|
|
Packit Service |
e3b512 |
* operation.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Return value: A non-zero value if the point is inside, or zero if outside.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x X coordinate of the point to test
|
|
Packit Service |
e3b512 |
* @param y Y coordinate of the point to test
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa clip()
|
|
Packit Service |
e3b512 |
* @sa clip_preserve()
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.10
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
bool in_clip(double x, double y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Computes a bounding box in user coordinates covering the area that would
|
|
Packit Service |
e3b512 |
* be affected, (the "inked" area), by a stroke() operation given the current
|
|
Packit Service |
e3b512 |
* path and stroke parameters. If the current path is empty, returns an empty
|
|
Packit Service |
e3b512 |
* rectangle ((0,0), (0,0)). Surface dimensions and clipping are not taken
|
|
Packit Service |
e3b512 |
* into account.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that if the line width is set to exactly zero, then stroke_extents()
|
|
Packit Service |
e3b512 |
* will return an empty rectangle. Contrast with path_extents() which can be
|
|
Packit Service |
e3b512 |
* used to compute the non-empty bounds as the line width approaches zero.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that stroke_extents() must necessarily do more work to compute the
|
|
Packit Service |
e3b512 |
* precise inked areas in light of the stroke parameters, so path_extents()
|
|
Packit Service |
e3b512 |
* may be more desirable for sake of performance if non-inked path extents
|
|
Packit Service |
e3b512 |
* are desired.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x1 left of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y1 top of the resulting extents
|
|
Packit Service |
e3b512 |
* @param x2 right of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y2 bottom of the resulting extents
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa stroke()
|
|
Packit Service |
e3b512 |
* @sa set_line_width()
|
|
Packit Service |
e3b512 |
* @sa set_line_join()
|
|
Packit Service |
e3b512 |
* @sa set_line_cap()
|
|
Packit Service |
e3b512 |
* @sa set_dash()
|
|
Packit Service |
e3b512 |
* @sa stroke_preserve()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_stroke_extents(double& x1, double& y1, double& x2, double& y2) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Computes a bounding box in user coordinates covering the area that would
|
|
Packit Service |
e3b512 |
* be affected, (the "inked" area), by a fill() operation given the current
|
|
Packit Service |
e3b512 |
* path and fill parameters. If the current path is empty, returns an empty
|
|
Packit Service |
e3b512 |
* rectangle ((0,0), (0,0)). Surface dimensions and clipping are not taken
|
|
Packit Service |
e3b512 |
* into account.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Contrast with path_extents(), which is similar, but returns non-zero
|
|
Packit Service |
e3b512 |
* extents for some paths with no inked area, (such as a simple line
|
|
Packit Service |
e3b512 |
* segment).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that fill_extents() must necessarily do more work to compute the
|
|
Packit Service |
e3b512 |
* precise inked areas in light of the fill rule, so path_extents() may be
|
|
Packit Service |
e3b512 |
* more desirable for sake of performance if the non-inked path extents are
|
|
Packit Service |
e3b512 |
* desired.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x1 left of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y1 top of the resulting extents
|
|
Packit Service |
e3b512 |
* @param x2 right of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y2 bottom of the resulting extents
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa fill()
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
* @sa full_preserve()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_fill_extents(double& x1, double& y1, double& x2, double& y2) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Reset the current clip region to its original, unrestricted state. That
|
|
Packit Service |
e3b512 |
* is, set the clip region to an infinitely large shape containing the target
|
|
Packit Service |
e3b512 |
* surface. Equivalently, if infinity is too hard to grasp, one can imagine
|
|
Packit Service |
e3b512 |
* the clip region being reset to the exact bounds of the target surface.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that code meant to be reusable should not call reset_clip() as it
|
|
Packit Service |
e3b512 |
* will cause results unexpected by higher-level code which calls clip().
|
|
Packit Service |
e3b512 |
* Consider using save() and restore() around clip() as a more robust means
|
|
Packit Service |
e3b512 |
* of temporarily restricting the clip region.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void reset_clip();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Establishes a new clip region by intersecting the current clip region
|
|
Packit Service |
e3b512 |
* with the current Path as it would be filled by fill() and according to the
|
|
Packit Service |
e3b512 |
* current fill rule.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* After clip(), the current path will be cleared from the cairo Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The current clip region affects all drawing operations by effectively
|
|
Packit Service |
e3b512 |
* masking out any changes to the surface that are outside the current clip
|
|
Packit Service |
e3b512 |
* region.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Calling clip() can only make the clip region smaller, never larger. But
|
|
Packit Service |
e3b512 |
* the current clip is part of the graphics state, so a temporary restriction
|
|
Packit Service |
e3b512 |
* of the clip region can be achieved by calling clip() within a
|
|
Packit Service |
e3b512 |
* save()/restore() pair. The only other means of increasing the size of the
|
|
Packit Service |
e3b512 |
* clip region is reset_clip().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void clip();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Establishes a new clip region by intersecting the current clip region
|
|
Packit Service |
e3b512 |
* with the current path as it would be filled by fill() and according to the
|
|
Packit Service |
e3b512 |
* current fill rule.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Unlike clip(), clip_preserve preserves the path within the cairo
|
|
Packit Service |
e3b512 |
* Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa clip()
|
|
Packit Service |
e3b512 |
* @sa set_fill_rule()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void clip_preserve();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Computes a bounding box in user coordinates covering the area inside the
|
|
Packit Service |
e3b512 |
* current clip.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x1 left of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y1 top of the resulting extents
|
|
Packit Service |
e3b512 |
* @param x2 right of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y2 bottom of the resulting extents
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.4
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void get_clip_extents(double& x1, double& y1, double& x2, double& y2) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Returns the current clip region as a list of rectangles in user coordinates.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function will throw an exception if the clip region cannot be
|
|
Packit Service |
e3b512 |
* represented as a list of user-space rectangles.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param rectangles a vector to store the rectangles into
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @exception
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.4
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void copy_clip_rectangle_list(std::vector<Rectangle>& rectangles) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Selects a family and style of font from a simplified description as a
|
|
Packit Service |
e3b512 |
* family name, slant and weight. Cairo provides no operation to list
|
|
Packit Service |
e3b512 |
* available family names on the system (this is a "toy", remember), but the
|
|
Packit Service |
e3b512 |
* standard CSS2 generic family names, ("serif", "sans-serif", "cursive",
|
|
Packit Service |
e3b512 |
* "fantasy", "monospace"), are likely to work as expected.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: The select_font_face() function call is part of what the cairo
|
|
Packit Service |
e3b512 |
* designers call the "toy" text API. It is convenient for short demos and
|
|
Packit Service |
e3b512 |
* simple programs, but it is not expected to be adequate for serious
|
|
Packit Service |
e3b512 |
* text-using applications.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If @a family starts with the string "@cairo:", or if no native font
|
|
Packit Service |
e3b512 |
* backends are compiled in, cairo will use an internal font family. The
|
|
Packit Service |
e3b512 |
* internal font family recognizes many modifiers in the @family string, most
|
|
Packit Service |
e3b512 |
* notably, it recognizes the string "monospace". That is, the family name
|
|
Packit Service |
e3b512 |
* "@cairo:monospace" will use the monospace version of the internal font
|
|
Packit Service |
e3b512 |
* family.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* For "real" font selection, see the font-backend-specific
|
|
Packit Service |
e3b512 |
* Cairo::FontFace::create functions for the font backend you are using. (For
|
|
Packit Service |
e3b512 |
* example, if you are using the freetype-based cairo-ft font backend, see
|
|
Packit Service |
e3b512 |
* Cairo::FtFontFace::create().) The resulting font face could then be used
|
|
Packit Service |
e3b512 |
* with Cairo::ScaledFont::create() and set_scaled_font().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Similarly, when using the "real" font support, you can call directly into
|
|
Packit Service |
e3b512 |
* the underlying font system, (such as fontconfig or freetype), for
|
|
Packit Service |
e3b512 |
* operations such as listing available fonts, etc.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* It is expected that most applications will need to use a more
|
|
Packit Service |
e3b512 |
* comprehensive font handling and text layout library, (for example, pango),
|
|
Packit Service |
e3b512 |
* in conjunction with cairo.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If text is drawn without a call to select_font_face(), (nor
|
|
Packit Service |
e3b512 |
* set_font_face() nor set_scaled_font()), the default family is
|
|
Packit Service |
e3b512 |
* platform-specific, but is essentially "sans-serif". Default slant is
|
|
Packit Service |
e3b512 |
* Cairo::FONT_SLANT_NORMAL, and default weight is Cairo::FONT_WEIGHT_NORMAL.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function is equivalent to a call to Cairo::ToyFontFace::create()
|
|
Packit Service |
e3b512 |
* followed by set_font_face().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param family a font family name, encoded in UTF-8
|
|
Packit Service |
e3b512 |
* @param slant the slant for the font
|
|
Packit Service |
e3b512 |
* @param weight the weight for the font
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void select_font_face(const std::string& family, FontSlant slant, FontWeight weight);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Sets the current font matrix to a scale by a factor of @a size, replacing
|
|
Packit Service |
e3b512 |
* any font matrix previously set with set_font_size() or set_font_matrix().
|
|
Packit Service |
e3b512 |
* This results in a font size of @a size user space units. (More precisely,
|
|
Packit Service |
e3b512 |
* this matrix will result in the font's em-square being a @size by @a size
|
|
Packit Service |
e3b512 |
* square in user space.)
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* If text is drawn without a call to set_font_size(), (nor set_font_matrix()
|
|
Packit Service |
e3b512 |
* nor set_scaled_font()), the default font size is 10.0.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param size the new font size, in user space units)
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_font_size(double size);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Sets the current font matrix to @matrix. The font matrix gives a
|
|
Packit Service |
e3b512 |
* transformation from the design space of the font (in this space, the
|
|
Packit Service |
e3b512 |
* em-square is 1 unit by 1 unit) to user space. Normally, a simple scale is
|
|
Packit Service |
e3b512 |
* used (see set_font_size()), but a more complex font matrix can be used to
|
|
Packit Service |
e3b512 |
* shear the font or stretch it unequally along the two axes
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param matrix a Cairo::Matrix describing a transform to be applied to the
|
|
Packit Service |
e3b512 |
* current font.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_font_matrix(const Matrix& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Returns the current font matrix
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param matrix a Cairo::Matrix to store the results into (in/out parameter)
|
|
Packit Service |
e3b512 |
* @sa set_font_matrix()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_font_matrix(Matrix& matrix) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Sets a set of custom font rendering options. Rendering options are derived
|
|
Packit Service |
e3b512 |
* by merging these options with the options derived from underlying surface;
|
|
Packit Service |
e3b512 |
* if the value in @a options has a default value (like
|
|
Packit Service |
e3b512 |
* Cairo::ANTIALIAS_DEFAULT), then the value from the surface is used.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param options font options to use
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_font_options(const FontOptions& options);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/* To keep 1.6.x ABI */
|
|
Packit Service |
e3b512 |
void set_font_matrix(const cairo_matrix_t& matrix);
|
|
Packit Service |
e3b512 |
void get_font_matrix(cairo_matrix_t& matrix) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Retrieves font rendering options set via set_font_options(). Note that the
|
|
Packit Service |
e3b512 |
* returned options do not include any options derived from the underlying
|
|
Packit Service |
e3b512 |
* surface; they are literally the options passed to set_font_options().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param options a FontOptions object into which to store the retrieved
|
|
Packit Service |
e3b512 |
* options. All existing values are overwritten
|
|
Packit Service |
e3b512 |
* @since 1.8
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_font_options(FontOptions& options) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Replaces the current font face, font matrix, and font options in the
|
|
Packit Service |
e3b512 |
* context with those of the @a scaled_font. Except for some translation, the
|
|
Packit Service |
e3b512 |
* current CTM of the context should be the same as that of the
|
|
Packit Service |
e3b512 |
* #cairo_scaled_font_t, which can be accessed using
|
|
Packit Service |
e3b512 |
* Cairo::ScaledFont::get_ctm().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param scaled_font a scaled font
|
|
Packit Service |
e3b512 |
* @since 1.8
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void set_scaled_font(const RefPtr<const ScaledFont>& scaled_font);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current scaled font.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.8
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
RefPtr<ScaledFont> get_scaled_font();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* A drawing operator that generates the shape from a string of UTF-8
|
|
Packit Service |
e3b512 |
* characters, rendered according to the current font_face, font_size
|
|
Packit Service |
e3b512 |
* (font_matrix), and font_options.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function first computes a set of glyphs for the string of text. The
|
|
Packit Service |
e3b512 |
* first glyph is placed so that its origin is at the current point. The
|
|
Packit Service |
e3b512 |
* origin of each subsequent glyph is offset from that of the previous glyph
|
|
Packit Service |
e3b512 |
* by the advance values of the previous glyph.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* After this call the current point is moved to the origin of where the
|
|
Packit Service |
e3b512 |
* next glyph would be placed in this same progression. That is, the current
|
|
Packit Service |
e3b512 |
* point will be at the origin of the final glyph offset by its advance
|
|
Packit Service |
e3b512 |
* values. This allows for easy display of a single logical string with
|
|
Packit Service |
e3b512 |
* multiple calls to show_text().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: The show_text() function call is part of what the cairo
|
|
Packit Service |
e3b512 |
* designers call the "toy" text API. It is convenient for short demos and
|
|
Packit Service |
e3b512 |
* simple programs, but it is not expected to be adequate for serious
|
|
Packit Service |
e3b512 |
* text-using applications. See show_glyphs() for the "real" text
|
|
Packit Service |
e3b512 |
* display API in cairo.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param utf8 a string containing text encoded in UTF-8
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void show_text(const std::string& utf8);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* A drawing operator that generates the shape from an array of glyphs,
|
|
Packit Service |
e3b512 |
* rendered according to the current font face, font size (font matrix), and
|
|
Packit Service |
e3b512 |
* font options.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param glyphs vector of glyphs to show
|
|
Packit Service |
e3b512 |
* @param num_glyphs number of glyphs to show
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void show_glyphs(const std::vector<Glyph>& glyphs);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* This operation has rendering effects similar to show_glyphs() but, if the
|
|
Packit Service |
e3b512 |
* target surface supports it, uses the provided text and cluster mapping to
|
|
Packit Service |
e3b512 |
* embed the text for the glyphs shown in the output. If the target does not
|
|
Packit Service |
e3b512 |
* support the extended attributes, this function acts like the basic
|
|
Packit Service |
e3b512 |
* show_glyphs() as if it had been passed @a glyphs and @a num_glyphs.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The mapping between @a utf8 and @a glyphs is provided by an array of
|
|
Packit Service |
e3b512 |
* <firstterm>clusters</firstterm>. Each cluster covers a number of text
|
|
Packit Service |
e3b512 |
* bytes and glyphs, and neighboring clusters cover neighboring areas of @a
|
|
Packit Service |
e3b512 |
* utf8 and @a glyphs. The clusters should collectively cover @a utf8 and @a
|
|
Packit Service |
e3b512 |
* glyphs in entirety.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The first cluster always covers bytes from the beginning of @a utf8. If @a
|
|
Packit Service |
e3b512 |
* cluster_flags do not have the Cairo::TEXT_CLUSTER_FLAG_BACKWARD set, the
|
|
Packit Service |
e3b512 |
* first cluster also covers the beginning of @a glyphs, otherwise it covers
|
|
Packit Service |
e3b512 |
* the end of the @a glyphs array and following clusters move backward.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* See Cairo::TextCluster for constraints on valid clusters.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param utf8: a string of text encoded in UTF-8
|
|
Packit Service |
e3b512 |
* @param glyphs: vector of glyphs to show
|
|
Packit Service |
e3b512 |
* @param clusters: vector of cluster mapping information
|
|
Packit Service |
e3b512 |
* @param cluster_flags: cluster mapping flags
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.8
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void show_text_glyphs(const std::string& utf8,
|
|
Packit Service |
e3b512 |
const std::vector<Glyph>& glyphs,
|
|
Packit Service |
e3b512 |
const std::vector<TextCluster>& clusters,
|
|
Packit Service |
e3b512 |
TextClusterFlags cluster_flags);
|
|
Packit Service |
e3b512 |
/// @{
|
|
Packit Service |
e3b512 |
/** Gets the current font face
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
RefPtr<FontFace> get_font_face();
|
|
Packit Service |
e3b512 |
RefPtr<const FontFace> get_font_face() const;
|
|
Packit Service |
e3b512 |
/// @}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the font extents for the currently selected font.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param extents a Cairo::FontExtents object
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_font_extents(FontExtents& extents) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Replaces the current font face in the context with @a font_face
|
|
Packit Service |
e3b512 |
* @a font_face. The replaced font face in the context will be destroyed if
|
|
Packit Service |
e3b512 |
* there are no other references to it.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param font_face a font face
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
//FIXME: C API acceps NULL to restore the default font. Does C++ API support that?
|
|
Packit Service |
e3b512 |
void set_font_face(const RefPtr<const FontFace>& font_face);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the extents for a string of text. The extents describe a user-space
|
|
Packit Service |
e3b512 |
* rectangle that encloses the "inked" portion of the text, (as it would be
|
|
Packit Service |
e3b512 |
* drawn by show_text()). Additionally, the x_advance and y_advance values
|
|
Packit Service |
e3b512 |
* indicate the amount by which the current point would be advanced by
|
|
Packit Service |
e3b512 |
* show_text().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that whitespace characters do not directly contribute to the size of
|
|
Packit Service |
e3b512 |
* the rectangle (extents.width and extents.height). They do contribute
|
|
Packit Service |
e3b512 |
* indirectly by changing the position of non-whitespace characters. In
|
|
Packit Service |
e3b512 |
* particular, trailing whitespace characters are likely to not affect the
|
|
Packit Service |
e3b512 |
* size of the rectangle, though they will affect the x_advance and y_advance
|
|
Packit Service |
e3b512 |
* values.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param utf8 a string of text encoded in UTF-8
|
|
Packit Service |
e3b512 |
* @param extents a TextExtents object
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_text_extents(const std::string& utf8, TextExtents& extents) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the extents for an array of glyphs. The extents describe a user-space
|
|
Packit Service |
e3b512 |
* rectangle that encloses the "inked" portion of the glyphs, (as they would
|
|
Packit Service |
e3b512 |
* be drawn by show_glyphs()). Additionally, the x_advance and y_advance
|
|
Packit Service |
e3b512 |
* values indicate the amount by which the current point would be advanced by
|
|
Packit Service |
e3b512 |
* show_glyphs().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note that whitespace glyphs do not contribute to the size of the rectangle
|
|
Packit Service |
e3b512 |
* (extents.width and extents.height).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param glyphs a vector of glyphs
|
|
Packit Service |
e3b512 |
* @param extents a TextExtents object
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Adds closed paths for text to the current path. The generated path if
|
|
Packit Service |
e3b512 |
* filled, achieves an effect similar to that of show_text().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Text conversion and positioning is done similar to show_text().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Like show_text(), After this call the current point is moved to the origin
|
|
Packit Service |
e3b512 |
* of where the next glyph would be placed in this same progression. That is,
|
|
Packit Service |
e3b512 |
* the current point will be at the origin of the final glyph offset by its
|
|
Packit Service |
e3b512 |
* advance values. This allows for chaining multiple calls to to text_path()
|
|
Packit Service |
e3b512 |
* without having to set current point in between.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Note: The text_path() function call is part of what the cairo designers
|
|
Packit Service |
e3b512 |
* call the "toy" text API. It is convenient for short demos and simple
|
|
Packit Service |
e3b512 |
* programs, but it is not expected to be adequate for serious text-using
|
|
Packit Service |
e3b512 |
* applications. See glyph_path() for the "real" text path API in cairo.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param utf8 a string of text encoded in UTF-8
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void text_path(const std::string& utf8);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Adds closed paths for the glyphs to the current path. The generated path
|
|
Packit Service |
e3b512 |
* if filled, achieves an effect similar to that of show_glyphs().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param glyphs a vector of glyphs
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void glyph_path(const std::vector<Glyph>& glyphs);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current compositing operator for a cairo Context
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
Operator get_operator() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/// @{
|
|
Packit Service |
e3b512 |
/** Gets the current source pattern for the Context
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
RefPtr<Pattern> get_source();
|
|
Packit Service |
e3b512 |
RefPtr<const Pattern> get_source() const;
|
|
Packit Service |
e3b512 |
/// @}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current tolerance value, as set by set_tolerance()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
double get_tolerance() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current shape antialiasing mode, as set by set_antialias()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
Antialias get_antialias() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current point of the current path, which is conceptually the
|
|
Packit Service |
e3b512 |
* final point reached by the path so far.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The current point is returned in the user-space coordinate system. If
|
|
Packit Service |
e3b512 |
* there is no defined current point then x and y will both be set to 0.0. It
|
|
Packit Service |
e3b512 |
* is possible to check this in advance with has_current_point().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Most path construction functions alter the current point. See the
|
|
Packit Service |
e3b512 |
* following for details on how they affect the current point: clear_path(),
|
|
Packit Service |
e3b512 |
* move_to(), line_to(), curve_to(), arc(), rel_move_to(), rel_line_to(),
|
|
Packit Service |
e3b512 |
* rel_curve_to(), arc(), and text_path()
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Some functions use and alter the current point but do not otherwise change
|
|
Packit Service |
e3b512 |
* current path: show_text().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Some functions unset the current path and as a result, current point:
|
|
Packit Service |
e3b512 |
* fill(), stroke().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x return value for X coordinate of the current point
|
|
Packit Service |
e3b512 |
* @param y return value for Y coordinate of the current point
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @sa has_current_point()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_current_point (double& x, double& y) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Checks if there is a current point defined. See get_current_point() for
|
|
Packit Service |
e3b512 |
* details on the current point.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @returns @c true if a current point is defined.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.6
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
bool has_current_point() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current fill rule, as set by set_fill_rule().
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
FillRule get_fill_rule() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the current line width, as set by set_line_width(). Note that the
|
|
Packit Service |
e3b512 |
* value is unchanged even if the CTM has changed between the calls to
|
|
Packit Service |
e3b512 |
* set_line_width() and get_line_width().
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
double get_line_width() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current line cap style, as set by set_line_cap()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
LineCap get_line_cap() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current line join style, as set by set_line_join()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
LineJoin get_line_join() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets the current miter limit, as set by set_miter_limit()
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
double get_miter_limit() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the current dash array and offset.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param dashes return value for the dash array.
|
|
Packit Service |
e3b512 |
* @param offset return value for the current dash offset.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.4
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void get_dash(std::vector<double>& dashes, double& offset) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Stores the current transformation matrix (CTM) into matrix.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param matrix return value for the matrix
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_matrix(Matrix& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/* To keep 1.6.x ABI */
|
|
Packit Service |
e3b512 |
void get_matrix(cairo_matrix_t& matrix);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Returns the current transformation matrix (CTM)
|
|
Packit Service |
e3b512 |
* @since 1.8
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
Matrix get_matrix() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/// @{
|
|
Packit Service |
e3b512 |
/** Gets the target surface associated with this Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @exception
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
RefPtr<Surface> get_target();
|
|
Packit Service |
e3b512 |
RefPtr<const Surface> get_target() const;
|
|
Packit Service |
e3b512 |
/// @}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
//TODO: Copy or reference-count a Path somethow instead of asking the caller to delete it?
|
|
Packit Service |
e3b512 |
/** Creates a copy of the current path and returns it to the user.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @todo See cairo_path_data_t for hints on how to iterate over the returned
|
|
Packit Service |
e3b512 |
* data structure.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @note The caller owns the Path object returned from this function. The
|
|
Packit Service |
e3b512 |
* Path object must be freed when you are finished with it.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
Path* copy_path() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Computes a bounding box in user-space coordinates covering the points on
|
|
Packit Service |
e3b512 |
* the current path. If the current path is empty, returns an empty rectangle
|
|
Packit Service |
e3b512 |
* ((0,0), (0,0)). Stroke parameters, fill rule, surface dimensions and
|
|
Packit Service |
e3b512 |
* clipping are not taken into account.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Contrast with fill_extents() and stroke_extents() which return the extents
|
|
Packit Service |
e3b512 |
* of only the area that would be "inked" by the corresponding drawing
|
|
Packit Service |
e3b512 |
* operations.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The result of path_extents() is defined as equivalent to the limit of
|
|
Packit Service |
e3b512 |
* stroke_extents() with LINE_CAP_ROUND as the line width approaches 0.0, (but
|
|
Packit Service |
e3b512 |
* never reaching the empty-rectangle returned by stroke_extents() for a line
|
|
Packit Service |
e3b512 |
* width of 0.0).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Specifically, this means that zero-area sub-paths such as
|
|
Packit Service |
e3b512 |
* move_to();line_to() segments, (even degenerate cases where the coordinates
|
|
Packit Service |
e3b512 |
* to both calls are identical), will be considered as contributing to the
|
|
Packit Service |
e3b512 |
* extents. However, a lone move_to() will not contribute to the results of
|
|
Packit Service |
e3b512 |
* path_extents().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param x1 left of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y1 top of the resulting extents
|
|
Packit Service |
e3b512 |
* @param x2 right of the resulting extents
|
|
Packit Service |
e3b512 |
* @param y2 bottom of the resulting extents
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.6
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void get_path_extents(double& x1, double& y1, double& x2, double& y2) const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets a flattened copy of the current path and returns it to the user
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @todo See cairo_path_data_t for hints on how to iterate over the returned
|
|
Packit Service |
e3b512 |
* data structure.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function is like copy_path() except that any curves in the path will
|
|
Packit Service |
e3b512 |
* be approximated with piecewise-linear approximations, (accurate to within
|
|
Packit Service |
e3b512 |
* the current tolerance value). That is, the result is guaranteed to not have
|
|
Packit Service |
e3b512 |
* any elements of type CAIRO_PATH_CURVE_TO which will instead be
|
|
Packit Service |
e3b512 |
* replaced by a series of CAIRO_PATH_LINE_TO elements.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @note The caller owns the Path object returned from this function. The
|
|
Packit Service |
e3b512 |
* Path object must be freed when you are finished with it.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
Path* copy_path_flat() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Append the path onto the current path. The path may be either the return
|
|
Packit Service |
e3b512 |
* value from one of copy_path() or copy_path_flat() or it may be constructed
|
|
Packit Service |
e3b512 |
* manually.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param path path to be appended
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void append_path(const Path& path);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Temporarily redirects drawing to an intermediate surface known as a group.
|
|
Packit Service |
e3b512 |
* The redirection lasts until the group is completed by a call to pop_group()
|
|
Packit Service |
e3b512 |
* or pop_group_to_source(). These calls provide the result of any drawing to
|
|
Packit Service |
e3b512 |
* the group as a pattern, (either as an explicit object, or set as the source
|
|
Packit Service |
e3b512 |
* pattern).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This group functionality can be convenient for performing intermediate
|
|
Packit Service |
e3b512 |
* compositing. One common use of a group is to render objects as opaque
|
|
Packit Service |
e3b512 |
* within the group, (so that they occlude each other), and then blend the
|
|
Packit Service |
e3b512 |
* result with translucence onto the destination.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* Groups can be nested arbitrarily deep by making balanced calls to
|
|
Packit Service |
e3b512 |
* push_group()/pop_group(). Each call pushes/pops the new target group
|
|
Packit Service |
e3b512 |
* onto/from a stack.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The push_group() function calls save() so that any changes to the graphics
|
|
Packit Service |
e3b512 |
* state will not be visible outside the group, (the pop_group functions call
|
|
Packit Service |
e3b512 |
* restore()).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* By default the intermediate group will have a content type of
|
|
Packit Service |
e3b512 |
* CONTENT_COLOR_ALPHA. Other content types can be chosen for the group by
|
|
Packit Service |
e3b512 |
* using push_group_with_content() instead.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* As an example, here is how one might fill and stroke a path with
|
|
Packit Service |
e3b512 |
* translucence, but without any portion of the fill being visible under the
|
|
Packit Service |
e3b512 |
* stroke:
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* cr->push_group();
|
|
Packit Service |
e3b512 |
* cr->set_source(fill_pattern);
|
|
Packit Service |
e3b512 |
* cr->fill_preserve();
|
|
Packit Service |
e3b512 |
* cr->set_source(stroke_pattern);
|
|
Packit Service |
e3b512 |
* cr->stroke();
|
|
Packit Service |
e3b512 |
* cr->pop_group_to_source();
|
|
Packit Service |
e3b512 |
* cr->paint_with_alpha(alpha);
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void push_group();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Temporarily redirects drawing to an intermediate surface known as a
|
|
Packit Service |
e3b512 |
* group. The redirection lasts until the group is completed by a call
|
|
Packit Service |
e3b512 |
* to pop_group() or pop_group_to_source(). These calls provide the result of
|
|
Packit Service |
e3b512 |
* any drawing to the group as a pattern, (either as an explicit object, or set
|
|
Packit Service |
e3b512 |
* as the source pattern).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The group will have a content type of @content. The ability to control this
|
|
Packit Service |
e3b512 |
* content type is the only distinction between this function and push_group()
|
|
Packit Service |
e3b512 |
* which you should see for a more detailed description of group rendering.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @param content indicates the type of group that will be created
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
void push_group_with_content(Content content);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Terminates the redirection begun by a call to push_group() or
|
|
Packit Service |
e3b512 |
* push_group_with_content() and returns a new pattern containing the results
|
|
Packit Service |
e3b512 |
* of all drawing operations performed to the group.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The pop_group() function calls restore(), (balancing a call to save() by
|
|
Packit Service |
e3b512 |
* the push_group function), so that any changes to the graphics state will
|
|
Packit Service |
e3b512 |
* not be visible outside the group.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @return a (surface) pattern containing the results of all drawing
|
|
Packit Service |
e3b512 |
* operations performed to the group.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
RefPtr<Pattern> pop_group();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Terminates the redirection begun by a call to push_group() or
|
|
Packit Service |
e3b512 |
* push_group_with_content() and installs the resulting pattern as the source
|
|
Packit Service |
e3b512 |
* pattern in the given cairo Context.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The behavior of this function is equivalent to the sequence of operations:
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @code
|
|
Packit Service |
e3b512 |
* RefPtr<Pattern> group = cr->pop_group();
|
|
Packit Service |
e3b512 |
* cr->set_source(group);
|
|
Packit Service |
e3b512 |
* @endcode
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* but is more convenient as their is no need for a variable to store
|
|
Packit Service |
e3b512 |
* the short-lived pointer to the pattern.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* The pop_group() function calls restore(), (balancing a call to save() by
|
|
Packit Service |
e3b512 |
* the push_group function), so that any changes to the graphics state will
|
|
Packit Service |
e3b512 |
* not be visible outside the group.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
void pop_group_to_source();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/**
|
|
Packit Service |
e3b512 |
* Gets the target surface for the current group as started by the most recent
|
|
Packit Service |
e3b512 |
* call to push_group() or push_group_with_content().
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This function will return NULL if called "outside" of any group rendering
|
|
Packit Service |
e3b512 |
* blocks, (that is, after the last balancing call to pop_group() or
|
|
Packit Service |
e3b512 |
* pop_group_to_source()).
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @exception
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
**/
|
|
Packit Service |
e3b512 |
RefPtr<Surface> get_group_target();
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Same as the non-const version but returns a reference to a const Surface
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* @since 1.2
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
RefPtr<const Surface> get_group_target() const;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** The base cairo C type that is wrapped by Cairo::Context
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
typedef cairo_t cobject;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets a pointer to the base C type that is wrapped by the Context
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
inline cobject* cobj() { return m_cobject; }
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
/** Gets a pointer to the base C type that is wrapped by the Context
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
inline const cobject* cobj() const { return m_cobject; }
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifndef DOXYGEN_IGNORE_THIS
|
|
Packit Service |
e3b512 |
///For use only by the cairomm implementation.
|
|
Packit Service |
e3b512 |
inline ErrorStatus get_status() const
|
|
Packit Service |
e3b512 |
{ return cairo_status(const_cast<cairo_t*>(cobj())); }
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void reference() const;
|
|
Packit Service |
e3b512 |
void unreference() const;
|
|
Packit Service |
e3b512 |
#endif //DOXYGEN_IGNORE_THIS
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
protected:
|
|
Packit Service |
e3b512 |
cobject* m_cobject;
|
|
Packit Service |
e3b512 |
};
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
} // namespace Cairo
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#endif //__CAIROMM_CONTEXT_H
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
// vim: ts=2 sw=2 et
|