Include a Other Software section in Help file
[geeqie.git] / src / pixbuf_util.c
index 714ef6d..9d10630 100644 (file)
@@ -130,6 +130,26 @@ static PixbufInline inline_pixbuf_data[] = {
        { PIXBUF_INLINE_ICON_MARKS,     icon_marks },
        { PIXBUF_INLINE_ICON_INFO,      icon_info },
        { PIXBUF_INLINE_ICON_SORT,      icon_sort },
+       { PIXBUF_INLINE_ICON_PDF,       icon_pdf },
+       { PIXBUF_INLINE_ICON_DRAW_RECTANGLE,    icon_draw_rectangle },
+       { PIXBUF_INLINE_ICON_MOVE,      icon_move },
+       { PIXBUF_INLINE_ICON_RENAME,    icon_rename },
+       { PIXBUF_INLINE_ICON_SELECT_ALL,        icon_select_all },
+       { PIXBUF_INLINE_ICON_SELECT_NONE,       icon_select_none },
+       { PIXBUF_INLINE_ICON_SELECT_INVERT,     icon_select_invert },
+       { PIXBUF_INLINE_ICON_SELECT_RECTANGLE,  icon_select_rectangle },
+       { PIXBUF_INLINE_ICON_FILE_FILTER,       icon_file_filter },
+       { PIXBUF_INLINE_ICON_CW,        icon_rotate_clockwise },
+       { PIXBUF_INLINE_ICON_CCW,       icon_rotate_counter_clockwise },
+       { PIXBUF_INLINE_ICON_180,       icon_rotate_180 },
+       { PIXBUF_INLINE_ICON_MIRROR,    icon_mirror },
+       { PIXBUF_INLINE_ICON_FLIP,      icon_flip },
+       { PIXBUF_INLINE_ICON_ORIGINAL,  icon_original },
+       { PIXBUF_INLINE_ICON_TRASH,     icon_trash },
+       { PIXBUF_INLINE_ICON_HEIF,      icon_heic },
+       { PIXBUF_INLINE_ICON_GRAYSCALE, icon_grayscale },
+       { PIXBUF_INLINE_ICON_EXPOSURE,  icon_exposure },
+       { PIXBUF_INLINE_SPLIT_PANE_SYNC, icon_split_pane_sync },
        { NULL, NULL }
 };
 
@@ -219,6 +239,15 @@ gboolean register_theme_icon_as_stock(const gchar *key, const gchar *icon)
                                {
                                DEBUG_1("Couldn't load icon %s: %s", icon2, error->message);
                                g_error_free(error);
+                               error = NULL;
+
+                               /* try as an absolute path */
+                               pixbuf = gdk_pixbuf_new_from_file(icon, &error);
+                               if (error)
+                                       {
+                                       DEBUG_1("Couldn't load icon as absolute path %s: %s", icon, error->message);
+                                       g_error_free(error);
+                                       }
                                }
                        g_free(icon2);
                        }
@@ -268,6 +297,9 @@ GdkPixbuf *pixbuf_fallback(FileData *fd, gint requested_width, gint requested_he
                case FORMAT_CLASS_COLLECTION:
                        pixbuf = pixbuf_inline(PIXBUF_INLINE_COLLECTION);
                        break;
+               case FORMAT_CLASS_DOCUMENT:
+                       pixbuf = pixbuf_inline(PIXBUF_INLINE_ICON_PDF);
+                       break;
                default:
                        pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN);
                }
@@ -1429,4 +1461,91 @@ void pixbuf_desaturate_rect(GdkPixbuf *pb,
                        }
                }
 }
+
+/*
+ *-----------------------------------------------------------------------------
+ * pixbuf highlight under/over exposure *-----------------------------------------------------------------------------
+ */
+void pixbuf_highlight_overunderexposed(GdkPixbuf *pb, gint x, gint y, gint w, gint h)
+{
+       gboolean has_alpha;
+       gint pw, ph, prs;
+       guchar *p_pix;
+       guchar *pp;
+       gint i, j;
+
+       if (!pb) return;
+
+       pw = gdk_pixbuf_get_width(pb);
+       ph = gdk_pixbuf_get_height(pb);
+
+       if (x < 0 || x + w > pw) return;
+       if (y < 0 || y + h > ph) return;
+
+       has_alpha = gdk_pixbuf_get_has_alpha(pb);
+       prs = gdk_pixbuf_get_rowstride(pb);
+       p_pix = gdk_pixbuf_get_pixels(pb);
+
+       for (i = 0; i < h; i++)
+               {
+               pp = p_pix + (y + i) * prs + (x * (has_alpha ? 4 : 3));
+               for (j = 0; j < w; j++)
+                       {
+                       if (pp[0] == 255 || pp[1] == 255 || pp[2] == 255 || pp[0] == 0 || pp[1] == 0 || pp[2] == 0)
+                               {
+                               *pp = 255;
+                               pp++;
+                               *pp = 0;
+                               pp++;
+                               *pp = 0;
+                               pp++;
+                               if (has_alpha) pp++;
+                               }
+                       else
+                               {
+                               pp = pp + 3;
+                               if (has_alpha) pp++;
+                               }
+                       }
+               }
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * pixbuf ignore alpha
+ *-----------------------------------------------------------------------------
+*/
+void pixbuf_ignore_alpha_rect(GdkPixbuf *pb,
+                 gint x, gint y, gint w, gint h)
+{
+   gboolean has_alpha;
+   gint pw, ph, prs;
+   guchar *p_pix;
+   guchar *pp;
+   gint i, j;
+
+   if (!pb) return;
+
+   pw = gdk_pixbuf_get_width(pb);
+   ph = gdk_pixbuf_get_height(pb);
+
+   if (x < 0 || x + w > pw) return;
+   if (y < 0 || y + h > ph) return;
+
+   has_alpha = gdk_pixbuf_get_has_alpha(pb);
+   if (!has_alpha) return;
+
+   prs = gdk_pixbuf_get_rowstride(pb);
+   p_pix = gdk_pixbuf_get_pixels(pb);
+
+   for (i = 0; i < h; i++)
+       {
+       pp = p_pix + (y + i) * prs + (x * 4 );
+       for (j = 0; j < w; j++)
+           {
+           pp[3] = 0xff;
+           pp+=4;
+           }
+       }
+}
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */