if (g_ascii_strcasecmp(".jps", il->fd->extension) == 0)
{
- g_object_set_data(G_OBJECT(pb), "stereo_sbs", GINT_TO_POINTER(1));
+ g_object_set_data(G_OBJECT(pb), "stereo_data", GINT_TO_POINTER(STEREO_PIXBUF_CROSS));
}
if (il->pixbuf) g_object_unref(il->pixbuf);
}
}
+ if (pixbuf && imd->user_stereo)
+ {
+ g_object_set_data(G_OBJECT(pixbuf), "stereo_data", GINT_TO_POINTER(imd->user_stereo));
+ }
+
pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, FALSE);
if (imd->cm)
{
pixbuf_renderer_stereo_set((PixbufRenderer *)imd->pr, stereo_mode);
}
+StereoPixbufData image_stereo_pixbuf_get(ImageWindow *imd)
+{
+ return imd->user_stereo;
+}
+
+void image_stereo_pixbuf_set(ImageWindow *imd, StereoPixbufData stereo_mode)
+{
+ imd->user_stereo = stereo_mode;
+ image_reload(imd);
+}
+
/* read ahead */
void image_prebuffer_set(ImageWindow *imd, FileData *fd)
void image_stereo_set(ImageWindow *imd, gint stereo_mode);
void image_stereo_swap(ImageWindow *imd);
+StereoPixbufData image_stereo_pixbuf_get(ImageWindow *imd);
+void image_stereo_pixbuf_set(ImageWindow *imd, StereoPixbufData stereo_mode);
+
/* read ahead, pass NULL to cancel */
void image_prebuffer_set(ImageWindow *imd, FileData *fd);
}
/* stereo */
+/*
gint layout_image_stereo_get(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return 0;
image_stereo_set(lw->image, stereo_mode);
}
-
+*/
void layout_image_stereo_swap(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return;
image_stereo_swap(lw->image);
}
+gint layout_image_stereo_pixbuf_get(LayoutWindow *lw)
+{
+ if (!layout_valid(&lw)) return 0;
+
+ return image_stereo_pixbuf_get(lw->image);
+}
+
+void layout_image_stereo_pixbuf_set(LayoutWindow *lw, gint stereo_mode)
+{
+ if (!layout_valid(&lw)) return;
+
+ image_stereo_pixbuf_set(lw->image, stereo_mode);
+}
+
const gchar *layout_image_get_path(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return NULL;
void layout_image_set_desaturate(LayoutWindow *lw, gboolean desaturate);
gboolean layout_image_get_desaturate(LayoutWindow *lw);
+/*
gint layout_image_stereo_get(LayoutWindow *lw);
void layout_image_stereo_set(LayoutWindow *lw, gint stereo_mode);
+*/
void layout_image_stereo_swap(LayoutWindow *lw);
+gint layout_image_stereo_pixbuf_get(LayoutWindow *lw);
+void layout_image_stereo_pixbuf_set(LayoutWindow *lw, gint stereo_mode);
+
void layout_image_next(LayoutWindow *lw);
void layout_image_prev(LayoutWindow *lw);
void layout_image_first(LayoutWindow *lw);
{
LayoutWindow *lw = data;
gint mode = gtk_radio_action_get_current_value(action);
- layout_image_stereo_set(lw, (layout_image_stereo_get(lw) & ~(PR_STEREO_ANAGLYPH | PR_STEREO_HORIZ | PR_STEREO_VERT)) | mode);
+ layout_image_stereo_pixbuf_set(lw, mode);
}
-
-
-
static void layout_menu_help_cb(GtkAction *action, gpointer data)
{
LayoutWindow *lw = data;
};
static GtkRadioActionEntry menu_stereo_mode_entries[] = {
- { "StereoNone", NULL, N_("_None"), NULL, N_("Stereo Off"), PR_STEREO_NONE },
- { "StereoAnaglyph", NULL, N_("_Anaglyph"), NULL, N_("Stereo Anaglyph"), PR_STEREO_ANAGLYPH },
- { "StereoHoriz", NULL, N_("_Side by Side"), NULL, N_("Stereo Side by Side"), PR_STEREO_HORIZ },
- { "StereoVert", NULL, N_("Above-_Below"), NULL, N_("Stereo Above-Below"), PR_STEREO_VERT }
+ { "StereoAuto", NULL, N_("_Auto"), NULL, N_("Stereo Auto"), STEREO_PIXBUF_DEFAULT },
+ { "StereoSBS", NULL, N_("_Side by Side"), NULL, N_("Stereo Side by Side"), STEREO_PIXBUF_SBS },
+ { "StereoCross", NULL, N_("_Cross"), NULL, N_("Stereo Cross"), STEREO_PIXBUF_CROSS },
+ { "StereoOff", NULL, N_("_Off"), NULL, N_("Stereo Off"), STEREO_PIXBUF_NONE }
};
" <menu action='StereoMenu'>"
" <menuitem action='StereoSwap'/>"
" <separator/>"
-" <menuitem action='StereoNone'/>"
-" <menuitem action='StereoAnaglyph'/>"
-" <menuitem action='StereoHoriz'/>"
-" <menuitem action='StereoVert'/>"
+" <menuitem action='StereoAuto'/>"
+" <menuitem action='StereoSBS'/>"
+" <menuitem action='StereoCross'/>"
+" <menuitem action='StereoOff'/>"
" </menu>"
" <menu action='ColorMenu'>"
" <menuitem action='UseColorProfiles'/>"
action = gtk_action_group_get_action(lw->action_group, "ConnectZoomMenu");
gtk_action_set_sensitive(action, lw->split_mode != SPLIT_NONE);
+ action = gtk_action_group_get_action(lw->action_group, "StereoAuto");
+ radio_action_set_current_value(GTK_RADIO_ACTION(action), layout_image_stereo_pixbuf_get(lw));
+
layout_util_sync_color(lw);
}
*/
static void pr_pixbuf_size_sync(PixbufRenderer *pr)
{
- pr->stereo_pixbuf_offset = 0;
+ pr->stereo_pixbuf_offset_left = 0;
+ pr->stereo_pixbuf_offset_right = 0;
if (!pr->pixbuf) return;
+ gint stereo_data = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(pr->pixbuf), "stereo_data"));
switch (pr->orientation)
{
case EXIF_ORIENTATION_LEFT_TOP:
case EXIF_ORIENTATION_LEFT_BOTTOM:
pr->image_width = gdk_pixbuf_get_height(pr->pixbuf);
pr->image_height = gdk_pixbuf_get_width(pr->pixbuf);
- if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(pr->pixbuf), "stereo_sbs")))
+ if (stereo_data == STEREO_PIXBUF_SBS)
{
pr->image_height /= 2;
- pr->stereo_pixbuf_offset = pr->image_height;
+ pr->stereo_pixbuf_offset_right = pr->image_height;
+ }
+ else if (stereo_data == STEREO_PIXBUF_CROSS)
+ {
+ pr->image_height /= 2;
+ pr->stereo_pixbuf_offset_left = pr->image_height;
}
break;
default:
pr->image_width = gdk_pixbuf_get_width(pr->pixbuf);
pr->image_height = gdk_pixbuf_get_height(pr->pixbuf);
- if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(pr->pixbuf), "stereo_sbs")))
+ if (stereo_data == STEREO_PIXBUF_SBS)
+ {
+ pr->image_width /= 2;
+ pr->stereo_pixbuf_offset_right = pr->image_width;
+ }
+ else if (stereo_data == STEREO_PIXBUF_CROSS)
{
pr->image_width /= 2;
- pr->stereo_pixbuf_offset = pr->image_width;
+ pr->stereo_pixbuf_offset_left = pr->image_width;
}
}
}
gint image_width; /* image actual dimensions (pixels) */
gint image_height;
- gint stereo_pixbuf_offset; /* offset of the right part of the stereo image in pixbuf */
+ gint stereo_pixbuf_offset_right; /* offset of the right part of the stereo image in pixbuf */
+ gint stereo_pixbuf_offset_left; /* offset of the left part of the stereo image in pixbuf */
GdkPixbuf *pixbuf;
#define GET_RIGHT_PIXBUF_OFFSET(rt) \
(( (rt->stereo_mode & PR_STEREO_RIGHT) && !(rt->stereo_mode & PR_STEREO_SWAP)) || \
(!(rt->stereo_mode & PR_STEREO_RIGHT) && (rt->stereo_mode & PR_STEREO_SWAP)) ? \
- rt->pr->stereo_pixbuf_offset : 0 )
+ rt->pr->stereo_pixbuf_offset_right : rt->pr->stereo_pixbuf_offset_left )
#define GET_LEFT_PIXBUF_OFFSET(rt) \
((!(rt->stereo_mode & PR_STEREO_RIGHT) && !(rt->stereo_mode & PR_STEREO_SWAP)) || \
( (rt->stereo_mode & PR_STEREO_RIGHT) && (rt->stereo_mode & PR_STEREO_SWAP)) ? \
- rt->pr->stereo_pixbuf_offset : 0 )
+ rt->pr->stereo_pixbuf_offset_right : rt->pr->stereo_pixbuf_offset_left )
static void rt_sync_scroll(RendererTiles *rt)
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
it->x + pb_x, it->y + pb_y);
- if (rt->stereo_mode & PR_STEREO_ANAGLYPH && pr->stereo_pixbuf_offset > 0)
+ if (rt->stereo_mode & PR_STEREO_ANAGLYPH &&
+ (pr->stereo_pixbuf_offset_right > 0 || pr->stereo_pixbuf_offset_left > 0))
{
GdkPixbuf *right_pb = rt_get_spare_tile(rt);
rt_tile_get_region(has_alpha,
} PixbufRendererStereoMode;
+typedef enum {
+ STEREO_PIXBUF_DEFAULT = 0,
+ STEREO_PIXBUF_SBS = 1,
+ STEREO_PIXBUF_CROSS = 2,
+ STEREO_PIXBUF_NONE = 3
+} StereoPixbufData;
#define MAX_SPLIT_IMAGES 4
gboolean delay_flip;
gint orientation;
gboolean desaturate;
+ gint user_stereo;
};
#define FILEDATA_MARKS_SIZE 6