[Pixman] [PATCH pixman 02/15] demos/scale: Added pulldown to choose PIXMAN_FILTER_* value

Bill Spitzak spitzak at gmail.com
Tue Dec 23 17:51:59 PST 2014


This allows testing of GOOD/BEST and to do comparisons between
the basic filters and PIXMAN_FILTER_SEPARABLE_CONVOLUTION settings.
---
 demos/scale.c  |   14 +++++++++++++-
 demos/scale.ui |   40 ++++++++++++++++++++++++++++++----------
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/demos/scale.c b/demos/scale.c
index 71c7791..203168f 100644
--- a/demos/scale.c
+++ b/demos/scale.c
@@ -68,6 +68,15 @@ typedef struct
     int		value;
 } named_int_t;
 
+static const named_int_t filter_types[] =
+{
+    { "Separable",		PIXMAN_FILTER_SEPARABLE_CONVOLUTION },
+    { "Nearest",		PIXMAN_FILTER_NEAREST },
+    { "Bilinear",		PIXMAN_FILTER_BILINEAR },
+    { "Good",			PIXMAN_FILTER_GOOD },
+    { "Best",			PIXMAN_FILTER_BEST },
+};
+
 static const named_int_t filters[] =
 {
     { "Box",			PIXMAN_KERNEL_BOX },
@@ -201,7 +210,9 @@ rescale (GtkWidget *may_be_null, app_t *app)
 	gtk_adjustment_get_value (app->subsample_adjustment),
 	gtk_adjustment_get_value (app->subsample_adjustment));
 
-    pixman_image_set_filter (app->original, PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, n_params);
+    pixman_image_set_filter (app->original,
+	get_value (app, filter_types, "filter_combo_box"),
+	params, n_params);
 
     pixman_image_set_repeat (
         app->original, get_value (app, repeats, "repeat_combo_box"));
@@ -343,6 +354,7 @@ app_new (pixman_image_t *original)
     widget = get_widget (app, "drawing_area");
     g_signal_connect (widget, "expose_event", G_CALLBACK (on_expose), app);
 
+    set_up_combo_box (app, "filter_combo_box", G_N_ELEMENTS (filter_types), filter_types);
     set_up_filter_box (app, "reconstruct_x_combo_box");
     set_up_filter_box (app, "reconstruct_y_combo_box");
     set_up_filter_box (app, "sample_x_combo_box");
diff --git a/demos/scale.ui b/demos/scale.ui
index ee985dd..b62cbfb 100644
--- a/demos/scale.ui
+++ b/demos/scale.ui
@@ -191,12 +191,23 @@
                     <property name="column_spacing">8</property>
                     <property name="row_spacing">6</property>
                     <child>
+                      <object class="GtkLabel" id="labelF">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes"><b>Filter:</b></property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                    <child>
                       <object class="GtkLabel" id="label4">
                         <property name="visible">True</property>
                         <property name="xalign">1</property>
                         <property name="label" translatable="yes"><b>Reconstruct X:</b></property>
                         <property name="use_markup">True</property>
                       </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label5">
@@ -206,7 +217,7 @@
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -217,7 +228,7 @@
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -228,7 +239,7 @@
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">3</property>
+                        <property name="top_attach">4</property>
                       </packing>
                     </child>
                     <child>
@@ -239,7 +250,7 @@
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">4</property>
+                        <property name="top_attach">5</property>
                       </packing>
                     </child>
                     <child>
@@ -250,7 +261,15 @@
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">5</property>
+                        <property name="top_attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="filter_combo_box">
+                        <property name="visible">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -259,6 +278,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -267,7 +287,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -276,7 +296,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -285,7 +305,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">3</property>
+                        <property name="top_attach">4</property>
                       </packing>
                     </child>
                     <child>
@@ -294,7 +314,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">4</property>
+                        <property name="top_attach">5</property>
                       </packing>
                     </child>
                     <child>
@@ -304,7 +324,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">5</property>
+                        <property name="top_attach">6</property>
                       </packing>
                     </child>
                   </object>
-- 
1.7.9.5



More information about the Pixman mailing list