当前位置: 首页>>代码示例>>C++>>正文


C++ GIMP_IS_DISPLAY_SHELL函数代码示例

本文整理汇总了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);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:37,代码来源:gimpdisplayshell-transform.c

示例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);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:41,代码来源:gimpdisplayshell-scroll.c

示例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);
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:29,代码来源:gimpdisplayshell-layer-select.c

示例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;
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:32,代码来源:gimpdisplayshell-scale.c

示例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);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:44,代码来源:gimpdisplayshell-scale.c

示例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);
}
开发者ID:ChristianBusch,项目名称:gimp,代码行数:32,代码来源:gimpdisplayshell-filter.c

示例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);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:13,代码来源:gimpdisplayshell-scale.c

示例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);
}
开发者ID:srrcboy,项目名称:gimb,代码行数:35,代码来源:gimpdisplayshell-transform.c

示例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);
}
开发者ID:srrcboy,项目名称:gimb,代码行数:44,代码来源:gimpdisplayshell-transform.c

示例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);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:25,代码来源:gimpdisplayshell-utils.c

示例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);
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:45,代码来源:gimpdisplayshell-scale.c

示例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);
    }
}
开发者ID:jiapei100,项目名称:gimp,代码行数:27,代码来源:gimpdisplayshell-utils.c

示例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;

}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:35,代码来源:gimpdisplayshell-transform.c

示例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;
    }
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:38,代码来源:gimpdisplayshell-transform.c

示例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);
    }
}
开发者ID:jiapei100,项目名称:gimp,代码行数:30,代码来源:gimpdisplayshell-scale.c


注:本文中的GIMP_IS_DISPLAY_SHELL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。