GimpCageConfig

GimpCageConfig

Synopsis

                    GimpCageConfig;
struct              GimpCageConfigClass;
                    GimpCagePoint;
void                gimp_cage_config_add_cage_point     (GimpCageConfig *gcc,
                                                         gdouble x,
                                                         gdouble y);
void                gimp_cage_config_add_displacement   (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         gdouble x,
                                                         gdouble y);
void                gimp_cage_config_commit_displacement
                                                        (GimpCageConfig *gcc);
void                gimp_cage_config_deselect_points    (GimpCageConfig *gcc);
GeglRectangle       gimp_cage_config_get_bounding_box   (GimpCageConfig *gcc);
guint               gimp_cage_config_get_n_points       (GimpCageConfig *gcc);
GimpVector2         gimp_cage_config_get_point_coordinate
                                                        (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         gint point_number);
void                gimp_cage_config_insert_cage_point  (GimpCageConfig *gcc,
                                                         gint point_number,
                                                         gdouble x,
                                                         gdouble y);
gboolean            gimp_cage_config_point_inside       (GimpCageConfig *gcc,
                                                         gfloat x,
                                                         gfloat y);
gboolean            gimp_cage_config_point_is_selected  (GimpCageConfig *gcc,
                                                         gint point_number);
void                gimp_cage_config_remove_cage_point  (GimpCageConfig *gcc,
                                                         gint point_number);
void                gimp_cage_config_remove_last_cage_point
                                                        (GimpCageConfig *gcc);
void                gimp_cage_config_remove_selected_points
                                                        (GimpCageConfig *gcc);
void                gimp_cage_config_reset_displacement (GimpCageConfig *gcc);
void                gimp_cage_config_reverse_cage       (GimpCageConfig *gcc);
void                gimp_cage_config_reverse_cage_if_needed
                                                        (GimpCageConfig *gcc);
void                gimp_cage_config_select_add_area    (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         GeglRectangle area);
void                gimp_cage_config_select_area        (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         GeglRectangle area);
void                gimp_cage_config_select_point       (GimpCageConfig *gcc,
                                                         gint point_number);
void                gimp_cage_config_toggle_point_selection
                                                        (GimpCageConfig *gcc,
                                                         gint point_number);

Object Hierarchy

  GObject
   +----GimpObject
         +----GimpViewable
               +----GimpImageMapConfig
                     +----GimpCageConfig

Implemented Interfaces

GimpCageConfig implements GimpConfigInterface.

Description

Details

GimpCageConfig

typedef struct _GimpCageConfig GimpCageConfig;


struct GimpCageConfigClass

struct GimpCageConfigClass {
  GimpImageMapConfigClass  parent_class;
};


GimpCagePoint

typedef struct {
  GimpVector2 src_point;
  GimpVector2 dest_point;
  GimpVector2 edge_normal;
  gdouble     edge_scaling_factor;
  gboolean    selected;
} GimpCagePoint;


gimp_cage_config_add_cage_point ()

void                gimp_cage_config_add_cage_point     (GimpCageConfig *gcc,
                                                         gdouble x,
                                                         gdouble y);

Add a new point in the last index of the polygon of the cage. Point is added in both source and destination cage

gcc :

the cage config

x :

x value of the new point

y :

y value of the new point

gimp_cage_config_add_displacement ()

void                gimp_cage_config_add_displacement   (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         gdouble x,
                                                         gdouble y);

Add a displacement for all slected point of the cage. This displacement need to be commited to become effective.

gcc :

the cage config

mode :

the actual mode of the cage, GIMP_CAGE_MODE_CAGE_CHANGE or GIMP_CAGE_MODE_DEFORM

x :

x displacement value

y :

y displacement value

gimp_cage_config_commit_displacement ()

void                gimp_cage_config_commit_displacement
                                                        (GimpCageConfig *gcc);

Apply the displacement to the cage

gcc :

the cage config

gimp_cage_config_deselect_points ()

void                gimp_cage_config_deselect_points    (GimpCageConfig *gcc);


gimp_cage_config_get_bounding_box ()

GeglRectangle       gimp_cage_config_get_bounding_box   (GimpCageConfig *gcc);

Compute the bounding box of the source cage

gcc :

the cage config

Returns :

the bounding box of the source cage, as a GeglRectangle

gimp_cage_config_get_n_points ()

guint               gimp_cage_config_get_n_points       (GimpCageConfig *gcc);

gcc :

the cage config

