[gtk/wip/otte/color-profiles: 33/38] gtk-demo: Add a color profile demo




commit fcd1b4a29b836716f6f4a88e8bc373bcba629a6d
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Sep 23 01:22:05 2021 -0400

    gtk-demo: Add a color profile demo
    
    This is using test images from http://displaycal.net/.

 .../ICC Rendering Intent Test (cLUT only).jpg      | Bin 0 -> 276191 bytes
 .../ICC Rendering Intent Test (cLUT only).png      | Bin 0 -> 119811 bytes
 .../ICC Rendering Intent Test (cLUT only).tif      | Bin 0 -> 211731 bytes
 demos/gtk-demo/colorprofiles.c                     |  37 +++++
 demos/gtk-demo/colorprofiles.ui                    | 176 +++++++++++++++++++++
 demos/gtk-demo/demo.gresource.xml                  |  10 ++
 demos/gtk-demo/meson.build                         |   1 +
 demos/gtk-demo/sRGB_Gray.jpg                       | Bin 0 -> 36854 bytes
 demos/gtk-demo/sRGB_Gray.png                       | Bin 0 -> 4531 bytes
 demos/gtk-demo/sRGB_Gray.tif                       | Bin 0 -> 9104 bytes
 10 files changed, 224 insertions(+)
---
diff --git a/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).jpg b/demos/gtk-demo/ICC Rendering Intent 
Test (cLUT only).jpg
new file mode 100644
index 0000000000..18d7a85d3f
Binary files /dev/null and b/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).jpg differ
diff --git a/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).png b/demos/gtk-demo/ICC Rendering Intent 
Test (cLUT only).png
new file mode 100644
index 0000000000..1c4f622647
Binary files /dev/null and b/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).png differ
diff --git a/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).tif b/demos/gtk-demo/ICC Rendering Intent 
Test (cLUT only).tif
new file mode 100644
index 0000000000..529cbdb41a
Binary files /dev/null and b/demos/gtk-demo/ICC Rendering Intent Test (cLUT only).tif differ
diff --git a/demos/gtk-demo/colorprofiles.c b/demos/gtk-demo/colorprofiles.c
new file mode 100644
index 0000000000..dd1f382a45
--- /dev/null
+++ b/demos/gtk-demo/colorprofiles.c
@@ -0,0 +1,37 @@
+/* Color Profiles
+ *
+ * Demonstrates support for color profiles.
+ *
+ * The test images used here are taken from http://displaycal.net/icc-color-management-test/
+ * and are licensed under the Creative Commons BY-SA 4.0 International License
+ */
+
+#include <gtk/gtk.h>
+
+
+
+GtkWidget*
+do_colorprofiles (GtkWidget *do_widget)
+{
+  static GtkWidget *window;
+
+  if (!window)
+    {
+      GtkBuilder *builder;
+
+      builder = gtk_builder_new_from_resource ("/colorprofiles/colorprofiles.ui");
+      window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+      gtk_window_set_display (GTK_WINDOW (window),
+                              gtk_widget_get_display (do_widget));
+      g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
+      g_object_unref (builder);
+
+    }
+
+  if (!gtk_widget_get_visible (window))
+    gtk_widget_show (window);
+  else
+    gtk_window_destroy (GTK_WINDOW (window));
+
+  return window;
+}
diff --git a/demos/gtk-demo/colorprofiles.ui b/demos/gtk-demo/colorprofiles.ui
new file mode 100644
index 0000000000..9ae03ab798
--- /dev/null
+++ b/demos/gtk-demo/colorprofiles.ui
@@ -0,0 +1,176 @@
+<interface>
+  <object class="GtkWindow" id="window">
+    <property name="default-width">660</property>
+    <property name="default-height">660</property>
+    <property name="resizable">false</property>
+    <property name="title">Color Profiles</property>
+    <child>
+      <object class="GtkBox">
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkStackSwitcher">
+            <property name="stack">stack</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkStack" id="stack">
+            <child>
+              <object class="GtkStackPage">
+                <property name="name">page1</property>
+                <property name="title">JPEG</property>
+                <property name="child">
+                  <object class="GtkScrolledWindow">
+                    <child>
+                      <object class="GtkBox">
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">10</property>
+                        <property name="margin-top">10</property>
+                        <property name="margin-bottom">10</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 1: Matrix-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/sRGB_Gray.jpg</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 2: Lookup table-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/ICC Rendering Intent Test (cLUT 
only).jpg</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkStackPage">
+                <property name="name">page2</property>
+                <property name="title">PNG</property>
+                <property name="child">
+                  <object class="GtkScrolledWindow">
+                    <child>
+                      <object class="GtkBox">
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">10</property>
+                        <property name="margin-top">10</property>
+                        <property name="margin-bottom">10</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 1: Matrix-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/sRGB_Gray.png</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 2: Lookup table-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/ICC Rendering Intent Test (cLUT 
only).png</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkStackPage">
+                <property name="name">page3</property>
+                <property name="title">TIFF</property>
+                <property name="child">
+                  <object class="GtkScrolledWindow">
+                    <child>
+                      <object class="GtkBox">
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">10</property>
+                        <property name="margin-top">10</property>
+                        <property name="margin-bottom">10</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 1: Matrix-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/sRGB_Gray.tif</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="label">Test 2: Lookup table-based profile</property>
+                            <style>
+                              <class name="title-3"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkPicture">
+                            <property name="hexpand">1</property>
+                            <property name="can-shrink">1</property>
+                            <property name="keep-aspect-ratio">1</property>
+                            <property name="file">resource:///colorprofiles/ICC Rendering Intent Test (cLUT 
only).tif</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml
index 83e798fd25..0979453830 100644
--- a/demos/gtk-demo/demo.gresource.xml
+++ b/demos/gtk-demo/demo.gresource.xml
@@ -18,6 +18,15 @@
     <file>demoimage.c</file>
     <file>demoimage.h</file>
   </gresource>
