本文整理匯總了C++中GIMP_IS_DISPLAY_SHELL函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_IS_DISPLAY_SHELL函數的具體用法?C++ GIMP_IS_DISPLAY_SHELL怎麽用?C++ GIMP_IS_DISPLAY_SHELL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_IS_DISPLAY_SHELL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_display_shell_rotate_xy
/**
* gimp_display_shell_rotate_xy:
* @shell:
* @x:
* @y:
* @nx:
* @ny:
*
* Rotates an unrotated display coordinate to a rotated shell coordinate.
**/
void
gimp_display_shell_rotate_xy (const GimpDisplayShell *shell,
gdouble x,
gdouble y,
gint *nx,
gint *ny)
{
gint64 tx;
gint64 ty;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL);
if (shell->rotate_transform)
cairo_matrix_transform_point (shell->rotate_transform, &x, &y);
tx = x;
ty = y;
/* The projected coordinates might overflow a gint in the case of
* big images at high zoom levels, so we clamp them here to avoid
* problems.
*/
*nx = CLAMP (tx, G_MININT, G_MAXINT);
*ny = CLAMP (ty, G_MININT, G_MAXINT);
}
示例2: gimp_display_shell_scroll_set_offset
/**
* gimp_display_shell_scroll_set_offsets:
* @shell:
* @offset_x:
* @offset_y:
*
* This function scrolls the image in the shell's viewport. It redraws
* the entire canvas.
*
* Use it for setting the scroll offset on freshly scaled images or
* when the window is resized. For panning, use
* gimp_display_shell_scroll().
**/
void
gimp_display_shell_scroll_set_offset (GimpDisplayShell *shell,
gint offset_x,
gint offset_y)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (shell->offset_x == offset_x &&
shell->offset_y == offset_y)
return;
gimp_display_shell_scale_save_revert_values (shell);
/* freeze the active tool */
gimp_display_shell_pause (shell);
shell->offset_x = offset_x;
shell->offset_y = offset_y;
gimp_display_shell_scroll_clamp_and_update (shell);
gimp_display_shell_scrolled (shell);
gimp_display_shell_expose_full (shell);
/* re-enable the active tool */
gimp_display_shell_resume (shell);
}
示例3: gimp_display_shell_layer_select_init
void
gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
gint move,
guint32 time)
{
LayerSelect *layer_select;
GimpImage *image;
GimpLayer *layer;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
image = gimp_display_get_image (shell->display);
layer = gimp_image_get_active_layer (image);
if (! layer)
return;
layer_select = layer_select_new (image, layer,
image->gimp->config->layer_preview_size);
layer_select_advance (layer_select, move);
gtk_window_set_screen (GTK_WINDOW (layer_select->window),
gtk_widget_get_screen (GTK_WIDGET (shell)));
gtk_widget_show (layer_select->window);
gdk_keyboard_grab (gtk_widget_get_window (layer_select->window), FALSE, time);
}
示例4: gimp_display_shell_scale_image_is_within_viewport
/**
* gimp_display_shell_scale_image_is_within_viewport:
* @shell:
*
* Returns: %TRUE if the (scaled) image is smaller than and within the
* viewport.
**/
gboolean
gimp_display_shell_scale_image_is_within_viewport (GimpDisplayShell *shell,
gboolean *horizontally,
gboolean *vertically)
{
gint sw, sh;
gboolean horizontally_dummy, vertically_dummy;
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
if (! horizontally) horizontally = &horizontally_dummy;
if (! vertically) vertically = &vertically_dummy;
gimp_display_shell_scale_get_image_size (shell, &sw, &sh);
*horizontally = sw <= shell->disp_width &&
shell->offset_x <= 0 &&
shell->offset_x >= sw - shell->disp_width;
*vertically = sh <= shell->disp_height &&
shell->offset_y <= 0 &&
shell->offset_y >= sh - shell->disp_height;
return *vertically && *horizontally;
}
示例5: gimp_display_shell_scale_by_values
/**
* gimp_display_shell_scale_by_values:
* @shell: the #GimpDisplayShell
* @scale: the new scale
* @offset_x: the new X offset
* @offset_y: the new Y offset
* @resize_window: whether the display window should be resized
*
* Directly sets the image scale and image offsets used by the display. If
* @resize_window is %TRUE then the display window is resized to better
* accommodate the image, see gimp_display_shell_shrink_wrap().
**/
void
gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gdouble scale,
gint offset_x,
gint offset_y,
gboolean resize_window)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
/* Abort early if the values are all setup already. We don't
* want to inadvertently resize the window (bug #164281).
*/
if (SCALE_EQUALS (gimp_zoom_model_get_factor (shell->zoom), scale) &&
shell->offset_x == offset_x &&
shell->offset_y == offset_y)
return;
gimp_display_shell_scale_save_revert_values (shell);
/* freeze the active tool */
gimp_display_shell_pause (shell);
gimp_zoom_model_zoom (shell->zoom, GIMP_ZOOM_TO, scale);
shell->offset_x = offset_x;
shell->offset_y = offset_y;
gimp_display_shell_scale_resize (shell, resize_window, FALSE);
/* re-enable the active tool */
gimp_display_shell_resume (shell);
}
示例6: gimp_display_shell_filter_set
void
gimp_display_shell_filter_set (GimpDisplayShell *shell,
GimpColorDisplayStack *stack)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (stack == NULL || GIMP_IS_COLOR_DISPLAY_STACK (stack));
if (stack == shell->filter_stack)
return;
if (shell->filter_stack)
{
g_signal_handlers_disconnect_by_func (shell->filter_stack,
gimp_display_shell_filter_changed,
shell);
g_object_unref (shell->filter_stack);
}
shell->filter_stack = stack;
if (shell->filter_stack)
{
g_object_ref (shell->filter_stack);
g_signal_connect (shell->filter_stack, "changed",
G_CALLBACK (gimp_display_shell_filter_changed),
shell);
}
gimp_display_shell_filter_changed (NULL, shell);
}
示例7: gimp_display_shell_scale_can_revert
/**
* gimp_display_shell_scale_can_revert:
* @shell: the #GimpDisplayShell
*
* Return value: %TRUE if a previous display scale exists, otherwise %FALSE.
**/
gboolean
gimp_display_shell_scale_can_revert (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return (shell->last_scale > SCALE_EPSILON);
}
示例8: gimp_display_shell_transform_xy
/**
* gimp_display_shell_transform_xy:
* @shell:
* @x:
* @y:
* @nx:
* @ny:
*
* Transforms an image coordinate to a shell coordinate.
**/
void
gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
gdouble x,
gdouble y,
gint *nx,
gint *ny)
{
gint64 tx;
gint64 ty;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL);
tx = ((gint64) x * shell->x_src_dec) / shell->x_dest_inc;
ty = ((gint64) y * shell->y_src_dec) / shell->y_dest_inc;
tx -= shell->offset_x;
ty -= shell->offset_y;
/* The projected coordinates might overflow a gint in the case of big
images at high zoom levels, so we clamp them here to avoid problems. */
*nx = CLAMP (tx, G_MININT, G_MAXINT);
*ny = CLAMP (ty, G_MININT, G_MAXINT);
}
示例9: gimp_display_shell_untransform_xy
/**
* gimp_display_shell_untransform_xy:
* @shell: a #GimpDisplayShell
* @x: x coordinate in display coordinates
* @y: y coordinate in display coordinates
* @nx: returns x oordinate in image coordinates
* @ny: returns y coordinate in image coordinates
* @round: if %TRUE, round the results to the nearest integer;
* if %FALSE, simply cast them to @gint.
*
* Transform from display coordinates to image coordinates, so that
* points on the display can be mapped to the corresponding points
* in the image.
**/
void
gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round)
{
gint64 tx;
gint64 ty;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL);
tx = (gint64) x + shell->offset_x;
ty = (gint64) y + shell->offset_y;
tx *= shell->x_dest_inc;
ty *= shell->y_dest_inc;
tx += round ? shell->x_dest_inc : shell->x_dest_inc >> 1;
ty += round ? shell->y_dest_inc : shell->y_dest_inc >> 1;
tx /= shell->x_src_dec;
ty /= shell->y_src_dec;
*nx = CLAMP (tx, G_MININT, G_MAXINT);
*ny = CLAMP (ty, G_MININT, G_MAXINT);
}
示例10: gimp_display_shell_constrain_line
void
gimp_display_shell_constrain_line (GimpDisplayShell *shell,
gdouble start_x,
gdouble start_y,
gdouble *end_x,
gdouble *end_y,
gint n_snap_lines)
{
gdouble offset_angle;
gdouble xres, yres;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (end_x != NULL);
g_return_if_fail (end_y != NULL);
gimp_display_shell_get_constrained_line_params (shell,
&offset_angle,
&xres, &yres);
gimp_constrain_line (start_x, start_y,
end_x, end_y,
n_snap_lines,
offset_angle,
xres, yres);
}
示例11: gimp_display_shell_scale_to
/**
* gimp_display_shell_scale_to:
* @shell:
* @scale:
* @viewport_x:
* @viewport_y:
*
* Zooms. The display offsets are adjusted so that the point specified
* by @x and @y doesn't change it's position on screen.
**/
static void
gimp_display_shell_scale_to (GimpDisplayShell *shell,
gdouble scale,
gint viewport_x,
gint viewport_y)
{
gdouble scale_x, scale_y;
gdouble image_focus_x, image_focus_y;
gint target_offset_x, target_offset_y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (! shell->display)
return;
gimp_display_shell_untransform_xy_f (shell,
viewport_x,
viewport_y,
&image_focus_x,
&image_focus_y);
gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y);
target_offset_x = scale_x * image_focus_x - viewport_x;
target_offset_y = scale_y * image_focus_y - viewport_y;
/* Note that we never come here if we need to
* resize_windows_on_zoom
*/
gimp_display_shell_scale_by_values (shell,
scale,
target_offset_x,
target_offset_y,
FALSE);
}
示例12: gimp_display_shell_get_constrained_line_params
void
gimp_display_shell_get_constrained_line_params (GimpDisplayShell *shell,
gdouble *offset_angle,
gdouble *xres,
gdouble *yres)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (offset_angle != NULL);
g_return_if_fail (xres != NULL);
g_return_if_fail (yres != NULL);
if (shell->flip_horizontally ^ shell->flip_vertically)
*offset_angle = +shell->rotate_angle;
else
*offset_angle = -shell->rotate_angle;
*xres = 1.0;
*yres = 1.0;
if (! shell->dot_for_dot)
{
GimpImage *image = gimp_display_get_image (shell->display);
if (image)
gimp_image_get_resolution (image, xres, yres);
}
}
示例13: gimp_display_shell_untransform_coords
/**
* gimp_display_shell_untransform_coords:
* @shell: a #GimpDisplayShell
* @display_coords: display coordinates
* @image_coords: returns the corresponding image coordinates
*
* Transforms from display coordinates to image coordinates, so that
* points on the display can be mapped to points in the image.
**/
void
gimp_display_shell_untransform_coords (const GimpDisplayShell *shell,
const GimpCoords *display_coords,
GimpCoords *image_coords)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (display_coords != NULL);
g_return_if_fail (image_coords != NULL);
*image_coords = *display_coords;
if (shell->rotate_untransform)
cairo_matrix_transform_point (shell->rotate_untransform,
&image_coords->x,
&image_coords->y);
image_coords->x += shell->offset_x;
image_coords->y += shell->offset_y;
image_coords->x /= shell->scale_x;
image_coords->y /= shell->scale_y;
image_coords->xscale = shell->scale_x;
image_coords->yscale = shell->scale_y;
}
示例14: gimp_display_shell_unrotate_xy
/**
* gimp_display_shell_unrotate_xy:
* @shell: a #GimpDisplayShell
* @x: x coordinate in rotated display coordinates
* @y: y coordinate in rotated display coordinates
* @nx: returns x oordinate in unrotated display coordinates
* @ny: returns y coordinate in unrotated display coordinates
*
* Rotate from rotated display coordinates to unrotated display
* coordinates.
**/
void
gimp_display_shell_unrotate_xy (const GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL);
if (shell->rotate_untransform)
{
gdouble fx = x;
gdouble fy = y;
cairo_matrix_transform_point (shell->rotate_untransform, &fy, &fy);
*nx = CLAMP (fx, G_MININT, G_MAXINT);
*ny = CLAMP (fy, G_MININT, G_MAXINT);
}
else
{
*nx = x;
*ny = y;
}
}
示例15: gimp_display_shell_scale_drag
void
gimp_display_shell_scale_drag (GimpDisplayShell *shell,
gdouble start_x,
gdouble start_y,
gdouble delta_x,
gdouble delta_y)
{
gdouble scale;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
scale = gimp_zoom_model_get_factor (shell->zoom);
gimp_display_shell_push_zoom_focus_pointer_pos (shell, start_x, start_y);
if (delta_y > 0)
{
gimp_display_shell_scale (shell,
GIMP_ZOOM_TO,
scale * 1.1,
GIMP_ZOOM_FOCUS_POINTER);
}
else if (delta_y < 0)
{
gimp_display_shell_scale (shell,
GIMP_ZOOM_TO,
scale * 0.9,
GIMP_ZOOM_FOCUS_POINTER);
}
}