static void gimp_canvas_unrealize (GtkWidget *widget) { GimpCanvas *canvas = GIMP_CANVAS (widget); gint i; for (i = 0; i < GIMP_CANVAS_NUM_STYLES; i++) { if (canvas->gc[i]) { g_object_unref (canvas->gc[i]); canvas->gc[i] = NULL; } } for (i = 0; i < GIMP_CANVAS_NUM_STIPPLES; i++) { if (canvas->stipple[i]) { g_object_unref (canvas->stipple[i]); canvas->stipple[i] = NULL; } } if (canvas->layout) { g_object_unref (canvas->layout); canvas->layout = NULL; } GTK_WIDGET_CLASS (parent_class)->unrealize (widget); }
static void gimp_canvas_realize (GtkWidget *widget) { GimpCanvas *canvas = GIMP_CANVAS (widget); GTK_WIDGET_CLASS (parent_class)->realize (widget); canvas->stipple[0] = gdk_bitmap_create_from_data (widget->window, (const gchar *) stipples[0], 8, 8); }
static void gimp_region_select_tool_draw (GimpDrawTool *draw_tool) { GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (draw_tool); if (region_sel->segs) { GimpDisplayShell *shell; shell = GIMP_DISPLAY_SHELL (GIMP_TOOL (draw_tool)->display->shell); gimp_canvas_draw_segments (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, region_sel->segs, region_sel->num_segs); } }
static void gimp_canvas_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GimpCanvas *canvas = GIMP_CANVAS (object); switch (property_id) { case PROP_GIMP: g_value_set_object (value, canvas->gimp); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
void gimp_display_shell_render (GimpDisplayShell *shell, gint x, gint y, gint w, gint h, GdkRectangle *highlight) { GimpProjection *projection; GimpImage *image; RenderInfo info; GimpImageType type; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (w > 0 && h > 0); image = shell->display->image; projection = image->projection; /* Initialize RenderInfo with values that don't change during the * call of this function. */ info.shell = shell; info.x = x + shell->offset_x; info.y = y + shell->offset_y; info.w = w; info.h = h; info.dest_bpp = 3; info.dest_bpl = info.dest_bpp * GIMP_RENDER_BUF_WIDTH; info.dest_width = info.dest_bpp * info.w; switch (GIMP_DISPLAY_CONFIG (image->gimp->config)->zoom_quality) { case GIMP_ZOOM_QUALITY_LOW: info.zoom_quality = GIMP_DISPLAY_ZOOM_FAST; break; case GIMP_ZOOM_QUALITY_HIGH: info.zoom_quality = GIMP_DISPLAY_ZOOM_PIXEL_AA; break; } if (GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_projection_get_image_type (projection))) { gdouble opacity = gimp_projection_get_opacity (projection); info.alpha = render_image_init_alpha (opacity * 255.999); } /* Setup RenderInfo for rendering a GimpProjection level. */ { TileManager *src_tiles; gint level; level = gimp_projection_get_level (projection, shell->scale_x, shell->scale_y); src_tiles = gimp_projection_get_tiles_at_level (projection, level); gimp_display_shell_render_info_scale (&info, shell, src_tiles, level); } /* Currently, only RGBA and GRAYA projection types are used. */ type = gimp_projection_get_image_type (projection); switch (type) { case GIMP_RGBA_IMAGE: render_image_rgb_a (&info); break; case GIMP_GRAYA_IMAGE: render_image_gray_a (&info); break; default: g_warning ("%s: unsupported projection type (%d)", G_STRFUNC, type); g_assert_not_reached (); } /* apply filters to the rendered projection */ if (shell->filter_stack) gimp_color_display_stack_convert (shell->filter_stack, shell->render_buf, w, h, 3, 3 * GIMP_RENDER_BUF_WIDTH); /* dim pixels outside the highlighted rectangle */ if (highlight) { gimp_display_shell_render_highlight (shell, x, y, w, h, highlight); } else if (shell->mask) { TileManager *src_tiles = gimp_drawable_get_tiles (shell->mask); /* The mask does not (yet) have an image pyramid, use 0 as level, */ gimp_display_shell_render_info_scale (&info, shell, src_tiles, 0); gimp_display_shell_render_mask (shell, &info); } /* put it to the screen */ gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_RENDER, x + shell->disp_xoffset, y + shell->disp_yoffset, w, h, shell->render_buf, 3 * GIMP_RENDER_BUF_WIDTH, shell->offset_x, shell->offset_y); }