plug-ins: add option to crop layers to image bounds when exporting TIFF
In file-tiff, add an option to crop the layers to the image bounds when exporting individual layers (using GIMP_EXPORT_NEEDS_CROP added in the previous commit), since TIFF has no concept of global image bounds otherwise. Cropping is enabled by default.
This commit is contained in:
@ -1271,6 +1271,18 @@ save_dialog (TiffSaveVals *tsvals,
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&tsvals->save_layers);
|
||||
|
||||
frame = GTK_WIDGET (gtk_builder_get_object (builder, "layers-frame"));
|
||||
g_object_bind_property (toggle, "active",
|
||||
frame, "sensitive",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
toggle = GTK_WIDGET (gtk_builder_get_object (builder, "crop-layers"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
tsvals->crop_layers);
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&tsvals->crop_layers);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
|
||||
|
@ -34,6 +34,7 @@ typedef struct
|
||||
gboolean save_thumbnail;
|
||||
gboolean save_profile;
|
||||
gboolean save_layers;
|
||||
gboolean crop_layers;
|
||||
} TiffSaveVals;
|
||||
|
||||
|
||||
|
@ -88,7 +88,8 @@ static TiffSaveVals tsvals =
|
||||
FALSE, /* save iptc */
|
||||
TRUE, /* save thumbnail */
|
||||
TRUE, /* save profile */
|
||||
TRUE /* save layer */
|
||||
TRUE, /* save layers */
|
||||
TRUE /* crop layers */
|
||||
};
|
||||
|
||||
static gchar *image_comment = NULL;
|
||||
@ -392,7 +393,12 @@ run (const gchar *name,
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA;
|
||||
|
||||
if (tsvals.save_layers)
|
||||
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
|
||||
{
|
||||
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
|
||||
|
||||
if (tsvals.crop_layers)
|
||||
capabilities |= GIMP_EXPORT_NEEDS_CROP;
|
||||
}
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "TIFF", capabilities);
|
||||
|
||||
|
@ -54,6 +54,26 @@
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GimpFrame" id="layers-frame">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="crop-layers">
|
||||
<property name="label" translatable="yes">Cr_op layers to image bounds</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="save-alpha">
|
||||
<property name="label" translatable="yes">Save color _values from transparent pixels</property>
|
||||
@ -67,7 +87,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
Reference in New Issue
Block a user