plug-ins: convert screenshot-win32 to gegl

and do some repairs.
This commit is contained in:
Hartmut Kuhse 2016-05-28 17:56:14 +02:00
parent 49c81ffc44
commit 4a7d1e59f9
4 changed files with 45 additions and 56 deletions

View File

@ -100,17 +100,6 @@ typedef struct {
GtkWidget *delay_spinner;
} WinSnapInterface;
/* The dialog data */
static WinSnapInterface winsnapintf =
{
#ifdef CAN_SET_DECOR
NULL,
#endif
NULL,
NULL,
NULL
};
/* We create a DIB section to hold the grabbed area. The scanlines in
* DIB sections are aligned ona LONG (four byte) boundary. Its pixel
* data is in RGB (BGR actually) format, three bytes per pixel.
@ -135,8 +124,7 @@ screenshot_win32_available (void)
ScreenshotCapabilities
screenshot_win32_get_capabilities (void)
{
return (SCREENSHOT_CAN_SHOOT_DECORATIONS |
SCREENSHOT_CAN_SHOOT_POINTER);
return (SCREENSHOT_CAN_SHOOT_DECORATIONS);
}
GimpPDBStatusType
@ -216,8 +204,8 @@ sendBMPToGimp(HBITMAP hBMP, HDC hDC, RECT rect)
int imageType, layerType;
gint32 new_image_id;
gint32 layer_id;
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
GeglBuffer *buffer;
GeglRectangle *rectangle;
/* Our width and height */
width = (rect.right - rect.left);
@ -244,20 +232,22 @@ sendBMPToGimp(HBITMAP hBMP, HDC hDC, RECT rect)
layerType, 100, GIMP_NORMAL_MODE);
gimp_image_insert_layer(new_image_id, layer_id, -1, 0);
/* Get our drawable */
drawable = gimp_drawable_get(layer_id);
/* make rectangle */
rectangle = g_new (GeglRectangle, 1);
rectangle->x = 0;
rectangle->y = 0;
rectangle->width = ROUND4(width);
rectangle->height = height;
gimp_tile_cache_size(ROUND4(width) * gimp_tile_height() * 3);
/* get the buffer */
buffer = gimp_drawable_get_buffer (layer_id);
/* Initialize a pixel region for writing to the image */
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0,
ROUND4(width), height, TRUE, FALSE);
/* fill the buffer */
gegl_buffer_set (buffer, rectangle, 0, NULL, (guchar *) capBytes, GEGL_AUTO_ROWSTRIDE);
gimp_pixel_rgn_set_rect(&pixel_rgn, (guchar *) capBytes,
0, 0, ROUND4(width), height);
/* flushing data */
gegl_buffer_flush (buffer);
/* HB: update data BEFORE size change */
gimp_drawable_flush(drawable);
/* Now resize the layer down to the correct size if necessary. */
if (width != ROUND4(width)) {
gimp_layer_resize (layer_id, width, height, 0, 0);
@ -288,19 +278,6 @@ doWindowCapture(void)
winsnapWinMain();
}
/*
* doRootWindowCapture
*
* Capture the root window
* ENTRY POINT FOR WINSNAP ROOT
*/
static void
doRootWindowCapture(void)
{
/* Do the window capture */
doCapture(0);
}
/******************************************************************
* Debug stuff
******************************************************************/

View File

@ -430,10 +430,14 @@ shoot_dialog (GdkScreen **screen)
shoot_dialog_add_hint (GTK_NOTEBOOK (notebook), SHOOT_REGION,
_("After the delay, drag your mouse to select "
"the region for the screenshot."));
#ifdef G_OS_WIN32
shoot_dialog_add_hint (GTK_NOTEBOOK (notebook), SHOOT_WINDOW,
_("Click in a window to snap it after delay."));
#else
shoot_dialog_add_hint (GTK_NOTEBOOK (notebook), SHOOT_WINDOW,
_("At the end of the delay, click in a window "
"to snap it."));
#endif
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), shootvals.shoot_type);
/* Area */
@ -527,6 +531,8 @@ shoot_dialog (GdkScreen **screen)
shootvals.shoot_type == SHOOT_ROOT);
/* dragged region */
if (capabilities & SCREENSHOT_CAN_SHOOT_REGION)
{
button = gtk_radio_button_new_with_mnemonic (radio_group,
_("Select a _region to grab"));
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
@ -541,6 +547,7 @@ shoot_dialog (GdkScreen **screen)
g_signal_connect (button, "toggled",
G_CALLBACK (shoot_radio_button_toggled),
notebook);
}
/* Delay */
frame = gimp_frame_new (_("Delay"));

View File

@ -32,7 +32,8 @@ typedef enum
{
SCREENSHOT_CAN_SHOOT_DECORATIONS = 0x1 << 0,
SCREENSHOT_CAN_SHOOT_POINTER = 0x1 << 1,
SCREENSHOT_CAN_PICK_NONINTERACTIVELY = 0x1 << 2
SCREENSHOT_CAN_PICK_NONINTERACTIVELY = 0x1 << 2,
SCREENSHOT_CAN_SHOOT_REGION = 0x1 << 3
} ScreenshotCapabilities;
typedef enum

View File

@ -10921,6 +10921,10 @@ msgstr ""
"aus."
#: ../plug-ins/screenshot/screenshot.c:434
msgid "Click in a window to snap it after delay."
msgstr "Klicken Sie in das am Ende der Verzögerung zu fotografierende Fenster."
#: ../plug-ins/screenshot/screenshot.c:437
msgid "At the end of the delay, click in a window to snap it."
msgstr "Klicken Sie am Ende der Verzögerung in das zu fotografierende Fenster."