CrPath

CrPath — A canvas item capable of rendering a cairo_path_t.

Synopsis

                    CrPath;
CrItem*             cr_path_new                         (CrItem *parent,
                                                         const gchar *first_arg_name,
                                                         ...);
void                cr_path_set_color                   (cairo_t *c,
                                                         guint rgba);
void                cr_path_setup_line                  (CrPath *path,
                                                         cairo_t *c);

Object Hierarchy

  GObject
   +----CrItem
         +----CrPath
               +----CrLine
               +----CrRectangle
               +----CrEllipse
               +----CrVector
               +----CrArrow

Properties

  "cap"                      CrCap                 : Read / Write
  "dash"                     CrDash*               : Read / Write
  "fill-color"               gchar*                : Read / Write
  "fill-color-rgba"          guint                 : Read / Write
  "fill-rule"                CrFillRule            : Read / Write
  "join"                     CrJoin                : Read / Write
  "line-scaleable"           gboolean              : Read / Write
  "line-width"               gdouble               : Read / Write
  "line-width-use-y"         gboolean              : Read / Write
  "outline-color"            gchar*                : Read / Write
  "outline-color-rgba"       guint                 : Read / Write
  "path"                     gpointer              : Read / Write
  "pattern"                  CrPattern*            : Read / Write
  "pattern-scaleable"        gboolean              : Read / Write
  "test-fill"                gboolean              : Read / Write

Signals

  "make-path"                                      : Run Last

Description

This is the base class for canvas items that are drawn from the cairo_path_t such as CrEllipse, CrRectangle, and CrLine.

Details

CrPath

typedef struct _CrPath CrPath;


cr_path_new ()

CrItem*             cr_path_new                         (CrItem *parent,
                                                         const gchar *first_arg_name,
                                                         ...);

A convenience function to create a path item and add it to a canvas item parent group in one step.

parent :

The parent canvas item.

first_arg_name :

... :

Returns :

A reference to a new CrItem. You must call g_object_ref if you intend to keep it around.

cr_path_set_color ()

void                cr_path_set_color                   (cairo_t *c,
                                                         guint rgba);

A convenience function to set the rgba integer into the cairo context. It may be called by derived CrPath inplementations.

c :

A cairo context to set the color into.

rgba :

An integer representing RGBA as four characters.

cr_path_setup_line ()

void                cr_path_setup_line                  (CrPath *path,
                                                         cairo_t *c);

A convenience function to set up the "line-width", "line-scaleable", and "dash" properties into the cairo context. It may be called by derived implementations of CrPath.

path :

The path object.

c :

The current cairo context.

Property Details

The "cap" property

  "cap"                      CrCap                 : Read / Write

The enumeration for the style of line endings. See #cairo_line_cap_t for more information.

Default value: CAIRO_LINE_CAP_BUTT


The "dash" property

  "dash"                     CrDash*               : Read / Write

a boxed array indicating the dash pattern to be used by Cairo. See #cairo_set_dash for more information.


The "fill-color" property

  "fill-color"               gchar*                : Read / Write

A string color such as 'red', or '#123456' to be used to fill the path.

Default value: NULL


The "fill-color-rgba" property

  "fill-color-rgba"          guint                 : Read / Write

Region fill color, red,grn,blue,alpha.

Default value: 0


The "fill-rule" property

  "fill-rule"                CrFillRule            : Read / Write

The enumeration used to determine how paths are filled. See #cairo_fill_rule_t for more information.

Default value: CAIRO_FILL_RULE_WINDING


The "join" property

  "join"                     CrJoin                : Read / Write

The enumeration for determining how line segments are joined together. See #cairo_line_join_t for more information.

Default value: CAIRO_LINE_JOIN_MITER


The "line-scaleable" property

  "line-scaleable"           gboolean              : Read / Write

If line width should be scaleable.

Default value: TRUE


The "line-width" property

  "line-width"               gdouble               : Read / Write

Path line width in user units when #CrPath:line-scaleable is TRUE. When #CrPath:line-scaleable is FALSE this is in device units.

Default value: 2


The "line-width-use-y" property

  "line-width-use-y"         gboolean              : Read / Write

If the Y axis should be used for determining the device coordinates for the line-width. This property only applies when line-scalable is FALSE, outline-color is set, and the canvas widget has the maintain-aspect property set to FALSE. The default is to use the x-axis transformation to determine device line-width.

Default value: FALSE


The "outline-color" property

  "outline-color"            gchar*                : Read / Write

A string color such as 'red', or '#123456' to be used to sroke the path.

Default value: NULL


The "outline-color-rgba" property

  "outline-color-rgba"       guint                 : Read / Write

Path color, red,grn,blue,alpha.

Default value: 0


The "path" property

  "path"                     gpointer              : Read / Write

a cairo_path_t. On set the item owns it. On get the item still owns it. This is exclusive with points.


The "pattern" property

  "pattern"                  CrPattern*            : Read / Write

Cairo pattern to fill the path region.


The "pattern-scaleable" property

  "pattern-scaleable"        gboolean              : Read / Write

If pattern should scale.

Default value: TRUE


The "test-fill" property

  "test-fill"                gboolean              : Read / Write

If the fill area should be grabbable by the pointer regardless of if it is filled. The most common use for this is as an invisible child of a very small item that would be difficult to grab on its own.

Default value: FALSE

Signal Details

The "make-path" signal

gboolean            user_function                      (CrPath    *path,
                                                        CrContext *c,
                                                        gpointer   user_data)      : Run Last

This signal is part of the calculate-bounds signal for path items. First the path is constructed, then the bounds are calculated. By overriding this signal and not overriding calculate-bounds, it is possible to render the path here and allow the default handler to calculate the bounds. The path will be copied from the cairo_t*.

path :

c :

Cairo context with transformation set to match the current item.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE if the path from the cairo_t* should be used. FALSE to use whatever path was created previously if any.