+  <gresource prefix="/colorprofiles">
+    <file>colorprofiles.ui</file>
+    <file>sRGB_Gray.jpg</file>
+    <file>sRGB_Gray.png</file>
+    <file>sRGB_Gray.tif</file>
+    <file>ICC Rendering Intent Test (cLUT only).jpg</file>
+    <file>ICC Rendering Intent Test (cLUT only).png</file>
+    <file>ICC Rendering Intent Test (cLUT only).tif</file>
+  </gresource>
   <gresource prefix="/constraints_builder">
     <file>constraints_builder.ui</file>
   </gresource>
@@ -254,6 +263,7 @@
     <file>assistant.c</file>
     <file>builder.c</file>
     <file>clipboard.c</file>
+    <file>colorprofiles.c</file>
     <file>combobox.c</file>
     <file>constraints.c</file>
     <file>constraints_interactive.c</file>
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index 9201655988..e2a527a55a 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -5,6 +5,7 @@ demos = files([
   'assistant.c',
   'builder.c',
   'clipboard.c',
+  'colorprofiles.c',
   'combobox.c',
   'constraints.c',
   'constraints_interactive.c',
diff --git a/demos/gtk-demo/sRGB_Gray.jpg b/demos/gtk-demo/sRGB_Gray.jpg
new file mode 100644
index 0000000000..fe58ddbf8c
Binary files /dev/null and b/demos/gtk-demo/sRGB_Gray.jpg differ
diff --git a/demos/gtk-demo/sRGB_Gray.png b/demos/gtk-demo/sRGB_Gray.png
new file mode 100644
index 0000000000..b13816b427
Binary files /dev/null and b/demos/gtk-demo/sRGB_Gray.png differ
diff --git a/demos/gtk-demo/sRGB_Gray.tif b/demos/gtk-demo/sRGB_Gray.tif
new file mode 100644
index 0000000000..6685ac6402
Binary files /dev/null and b/demos/gtk-demo/sRGB_Gray.tif differ


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]