Returns :

the number of points of the cage

gimp_cage_config_get_point_coordinate ()

GimpVector2         gimp_cage_config_get_point_coordinate
                                                        (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         gint point_number);

gcc :

the cage config

mode :

the actual mode of the cage, GIMP_CAGE_MODE_CAGE_CHANGE or GIMP_CAGE_MODE_DEFORM

point_number :

the index of the point to return

Returns :

the real position of the given point, as a GimpVector2

gimp_cage_config_insert_cage_point ()

void                gimp_cage_config_insert_cage_point  (GimpCageConfig *gcc,
                                                         gint point_number,
                                                         gdouble x,
                                                         gdouble y);

Insert a new point in the polygon of the cage at the given index. Point is added in both source and destination cage

gcc :

the cage config

point_number :

index where the point will be inserted

x :

x value of the new point

y :

y value of the new point

gimp_cage_config_point_inside ()

gboolean            gimp_cage_config_point_inside       (GimpCageConfig *gcc,
                                                         gfloat x,
                                                         gfloat y);

Check if the given point is inside the cage. This test is done in the regard of the topological inside of the source cage.

gcc :

the cage config

x :

x coordinate of the point to test

y :

y coordinate of the point to test

Returns :

TRUE if the point is inside, FALSE if not. This function does not take into account an eventual displacement.

gimp_cage_config_point_is_selected ()

gboolean            gimp_cage_config_point_is_selected  (GimpCageConfig *gcc,
                                                         gint point_number);

gcc :

the cage config

point_number :

the index of the point to test

Returns :

TRUE if the point is selected, FALSE otherwise.

gimp_cage_config_remove_cage_point ()

void                gimp_cage_config_remove_cage_point  (GimpCageConfig *gcc,
                                                         gint point_number);

Remove the given point from the cage

gcc :

the cage config

point_number :

the index of the point to remove

gimp_cage_config_remove_last_cage_point ()

void                gimp_cage_config_remove_last_cage_point
                                                        (GimpCageConfig *gcc);

Remove the last point of the cage, in both source and destination cage

gcc :

the cage config

gimp_cage_config_remove_selected_points ()

void                gimp_cage_config_remove_selected_points
                                                        (GimpCageConfig *gcc);

Remove all the selected points from the cage

gcc :

the cage config

gimp_cage_config_reset_displacement ()

void                gimp_cage_config_reset_displacement (GimpCageConfig *gcc);

Set the displacement to zero.

gcc :

the cage config

gimp_cage_config_reverse_cage ()

void                gimp_cage_config_reverse_cage       (GimpCageConfig *gcc);

When using non-simple cage (like a cage in 8), user may want to manually inverse inside and outside of the cage. This function reverse the cage

gcc :

the cage config

gimp_cage_config_reverse_cage_if_needed ()

void                gimp_cage_config_reverse_cage_if_needed
                                                        (GimpCageConfig *gcc);

Since the cage need to be defined counter-clockwise to have the topological inside in the actual 'physical' inside of the cage, this function compute if the cage is clockwise or not, and reverse the cage if needed.

This function does not take into account an eventual displacement

gcc :

the cage config

gimp_cage_config_select_add_area ()

void                gimp_cage_config_select_add_area    (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         GeglRectangle area);

Select cage's point inside the given area. Already selected point stay selected.

gcc :

the cage config

mode :

the actual mode of the cage, GIMP_CAGE_MODE_CAGE_CHANGE or GIMP_CAGE_MODE_DEFORM

area :

the area to select

gimp_cage_config_select_area ()

void                gimp_cage_config_select_area        (GimpCageConfig *gcc,
                                                         GimpCageMode mode,
                                                         GeglRectangle area);

Select cage's point inside the given area and deselect others

gcc :

the cage config

mode :

the actual mode of the cage, GIMP_CAGE_MODE_CAGE_CHANGE or GIMP_CAGE_MODE_DEFORM

area :

the area to select

gimp_cage_config_select_point ()

void                gimp_cage_config_select_point       (GimpCageConfig *gcc,
                                                         gint point_number);

Select the given point of the cage, and deselect the others.

gcc :

the cage config

point_number :

the index of the point to select

gimp_cage_config_toggle_point_selection ()

void                gimp_cage_config_toggle_point_selection
                                                        (GimpCageConfig *gcc,
                                                         gint point_number);

Toggle the selection of the given cage point

gcc :

the cage config

point_number :

the index of the point to toggle selection