Include a Other Software section in Help file
[geeqie.git] / src / pixbuf_util.c
index f2a44a0..9d10630 100644 (file)
@@ -146,6 +146,10 @@ static PixbufInline inline_pixbuf_data[] = {
        { 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 }
 };
 
@@ -293,7 +297,7 @@ 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_PDF:
+               case FORMAT_CLASS_DOCUMENT:
                        pixbuf = pixbuf_inline(PIXBUF_INLINE_ICON_PDF);
                        break;
                default:
@@ -1457,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: */