Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
gThumb
Commits
e0399e29
Commit
e0399e29
authored
Nov 04, 2019
by
Paolo Bacchilega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image viewer: added ability to define the transparency style
parent
0c85c544
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
4 deletions
+51
-4
gthumb/gth-image-viewer.c
gthumb/gth-image-viewer.c
+39
-4
gthumb/gth-image-viewer.h
gthumb/gth-image-viewer.h
+12
-0
No files found.
gthumb/gth-image-viewer.c
View file @
e0399e29
...
...
@@ -40,7 +40,7 @@
#define MINIMUM_DELAY 10
/* When an animation frame has a 0 milli seconds
* delay use this delay instead. */
#define STEP_INCREMENT 20.0
/* Scroll increment. */
#define
BLACK
_VALUE 0.2
#define
GRAY
_VALUE 0.2
#define CHECKED_PATTERN_SIZE 20
...
...
@@ -113,7 +113,7 @@ struct _GthImageViewerPrivate {
gboolean
skip_zoom_change
;
gboolean
update_image_after_zoom
;
gboolean
reset_scrollbars
;
GthTransparencyStyle
transparency_style
;
GList
*
painters
;
};
...
...
@@ -1576,6 +1576,7 @@ gth_image_viewer_init (GthImageViewer *self)
self
->
priv
->
cursor_void
=
NULL
;
self
->
priv
->
reset_scrollbars
=
TRUE
;
self
->
priv
->
transparency_style
=
GTH_TRANSPARENCY_STYLE_CHECKERED
;
gth_image_viewer_set_tool
(
self
,
NULL
);
...
...
@@ -2283,6 +2284,26 @@ gth_image_viewer_get_tool (GthImageViewer *self)
}
void
gth_image_viewer_set_transparency_style
(
GthImageViewer
*
self
,
GthTransparencyStyle
style
)
{
g_return_if_fail
(
GTH_IS_IMAGE_VIEWER
(
self
));
self
->
priv
->
transparency_style
=
style
;
gtk_widget_queue_draw
(
GTK_WIDGET
(
self
));
}
GthTransparencyStyle
gth_image_viewer_get_transparency_style
(
GthImageViewer
*
self
)
{
g_return_val_if_fail
(
GTH_IS_IMAGE_VIEWER
(
self
),
0
);
return
self
->
priv
->
transparency_style
;
}
void
gth_image_viewer_scroll_to
(
GthImageViewer
*
self
,
int
x_offset
,
...
...
@@ -2645,7 +2666,7 @@ gth_image_viewer_paint_background (GthImageViewer *self,
cairo_save
(
cr
);
gtk_widget_get_allocation
(
GTK_WIDGET
(
self
),
&
allocation
);
cairo_set_source_rgb
(
cr
,
BLACK
_VALUE
,
BLACK
_VALUE
,
BLACK
_VALUE
);
cairo_set_source_rgb
(
cr
,
GRAY
_VALUE
,
GRAY
_VALUE
,
GRAY
_VALUE
);
cairo_rectangle
(
cr
,
0
,
0
,
...
...
@@ -2685,7 +2706,21 @@ gth_image_viewer_paint_frame (GthImageViewer *self,
/* background */
cairo_set_source
(
cr
,
self
->
priv
->
background_pattern
);
switch
(
self
->
priv
->
transparency_style
)
{
case
GTH_TRANSPARENCY_STYLE_CHECKERED
:
cairo_set_source
(
cr
,
self
->
priv
->
background_pattern
);
break
;
case
GTH_TRANSPARENCY_STYLE_WHITE
:
cairo_set_source_rgb
(
cr
,
1
.
0
,
1
.
0
,
1
.
0
);
break
;
case
GTH_TRANSPARENCY_STYLE_GRAY
:
cairo_set_source_rgb
(
cr
,
GRAY_VALUE
,
GRAY_VALUE
,
GRAY_VALUE
);
break
;
case
GTH_TRANSPARENCY_STYLE_BLACK
:
cairo_set_source_rgb
(
cr
,
0
.
0
,
0
.
0
,
0
.
0
);
break
;
}
cairo_rectangle
(
cr
,
self
->
image_area
.
x
,
self
->
image_area
.
y
,
...
...
gthumb/gth-image-viewer.h
View file @
e0399e29
...
...
@@ -77,6 +77,14 @@ typedef enum {
}
GthZoomChange
;
typedef
enum
{
GTH_TRANSPARENCY_STYLE_CHECKERED
,
GTH_TRANSPARENCY_STYLE_WHITE
,
GTH_TRANSPARENCY_STYLE_GRAY
,
GTH_TRANSPARENCY_STYLE_BLACK
}
GthTransparencyStyle
;
struct
_GthImageViewer
{
GtkWidget
__parent
;
...
...
@@ -224,6 +232,10 @@ void gth_image_viewer_set_tool (GthImageViewer
GthImageViewerTool
*
tool
);
GthImageViewerTool
*
gth_image_viewer_get_tool
(
GthImageViewer
*
viewer
);
void
gth_image_viewer_set_transparency_style
(
GthImageViewer
*
viewer
,
GthTransparencyStyle
style
);
GthTransparencyStyle
gth_image_viewer_get_transparency_style
(
GthImageViewer
*
viewer
);
/* Scrolling. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment