mirror of https://github.com/GNOME/gimp.git
Bug 658477 - add PDB support for more paint and ink options
Apply heavily modified patch from Es Swartz which adds PDB API for brush size, angle and aspect ratio, as well as a full interface for ink. Changed to patch to add all procedures to the "context" group instead of creating new PDB groups, properly use the new GimpPDBContext APIs for paint options, and did some general cleanup. (Warning, completely untested).
This commit is contained in:
parent
c2f68b59a3
commit
b952f80be0
|
@ -86,7 +86,7 @@ typedef enum
|
|||
|
||||
GType gimp_ink_blob_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum /*< pdb-skip >*/
|
||||
typedef enum
|
||||
{
|
||||
GIMP_INK_BLOB_TYPE_CIRCLE, /*< desc="Circle" >*/
|
||||
GIMP_INK_BLOB_TYPE_SQUARE, /*< desc="Square" >*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,6 +31,7 @@
|
|||
#include "core/gimplist.h"
|
||||
#include "core/gimppaintinfo.h"
|
||||
|
||||
#include "paint/gimpbrushcore.h"
|
||||
#include "paint/gimppaintoptions.h"
|
||||
|
||||
#include "gimppdbcontext.h"
|
||||
|
@ -394,3 +395,24 @@ gimp_pdb_context_get_paint_options (GimpPDBContext *context,
|
|||
return (GimpPaintOptions *)
|
||||
gimp_container_get_child_by_name (context->paint_options_list, name);
|
||||
}
|
||||
|
||||
GList *
|
||||
gimp_pdb_context_get_brush_options (GimpPDBContext *context)
|
||||
{
|
||||
GList *brush_options = NULL;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
|
||||
|
||||
for (list = GIMP_LIST (context->paint_options_list)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpPaintOptions *options = list->data;
|
||||
|
||||
if (g_type_is_a (options->paint_info->paint_type, GIMP_TYPE_BRUSH_CORE))
|
||||
brush_options = g_list_prepend (brush_options, options);
|
||||
}
|
||||
|
||||
return g_list_reverse (brush_options);
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ GimpContext * gimp_pdb_context_new (Gimp *gimp,
|
|||
|
||||
GimpPaintOptions * gimp_pdb_context_get_paint_options (GimpPDBContext *context,
|
||||
const gchar *name);
|
||||
GList * gimp_pdb_context_get_brush_options (GimpPDBContext *context);
|
||||
|
||||
|
||||
#endif /* __GIMP_PDB_CONTEXT_H__ */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 640 procedures registered total */
|
||||
/* 663 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -72,12 +72,23 @@ EXPORTS
|
|||
gimp_context_get_antialias
|
||||
gimp_context_get_background
|
||||
gimp_context_get_brush
|
||||
gimp_context_get_brush_angle
|
||||
gimp_context_get_brush_aspect_ratio
|
||||
gimp_context_get_brush_size
|
||||
gimp_context_get_dynamics
|
||||
gimp_context_get_feather
|
||||
gimp_context_get_feather_radius
|
||||
gimp_context_get_font
|
||||
gimp_context_get_foreground
|
||||
gimp_context_get_gradient
|
||||
gimp_context_get_ink_angle
|
||||
gimp_context_get_ink_blob_angle
|
||||
gimp_context_get_ink_blob_aspect_ratio
|
||||
gimp_context_get_ink_blob_type
|
||||
gimp_context_get_ink_size
|
||||
gimp_context_get_ink_size_sensitivity
|
||||
gimp_context_get_ink_speed_sensitivity
|
||||
gimp_context_get_ink_tilt_sensitivity
|
||||
gimp_context_get_interpolation
|
||||
gimp_context_get_opacity
|
||||
gimp_context_get_paint_method
|
||||
|
@ -98,6 +109,10 @@ EXPORTS
|
|||
gimp_context_set_antialias
|
||||
gimp_context_set_background
|
||||
gimp_context_set_brush
|
||||
gimp_context_set_brush_angle
|
||||
gimp_context_set_brush_aspect_ratio
|
||||
gimp_context_set_brush_default_size
|
||||
gimp_context_set_brush_size
|
||||
gimp_context_set_default_colors
|
||||
gimp_context_set_defaults
|
||||
gimp_context_set_dynamics
|
||||
|
@ -106,6 +121,14 @@ EXPORTS
|
|||
gimp_context_set_font
|
||||
gimp_context_set_foreground
|
||||
gimp_context_set_gradient
|
||||
gimp_context_set_ink_angle
|
||||
gimp_context_set_ink_blob_angle
|
||||
gimp_context_set_ink_blob_aspect_ratio
|
||||
gimp_context_set_ink_blob_type
|
||||
gimp_context_set_ink_size
|
||||
gimp_context_set_ink_size_sensitivity
|
||||
gimp_context_set_ink_speed_sensitivity
|
||||
gimp_context_set_ink_tilt_sensitivity
|
||||
gimp_context_set_interpolation
|
||||
gimp_context_set_opacity
|
||||
gimp_context_set_paint_method
|
||||
|
|
|
@ -634,6 +634,222 @@ gimp_context_set_brush (const gchar *name)
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_brush_size:
|
||||
* @size: brush size in pixels.
|
||||
*
|
||||
* Get brush size in pixels.
|
||||
*
|
||||
* Get the brush size in pixels for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_get_brush_size (gdouble size)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-brush-size",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, size,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_brush_size:
|
||||
* @size: brush size in pixels.
|
||||
*
|
||||
* Set brush size in pixels.
|
||||
*
|
||||
* Set the brush size in pixels for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_brush_size (gdouble size)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-brush-size",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, size,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_brush_default_size:
|
||||
*
|
||||
* Set brush size to its default.
|
||||
*
|
||||
* Set the brush size to the default (max of width and height) for
|
||||
* paintbrush, airbrush, or pencil tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_brush_default_size (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-brush-default-size",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_brush_aspect_ratio:
|
||||
* @aspect: aspect ratio.
|
||||
*
|
||||
* Get brush aspect ratio.
|
||||
*
|
||||
* Set the aspect ratio for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_get_brush_aspect_ratio (gdouble aspect)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-brush-aspect-ratio",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, aspect,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_brush_aspect_ratio:
|
||||
* @aspect: aspect ratio.
|
||||
*
|
||||
* Set brush aspect ratio.
|
||||
*
|
||||
* Set the aspect ratio for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_brush_aspect_ratio (gdouble aspect)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-brush-aspect-ratio",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, aspect,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_brush_angle:
|
||||
* @angle: angle in degrees.
|
||||
*
|
||||
* Get brush angle in degrees.
|
||||
*
|
||||
* Set the angle in degrees for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_get_brush_angle (gdouble angle)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-brush-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_brush_angle:
|
||||
* @angle: angle in degrees.
|
||||
*
|
||||
* Set brush angle in degrees.
|
||||
*
|
||||
* Set the angle in degrees for brush based paint tools.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_brush_angle (gdouble angle)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-brush-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_dynamics:
|
||||
*
|
||||
|
@ -1790,3 +2006,491 @@ gimp_context_set_transform_recursion (gint transform_recursion)
|
|||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_size:
|
||||
*
|
||||
* Get ink blob size in pixels.
|
||||
*
|
||||
* Get the ink blob size in pixels for ink tool.
|
||||
*
|
||||
* Returns: ink blob size in pixels.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_size (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble size = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-size",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
size = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_size:
|
||||
* @size: ink blob size in pixels.
|
||||
*
|
||||
* Set ink blob size in pixels.
|
||||
*
|
||||
* Set the ink blob size in pixels for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_size (gdouble size)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-size",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, size,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_angle:
|
||||
*
|
||||
* Get ink angle in degrees.
|
||||
*
|
||||
* Get the ink angle in degrees for ink tool.
|
||||
*
|
||||
* Returns: ink angle in degrees.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_angle (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble angle = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
angle = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_angle:
|
||||
* @angle: ink angle in degrees.
|
||||
*
|
||||
* Set ink angle in degrees.
|
||||
*
|
||||
* Set the ink angle in degrees for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_angle (gdouble angle)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_size_sensitivity:
|
||||
*
|
||||
* Get ink size sensitivity.
|
||||
*
|
||||
* Get the ink size sensitivity for ink tool.
|
||||
*
|
||||
* Returns: ink size sensitivity.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_size_sensitivity (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble size = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-size-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
size = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_size_sensitivity:
|
||||
* @size: ink size sensitivity.
|
||||
*
|
||||
* Set ink size sensitivity.
|
||||
*
|
||||
* Set the ink size sensitivity for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_size_sensitivity (gdouble size)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-size-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, size,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_tilt_sensitivity:
|
||||
*
|
||||
* Get ink tilt sensitivity.
|
||||
*
|
||||
* Get the ink tilt sensitivity for ink tool.
|
||||
*
|
||||
* Returns: ink tilt sensitivity.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_tilt_sensitivity (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble tilt = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-tilt-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
tilt = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return tilt;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_tilt_sensitivity:
|
||||
* @tilt: ink tilt sensitivity.
|
||||
*
|
||||
* Set ink tilt sensitivity.
|
||||
*
|
||||
* Set the ink tilt sensitivity for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_tilt_sensitivity (gdouble tilt)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-tilt-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, tilt,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_speed_sensitivity:
|
||||
*
|
||||
* Get ink speed sensitivity.
|
||||
*
|
||||
* Get the ink speed sensitivity for ink tool.
|
||||
*
|
||||
* Returns: ink speed sensitivity.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_speed_sensitivity (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble speed = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-speed-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
speed = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_speed_sensitivity:
|
||||
* @speed: ink speed sensitivity.
|
||||
*
|
||||
* Set ink speed sensitivity.
|
||||
*
|
||||
* Set the ink speed sensitivity for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_speed_sensitivity (gdouble speed)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-speed-sensitivity",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, speed,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_blob_type:
|
||||
*
|
||||
* Get ink blob type.
|
||||
*
|
||||
* Get the ink blob type for ink tool.
|
||||
*
|
||||
* Returns: Ink blob type.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
GimpInkBlobType
|
||||
gimp_context_get_ink_blob_type (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
GimpInkBlobType type = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-type",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
type = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_blob_type:
|
||||
* @type: Ink blob type.
|
||||
*
|
||||
* Set ink blob type.
|
||||
*
|
||||
* Set the ink blob type for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_blob_type (GimpInkBlobType type)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-type",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, type,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_blob_aspect_ratio:
|
||||
*
|
||||
* Get ink blob aspect ratio.
|
||||
*
|
||||
* Get the ink blob aspect ratio for ink tool.
|
||||
*
|
||||
* Returns: ink blob aspect ratio.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_blob_aspect_ratio (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble aspect = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-aspect-ratio",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
aspect = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return aspect;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_blob_aspect_ratio:
|
||||
* @aspect: ink blob aspect ratio.
|
||||
*
|
||||
* Set ink blob aspect ratio.
|
||||
*
|
||||
* Set the ink blob aspect ratio for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_blob_aspect_ratio (gdouble aspect)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-aspect-ratio",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, aspect,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_ink_blob_angle:
|
||||
*
|
||||
* Get ink blob angle in degrees.
|
||||
*
|
||||
* Get the ink blob angle in degrees for ink tool.
|
||||
*
|
||||
* Returns: ink blob angle in degrees.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_ink_blob_angle (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble angle = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
angle = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_ink_blob_angle:
|
||||
* @angle: ink blob angle in degrees.
|
||||
*
|
||||
* Set ink blob angle in degrees.
|
||||
*
|
||||
* Set the ink blob angle in degrees for ink tool.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_ink_blob_angle (gdouble angle)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-angle",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -32,61 +32,84 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gboolean gimp_context_push (void);
|
||||
gboolean gimp_context_pop (void);
|
||||
gboolean gimp_context_set_defaults (void);
|
||||
gboolean gimp_context_list_paint_methods (gint *num_paint_methods,
|
||||
gchar ***paint_methods);
|
||||
gchar* gimp_context_get_paint_method (void);
|
||||
gboolean gimp_context_set_paint_method (const gchar *name);
|
||||
gboolean gimp_context_get_foreground (GimpRGB *foreground);
|
||||
gboolean gimp_context_set_foreground (const GimpRGB *foreground);
|
||||
gboolean gimp_context_get_background (GimpRGB *background);
|
||||
gboolean gimp_context_set_background (const GimpRGB *background);
|
||||
gboolean gimp_context_set_default_colors (void);
|
||||
gboolean gimp_context_swap_colors (void);
|
||||
gdouble gimp_context_get_opacity (void);
|
||||
gboolean gimp_context_set_opacity (gdouble opacity);
|
||||
GimpLayerModeEffects gimp_context_get_paint_mode (void);
|
||||
gboolean gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode);
|
||||
gchar* gimp_context_get_brush (void);
|
||||
gboolean gimp_context_set_brush (const gchar *name);
|
||||
gchar* gimp_context_get_dynamics (void);
|
||||
gboolean gimp_context_set_dynamics (const gchar *name);
|
||||
gchar* gimp_context_get_pattern (void);
|
||||
gboolean gimp_context_set_pattern (const gchar *name);
|
||||
gchar* gimp_context_get_gradient (void);
|
||||
gboolean gimp_context_set_gradient (const gchar *name);
|
||||
gchar* gimp_context_get_palette (void);
|
||||
gboolean gimp_context_set_palette (const gchar *name);
|
||||
gchar* gimp_context_get_font (void);
|
||||
gboolean gimp_context_set_font (const gchar *name);
|
||||
gboolean gimp_context_get_antialias (void);
|
||||
gboolean gimp_context_set_antialias (gboolean antialias);
|
||||
gboolean gimp_context_get_feather (void);
|
||||
gboolean gimp_context_set_feather (gboolean feather);
|
||||
gboolean gimp_context_get_feather_radius (gdouble *feather_radius_x,
|
||||
gdouble *feather_radius_y);
|
||||
gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
|
||||
gdouble feather_radius_y);
|
||||
gboolean gimp_context_get_sample_merged (void);
|
||||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpSelectCriterion gimp_context_get_sample_criterion (void);
|
||||
gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
|
||||
gdouble gimp_context_get_sample_threshold (void);
|
||||
gboolean gimp_context_set_sample_threshold (gdouble sample_threshold);
|
||||
gint gimp_context_get_sample_threshold_int (void);
|
||||
gboolean gimp_context_set_sample_threshold_int (gint sample_threshold);
|
||||
gboolean gimp_context_get_sample_transparent (void);
|
||||
gboolean gimp_context_set_sample_transparent (gboolean sample_transparent);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
gboolean gimp_context_set_transform_direction (GimpTransformDirection transform_direction);
|
||||
GimpTransformResize gimp_context_get_transform_resize (void);
|
||||
gboolean gimp_context_set_transform_resize (GimpTransformResize transform_resize);
|
||||
gint gimp_context_get_transform_recursion (void);
|
||||
gboolean gimp_context_set_transform_recursion (gint transform_recursion);
|
||||
gboolean gimp_context_push (void);
|
||||
gboolean gimp_context_pop (void);
|
||||
gboolean gimp_context_set_defaults (void);
|
||||
gboolean gimp_context_list_paint_methods (gint *num_paint_methods,
|
||||
gchar ***paint_methods);
|
||||
gchar* gimp_context_get_paint_method (void);
|
||||
gboolean gimp_context_set_paint_method (const gchar *name);
|
||||
gboolean gimp_context_get_foreground (GimpRGB *foreground);
|
||||
gboolean gimp_context_set_foreground (const GimpRGB *foreground);
|
||||
gboolean gimp_context_get_background (GimpRGB *background);
|
||||
gboolean gimp_context_set_background (const GimpRGB *background);
|
||||
gboolean gimp_context_set_default_colors (void);
|
||||
gboolean gimp_context_swap_colors (void);
|
||||
gdouble gimp_context_get_opacity (void);
|
||||
gboolean gimp_context_set_opacity (gdouble opacity);
|
||||
GimpLayerModeEffects gimp_context_get_paint_mode (void);
|
||||
gboolean gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode);
|
||||
gchar* gimp_context_get_brush (void);
|
||||
gboolean gimp_context_set_brush (const gchar *name);
|
||||
gboolean gimp_context_get_brush_size (gdouble size);
|
||||
gboolean gimp_context_set_brush_size (gdouble size);
|
||||
gboolean gimp_context_set_brush_default_size (void);
|
||||
gboolean gimp_context_get_brush_aspect_ratio (gdouble aspect);
|
||||
gboolean gimp_context_set_brush_aspect_ratio (gdouble aspect);
|
||||
gboolean gimp_context_get_brush_angle (gdouble angle);
|
||||
gboolean gimp_context_set_brush_angle (gdouble angle);
|
||||
gchar* gimp_context_get_dynamics (void);
|
||||
gboolean gimp_context_set_dynamics (const gchar *name);
|
||||
gchar* gimp_context_get_pattern (void);
|
||||
gboolean gimp_context_set_pattern (const gchar *name);
|
||||
gchar* gimp_context_get_gradient (void);
|
||||
gboolean gimp_context_set_gradient (const gchar *name);
|
||||
gchar* gimp_context_get_palette (void);
|
||||
gboolean gimp_context_set_palette (const gchar *name);
|
||||
gchar* gimp_context_get_font (void);
|
||||
gboolean gimp_context_set_font (const gchar *name);
|
||||
gboolean gimp_context_get_antialias (void);
|
||||
gboolean gimp_context_set_antialias (gboolean antialias);
|
||||
gboolean gimp_context_get_feather (void);
|
||||
gboolean gimp_context_set_feather (gboolean feather);
|
||||
gboolean gimp_context_get_feather_radius (gdouble *feather_radius_x,
|
||||
gdouble *feather_radius_y);
|
||||
gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
|
||||
gdouble feather_radius_y);
|
||||
gboolean gimp_context_get_sample_merged (void);
|
||||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpSelectCriterion gimp_context_get_sample_criterion (void);
|
||||
gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
|
||||
gdouble gimp_context_get_sample_threshold (void);
|
||||
gboolean gimp_context_set_sample_threshold (gdouble sample_threshold);
|
||||
gint gimp_context_get_sample_threshold_int (void);
|
||||
gboolean gimp_context_set_sample_threshold_int (gint sample_threshold);
|
||||
gboolean gimp_context_get_sample_transparent (void);
|
||||
gboolean gimp_context_set_sample_transparent (gboolean sample_transparent);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
gboolean gimp_context_set_transform_direction (GimpTransformDirection transform_direction);
|
||||
GimpTransformResize gimp_context_get_transform_resize (void);
|
||||
gboolean gimp_context_set_transform_resize (GimpTransformResize transform_resize);
|
||||
gint gimp_context_get_transform_recursion (void);
|
||||
gboolean gimp_context_set_transform_recursion (gint transform_recursion);
|
||||
gdouble gimp_context_get_ink_size (void);
|
||||
gboolean gimp_context_set_ink_size (gdouble size);
|
||||
gdouble gimp_context_get_ink_angle (void);
|
||||
gboolean gimp_context_set_ink_angle (gdouble angle);
|
||||
gdouble gimp_context_get_ink_size_sensitivity (void);
|
||||
gboolean gimp_context_set_ink_size_sensitivity (gdouble size);
|
||||
gdouble gimp_context_get_ink_tilt_sensitivity (void);
|
||||
gboolean gimp_context_set_ink_tilt_sensitivity (gdouble tilt);
|
||||
gdouble gimp_context_get_ink_speed_sensitivity (void);
|
||||
gboolean gimp_context_set_ink_speed_sensitivity (gdouble speed);
|
||||
GimpInkBlobType gimp_context_get_ink_blob_type (void);
|
||||
gboolean gimp_context_set_ink_blob_type (GimpInkBlobType type);
|
||||
gdouble gimp_context_get_ink_blob_aspect_ratio (void);
|
||||
gboolean gimp_context_set_ink_blob_aspect_ratio (gdouble aspect);
|
||||
gdouble gimp_context_get_ink_blob_angle (void);
|
||||
gboolean gimp_context_set_ink_blob_angle (gdouble angle);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -28,6 +28,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
|
|||
gimp_icon_type_get_type,
|
||||
gimp_image_base_type_get_type,
|
||||
gimp_image_type_get_type,
|
||||
gimp_ink_blob_type_get_type,
|
||||
gimp_interpolation_type_get_type,
|
||||
gimp_layer_mode_effects_get_type,
|
||||
gimp_mask_apply_mode_get_type,
|
||||
|
@ -84,6 +85,7 @@ static const gchar * const type_names[] =
|
|||
"GimpIconType",
|
||||
"GimpImageBaseType",
|
||||
"GimpImageType",
|
||||
"GimpInkBlobType",
|
||||
"GimpInterpolationType",
|
||||
"GimpLayerModeEffects",
|
||||
"GimpMaskApplyMode",
|
||||
|
|
|
@ -167,6 +167,18 @@ typedef enum
|
|||
} GimpHueRange;
|
||||
|
||||
|
||||
#define GIMP_TYPE_INK_BLOB_TYPE (gimp_ink_blob_type_get_type ())
|
||||
|
||||
GType gimp_ink_blob_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_INK_BLOB_TYPE_CIRCLE,
|
||||
GIMP_INK_BLOB_TYPE_SQUARE,
|
||||
GIMP_INK_BLOB_TYPE_DIAMOND
|
||||
} GimpInkBlobType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_LAYER_MODE_EFFECTS (gimp_layer_mode_effects_get_type ())
|
||||
|
||||
GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
|
||||
|
|
|
@ -622,6 +622,16 @@ package Gimp::CodeGen::enums;
|
|||
symbols => [ qw(GIMP_BLUR_CONVOLVE GIMP_SHARPEN_CONVOLVE) ],
|
||||
mapping => { GIMP_BLUR_CONVOLVE => '0',
|
||||
GIMP_SHARPEN_CONVOLVE => '1' }
|
||||
},
|
||||
GimpInkBlobType =>
|
||||
{ contig => 1,
|
||||
header => 'paint/paint-enums.h',
|
||||
symbols => [ qw(GIMP_INK_BLOB_TYPE_CIRCLE
|
||||
GIMP_INK_BLOB_TYPE_SQUARE
|
||||
GIMP_INK_BLOB_TYPE_DIAMOND) ],
|
||||
mapping => { GIMP_INK_BLOB_TYPE_CIRCLE => '0',
|
||||
GIMP_INK_BLOB_TYPE_SQUARE => '1',
|
||||
GIMP_INK_BLOB_TYPE_DIAMOND => '2' }
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -487,6 +487,224 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub context_get_brush_size {
|
||||
$blurb = 'Get brush size in pixels.';
|
||||
$help = 'Get the brush size in pixels for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "size", type => "0 < float",
|
||||
desc => "brush size in pixels" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
/* all options should have the same value, so pick a random one */
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-paintbrush");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"brush-size", &size,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_brush_size {
|
||||
$blurb = 'Set brush size in pixels.';
|
||||
$help = 'Set the brush size in pixels for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "size", type => "0 < float",
|
||||
desc => "brush size in pixels" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *options;
|
||||
GList *list;
|
||||
|
||||
options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
|
||||
|
||||
for (list = options; list; list = g_list_next (list))
|
||||
g_object_set (list->data,
|
||||
"brush-size", (gdouble) size,
|
||||
NULL);
|
||||
|
||||
g_list_free (options);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_brush_default_size {
|
||||
$blurb = 'Set brush size to its default.';
|
||||
$help = <<'HELP';
|
||||
Set the brush size to the default (max of width and height) for
|
||||
paintbrush, airbrush, or pencil tools.
|
||||
HELP
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpBrush *brush = gimp_context_get_brush (context);
|
||||
|
||||
if (brush)
|
||||
{
|
||||
GList *options;
|
||||
GList *list;
|
||||
|
||||
options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
|
||||
|
||||
for (list = options; list; list = g_list_next (list))
|
||||
g_object_set (list->data,
|
||||
"brush-size", (gdouble) MAX (brush->mask->width,
|
||||
brush->mask->height),
|
||||
NULL);
|
||||
|
||||
g_list_free (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_brush_aspect_ratio {
|
||||
$blurb = 'Set brush aspect ratio.';
|
||||
$help = 'Set the aspect ratio for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "aspect", type => "-20 <= float <= 20",
|
||||
desc => "aspect ratio" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *options;
|
||||
GList *list;
|
||||
|
||||
options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
|
||||
|
||||
for (list = options; list; list = g_list_next (list))
|
||||
g_object_set (list->data,
|
||||
"brush-aspect-ratio", (gdouble) aspect,
|
||||
NULL);
|
||||
|
||||
g_list_free (options);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_brush_aspect_ratio {
|
||||
$blurb = 'Get brush aspect ratio.';
|
||||
$help = 'Set the aspect ratio for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "aspect", type => "-20 <= float <= 20",
|
||||
desc => "aspect ratio" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
/* all options should have the same value, so pick a random one */
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-paintbrush");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"brush-aspect-ratio", &aspect,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_brush_angle {
|
||||
$blurb = 'Set brush angle in degrees.';
|
||||
$help = 'Set the angle in degrees for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "angle", type => "-180 <= float <= 180",
|
||||
desc => "angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *options;
|
||||
GList *list;
|
||||
|
||||
options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
|
||||
|
||||
for (list = options; list; list = g_list_next (list))
|
||||
g_object_set (list->data,
|
||||
"brush-angle", (gdouble) angle,
|
||||
NULL);
|
||||
|
||||
g_list_free (options);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_brush_angle {
|
||||
$blurb = 'Get brush angle in degrees.';
|
||||
$help = 'Set the angle in degrees for brush based paint tools.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "angle", type => "-180 <= float <= 180",
|
||||
desc => "angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
/* all options should have the same value, so pick a random one */
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-paintbrush");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"brush-angle", &angle,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_dynamics {
|
||||
$blurb = 'Retrieve the currently active paint dynamics.';
|
||||
|
||||
|
@ -1495,7 +1713,491 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
@headers = qw("core/gimp.h"
|
||||
sub context_get_ink_size {
|
||||
$blurb = 'Get ink blob size in pixels.';
|
||||
$help = 'Get the ink blob size in pixels for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "size", type => "0 <= float <= 200",
|
||||
desc => "ink blob size in pixels" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"size", &size,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_size {
|
||||
$blurb = 'Set ink blob size in pixels.';
|
||||
$help = 'Set the ink blob size in pixels for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "size", type => "0 <= float <= 200",
|
||||
desc => "ink blob size in pixels" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"size", size,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_angle {
|
||||
$blurb = 'Get ink angle in degrees.';
|
||||
$help = 'Get the ink angle in degrees for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "angle", type => "-90 <= float <= 90",
|
||||
desc => "ink angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"tilt-angle", &angle,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_angle {
|
||||
$blurb = 'Set ink angle in degrees.';
|
||||
$help = 'Set the ink angle in degrees for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "angle", type => "-90 <= float <= 90",
|
||||
desc => "ink angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"tilt-angle", angle,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_size_sensitivity {
|
||||
$blurb = 'Get ink size sensitivity.';
|
||||
$help = 'Get the ink size sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "size", type => "0 <= float <= 1",
|
||||
desc => "ink size sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"size-sensitivity", &size,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_size_sensitivity {
|
||||
$blurb = 'Set ink size sensitivity.';
|
||||
$help = 'Set the ink size sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "size", type => "0 <= float <= 1",
|
||||
desc => "ink size sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"size-sensitivity", size,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_tilt_sensitivity {
|
||||
$blurb = 'Get ink tilt sensitivity.';
|
||||
$help = 'Get the ink tilt sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "tilt", type => "0 <= float <= 1",
|
||||
desc => "ink tilt sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"tilt-sensitivity", &tilt,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_tilt_sensitivity {
|
||||
$blurb = 'Set ink tilt sensitivity.';
|
||||
$help = 'Set the ink tilt sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "tilt", type => "0 <= float <= 1",
|
||||
desc => "ink tilt sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"tilt-sensitivity", tilt,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_speed_sensitivity {
|
||||
$blurb = 'Get ink speed sensitivity.';
|
||||
$help = 'Get the ink speed sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "speed", type => "0 <= float <= 1",
|
||||
desc => "ink speed sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"vel-sensitivity", &speed,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_speed_sensitivity {
|
||||
$blurb = 'Set ink speed sensitivity.';
|
||||
$help = 'Set the ink speed sensitivity for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "speed", type => "0 <= float <= 1",
|
||||
desc => "ink speed sensitivity" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"vel-sensitivity", speed,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_blob_type {
|
||||
$blurb = 'Get ink blob type.';
|
||||
$help = 'Get the ink blob type for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "type", type => "enum GimpInkBlobType",
|
||||
desc => "Ink blob type" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"blob-type", &type,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_blob_type {
|
||||
$blurb = 'Set ink blob type.';
|
||||
$help = 'Set the ink blob type for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "type", type => "enum GimpInkBlobType",
|
||||
desc => "Ink blob type" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"blob-type", type,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_blob_aspect_ratio {
|
||||
$blurb = 'Get ink blob aspect ratio.';
|
||||
$help = 'Get the ink blob aspect ratio for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "aspect", type => "1 <= float <= 10",
|
||||
desc => "ink blob aspect ratio" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_get (options,
|
||||
"blob-aspect", &aspect,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_blob_aspect_ratio {
|
||||
$blurb = 'Set ink blob aspect ratio.';
|
||||
$help = 'Set the ink blob aspect ratio for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "aspect", type => "1 <= float <= 10",
|
||||
desc => "ink blob aspect ratio" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"blob-aspect", aspect,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_get_ink_blob_angle {
|
||||
$blurb = 'Get ink blob angle in degrees.';
|
||||
$help = 'Get the ink blob angle in degrees for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => "angle", type => "-180 <= float <= 180",
|
||||
desc => "ink blob angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
{
|
||||
g_object_get (options,
|
||||
"blob-angle", &angle,
|
||||
NULL);
|
||||
angle *= (180-0 / G_PI);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub context_set_ink_blob_angle {
|
||||
$blurb = 'Set ink blob angle in degrees.';
|
||||
$help = 'Set the ink blob angle in degrees for ink tool.';
|
||||
|
||||
&ejs_pdb_misc('2012', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => "angle", type => "-180 <= float <= 180",
|
||||
desc => "ink blob angle in degrees" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpPaintOptions *options =
|
||||
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
|
||||
"gimp-ink");
|
||||
|
||||
if (options)
|
||||
g_object_set (options,
|
||||
"blob-angle", (gdouble) angle * G_PI / 180.0,
|
||||
NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
@headers = qw("base/temp-buf.h"
|
||||
"core/gimp.h"
|
||||
"core/gimpbrush.h"
|
||||
"core/gimpcontainer.h"
|
||||
"core/gimpdatafactory.h"
|
||||
"libgimpconfig/gimpconfig.h"
|
||||
|
@ -1515,6 +2217,10 @@ CODE
|
|||
context_get_opacity context_set_opacity
|
||||
context_get_paint_mode context_set_paint_mode
|
||||
context_get_brush context_set_brush
|
||||
context_get_brush_size
|
||||
context_set_brush_size context_set_brush_default_size
|
||||
context_get_brush_aspect_ratio context_set_brush_aspect_ratio
|
||||
context_get_brush_angle context_set_brush_angle
|
||||
context_get_dynamics context_set_dynamics
|
||||
context_get_pattern context_set_pattern
|
||||
context_get_gradient context_set_gradient
|
||||
|
@ -1531,7 +2237,15 @@ CODE
|
|||
context_get_interpolation context_set_interpolation
|
||||
context_get_transform_direction context_set_transform_direction
|
||||
context_get_transform_resize context_set_transform_resize
|
||||
context_get_transform_recursion context_set_transform_recursion);
|
||||
context_get_transform_recursion context_set_transform_recursion
|
||||
context_get_ink_size context_set_ink_size
|
||||
context_get_ink_angle context_set_ink_angle
|
||||
context_get_ink_size_sensitivity context_set_ink_size_sensitivity
|
||||
context_get_ink_tilt_sensitivity context_set_ink_tilt_sensitivity
|
||||
context_get_ink_speed_sensitivity context_set_ink_speed_sensitivity
|
||||
context_get_ink_blob_type context_set_ink_blob_type
|
||||
context_get_ink_blob_aspect_ratio context_set_ink_blob_aspect_ratio
|
||||
context_get_ink_blob_angle context_set_ink_blob_angle);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
|
|
@ -69,6 +69,10 @@ sub david_pdb_misc {
|
|||
contrib_pdb_misc('David Gowers', '', @_);
|
||||
}
|
||||
|
||||
sub ejs_pdb_misc {
|
||||
contrib_pdb_misc('Ed Swartz', '', @_);
|
||||
}
|
||||
|
||||
sub federico_pdb_misc {
|
||||
contrib_pdb_misc('Federico Mena Quintero', '', @_);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue