static void gimp_text_style_editor_set_size (GimpTextStyleEditor *editor, GtkTextTag *size_tag) { gint size = 0; gdouble pixels; if (size_tag) size = gimp_text_tag_get_size (size_tag); g_signal_handlers_block_by_func (editor->size_entry, gimp_text_style_editor_size_changed, editor); pixels = gimp_units_to_pixels ((gdouble) size / PANGO_SCALE, GIMP_UNIT_POINT, editor->resolution_y); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (editor->size_entry), 0, pixels); if (size == 0) { GtkWidget *spinbutton; spinbutton = gimp_size_entry_get_help_widget (GIMP_SIZE_ENTRY (editor->size_entry), 0); gtk_entry_set_text (GTK_ENTRY (spinbutton), ""); } g_signal_handlers_unblock_by_func (editor->size_entry, gimp_text_style_editor_size_changed, editor); }
static void gimp_text_style_editor_set_default_size (GimpTextStyleEditor *editor) { gdouble pixels = gimp_units_to_pixels (editor->text->font_size, editor->text->unit, editor->resolution_y); g_signal_handlers_block_by_func (editor->size_entry, gimp_text_style_editor_size_changed, editor); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (editor->size_entry), 0, pixels); g_signal_handlers_unblock_by_func (editor->size_entry, gimp_text_style_editor_size_changed, editor); }
void gimp_drawable_stroke_scan_convert (GimpDrawable *drawable, GimpStrokeOptions *options, GimpScanConvert *scan_convert, gboolean push_undo) { gdouble width; GimpUnit unit; g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options)); g_return_if_fail (scan_convert != NULL); g_return_if_fail (gimp_fill_options_get_style (GIMP_FILL_OPTIONS (options)) != GIMP_FILL_STYLE_PATTERN || gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL); if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), NULL, NULL, NULL, NULL)) return; width = gimp_stroke_options_get_width (options); unit = gimp_stroke_options_get_unit (options); if (unit != GIMP_UNIT_PIXEL) { GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); gdouble xres; gdouble yres; gimp_image_get_resolution (image, &xres, &yres); gimp_scan_convert_set_pixel_ratio (scan_convert, yres / xres); width = gimp_units_to_pixels (width, unit, yres); } gimp_scan_convert_stroke (scan_convert, width, gimp_stroke_options_get_join_style (options), gimp_stroke_options_get_cap_style (options), gimp_stroke_options_get_miter_limit (options), gimp_stroke_options_get_dash_offset (options), gimp_stroke_options_get_dash_info (options)); gimp_drawable_fill_scan_convert (drawable, GIMP_FILL_OPTIONS (options), scan_convert, push_undo); }