[gimp/goat-invasion] app: add GIMP_PRECISION_U32 and all its formats



commit 67db65f1d1b033daad56881ae5d2f7eaaecdc13b
Author: Michael Natterer <mitch gimp org>
Date:   Fri Apr 27 16:17:42 2012 +0200

    app: add GIMP_PRECISION_U32 and all its formats

 app/actions/image-actions.c  |    7 ++++
 app/core/core-enums.c        |    2 +
 app/core/core-enums.h        |    1 +
 app/core/gimpimage-convert.c |    4 ++
 app/core/gimpimage.c         |    1 +
 app/gegl/gimp-babl.c         |   65 ++++++++++++++++++++++++++++++++++++++++++
 app/widgets/gimphelp-ids.h   |    1 +
 libgimp/gimpenums.h          |    1 +
 menus/image-menu.xml.in      |    1 +
 tools/pdbgen/enums.pl        |    8 +++--
 10 files changed, 88 insertions(+), 3 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index b7ec8e6..b374789 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -167,6 +167,11 @@ static const GimpRadioActionEntry image_convert_precision_actions[] =
     NC_("image-convert-action", "Convert the image to 16 bit unsigned integer"),
     GIMP_PRECISION_U16, GIMP_HELP_IMAGE_CONVERT_U16 },
 
+  { "image-convert-u32", NULL,
+    NC_("image-convert-action", "32 bit unsigned integer"), NULL,
+    NC_("image-convert-action", "Convert the image to 32 bit unsigned integer"),
+    GIMP_PRECISION_U32, GIMP_HELP_IMAGE_CONVERT_U32 },
+
   { "image-convert-half", NULL,
     NC_("image-convert-action", "16 bit floating point"), NULL,
     NC_("image-convert-action", "Convert the image to 16 bit floating point"),
@@ -285,6 +290,7 @@ image_actions_update (GimpActionGroup *group,
         {
         case GIMP_PRECISION_U8:    action = "image-convert-u8";    break;
         case GIMP_PRECISION_U16:   action = "image-convert-u16";   break;
+        case GIMP_PRECISION_U32:   action = "image-convert-u32";   break;
         case GIMP_PRECISION_HALF:  action = "image-convert-half";  break;
         case GIMP_PRECISION_FLOAT: action = "image-convert-float"; break;
           break;
@@ -312,6 +318,7 @@ image_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("image-convert-u8",    image);
   SET_SENSITIVE ("image-convert-u16",   image && !is_indexed);
+  SET_SENSITIVE ("image-convert-u32",   image && !is_indexed);
   SET_SENSITIVE ("image-convert-half",  image && !is_indexed);
   SET_SENSITIVE ("image-convert-float", image && !is_indexed);
 
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 83335fb..67762e4 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -755,6 +755,7 @@ gimp_precision_get_type (void)
   {
     { GIMP_PRECISION_U8, "GIMP_PRECISION_U8", "u8" },
     { GIMP_PRECISION_U16, "GIMP_PRECISION_U16", "u16" },
+    { GIMP_PRECISION_U32, "GIMP_PRECISION_U32", "u32" },
     { GIMP_PRECISION_HALF, "GIMP_PRECISION_HALF", "half" },
     { GIMP_PRECISION_FLOAT, "GIMP_PRECISION_FLOAT", "float" },
     { 0, NULL, NULL }
@@ -764,6 +765,7 @@ gimp_precision_get_type (void)
   {
     { GIMP_PRECISION_U8, NC_("precision", "8-bit unsigned integer"), NULL },
     { GIMP_PRECISION_U16, NC_("precision", "16-bit unsigned integer"), NULL },
+    { GIMP_PRECISION_U32, NC_("precision", "32-bit unsigned integer"), NULL },
     { GIMP_PRECISION_HALF, NC_("precision", "16-bit floating point"), NULL },
     { GIMP_PRECISION_FLOAT, NC_("precision", "32-bit floating point"), NULL },
     { 0, NULL, NULL }
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index a46c2e8..8304641 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -350,6 +350,7 @@ typedef enum
 {
   GIMP_PRECISION_U8,    /*< desc="8-bit unsigned integer"  >*/
   GIMP_PRECISION_U16,   /*< desc="16-bit unsigned integer" >*/
+  GIMP_PRECISION_U32,   /*< desc="32-bit unsigned integer" >*/
   GIMP_PRECISION_HALF,  /*< desc="16-bit floating point"   >*/
   GIMP_PRECISION_FLOAT  /*< desc="32-bit floating point"   >*/
 } GimpPrecision;
diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c
index d229d20..3617e3f 100644
--- a/app/core/gimpimage-convert.c
+++ b/app/core/gimpimage-convert.c
@@ -1116,6 +1116,10 @@ gimp_image_convert_precision (GimpImage     *image,
       undo_desc = C_("undo-type", "Convert Image to 16 bit unsigned integer");
       break;
 
+    case GIMP_PRECISION_U32:
+      undo_desc = C_("undo-type", "Convert Image to 32 bit unsigned integer");
+      break;
+
     case GIMP_PRECISION_HALF:
       undo_desc = C_("undo-type", "Convert Image to 16 bit float");
       break;
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 38c4da3..65dc4ed 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1585,6 +1585,7 @@ gimp_image_get_mask_format (const GimpImage *image)
     {
     case GIMP_PRECISION_U8:    return babl_format ("Y u8");
     case GIMP_PRECISION_U16:   return babl_format ("Y u16");
+    case GIMP_PRECISION_U32:   return babl_format ("Y u32");
     case GIMP_PRECISION_HALF:  return babl_format ("Y half");
     case GIMP_PRECISION_FLOAT: return babl_format ("Y float");
     }
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index 6aa4f31..55287e0 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -74,6 +74,27 @@ gimp_babl_init (void)
                    babl_component ("A"),
                    NULL);
 
+  babl_format_new ("name", "R u32",
+                   babl_model ("RGBA"),
+                   babl_type ("u32"),
+                   babl_component ("R"),
+                   NULL);
+  babl_format_new ("name", "G u32",
+                   babl_model ("RGBA"),
+                   babl_type ("u32"),
+                   babl_component ("G"),
+                   NULL);
+  babl_format_new ("name", "B u32",
+                   babl_model ("RGBA"),
+                   babl_type ("u32"),
+                   babl_component ("B"),
+                   NULL);
+  babl_format_new ("name", "A u32",
+                   babl_model ("RGBA"),
+                   babl_type ("u32"),
+                   babl_component ("A"),
+                   NULL);
+
   babl_format_new ("name", "R half",
                    babl_model ("RGBA"),
                    babl_type ("half"),
@@ -132,42 +153,50 @@ babl_descriptions[] =
 {
   { "R'G'B' u8",  N_("RGB") },
   { "RGB u16",    N_("RGB") },
+  { "RGB u32",    N_("RGB") },
   { "RGB half",   N_("RGB") },
   { "RGB float",  N_("RGB") },
 
   { "R'G'B'A u8", N_("RGB-alpha") },
   { "RGBA u16",   N_("RGB-alpha") },
+  { "RGBA u32",   N_("RGB-alpha") },
   { "RGBA half",  N_("RGB-alpha") },
   { "RGBA float", N_("RGB-alpha") },
 
   { "Y' u8",      N_("Grayscale") },
   { "Y u8",       N_("Grayscale") },
   { "Y u16",      N_("Grayscale") },
+  { "Y u32",      N_("Grayscale") },
   { "Y half",     N_("Grayscale") },
   { "Y float",    N_("Grayscale") },
 
   { "Y'A u8",     N_("Grayscale-alpha") },
   { "YA u16",     N_("Grayscale-alpha") },
+  { "YA u32",     N_("Grayscale-alpha") },
   { "YA half",    N_("Grayscale-alpha") },
   { "YA float",   N_("Grayscale-alpha") },
 
   { "R' u8",      N_("Red component") },
   { "R u16",      N_("Red component") },
+  { "R u32",      N_("Red component") },
   { "R half",     N_("Red component") },
   { "R float",    N_("Red component") },
 
   { "G' u8",      N_("Green component") },
   { "G u16",      N_("Green component") },
+  { "G u32",      N_("Green component") },
   { "G half",     N_("Green component") },
   { "G float",    N_("Green component") },
 
   { "B' u8",      N_("Blue component") },
   { "B u16",      N_("Blue component") },
+  { "B u32",      N_("Blue component") },
   { "B half",     N_("Blue component") },
   { "B float",    N_("Blue component") },
 
   { "A u8",       N_("Alpha component") },
   { "A u16",      N_("Alpha component") },
+  { "A u32",      N_("Alpha component") },
   { "A half",     N_("Alpha component") },
   { "A float",    N_("Alpha component") },
   { "A double",   N_("Alpha component") }
@@ -257,6 +286,8 @@ gimp_babl_format_get_precision (const Babl *format)
     return GIMP_PRECISION_U8;
   else if (type == babl_type ("u16"))
     return GIMP_PRECISION_U16;
+  else if (type == babl_type ("u32"))
+    return GIMP_PRECISION_U32;
   else if (type == babl_type ("half"))
     return GIMP_PRECISION_HALF;
   else if (type == babl_type ("float"))
@@ -287,6 +318,12 @@ gimp_babl_format (GimpImageBaseType  base_type,
           else
             return babl_format ("RGB u16");
 
+        case GIMP_PRECISION_U32:
+          if (with_alpha)
+            return babl_format ("RGBA u32");
+          else
+            return babl_format ("RGB u32");
+
         case GIMP_PRECISION_HALF:
           if (with_alpha)
             return babl_format ("RGBA half");
@@ -319,6 +356,12 @@ gimp_babl_format (GimpImageBaseType  base_type,
           else
             return babl_format ("Y u16");
 
+        case GIMP_PRECISION_U32:
+          if (with_alpha)
+            return babl_format ("YA u32");
+          else
+            return babl_format ("Y u32");
+
         case GIMP_PRECISION_HALF:
           if (with_alpha)
             return babl_format ("YA half");
@@ -378,6 +421,18 @@ gimp_babl_component_format (GimpImageBaseType base_type,
             }
           break;
 
+        case GIMP_PRECISION_U32:
+          switch (index)
+            {
+            case 0: return babl_format ("R u32");
+            case 1: return babl_format ("G u32");
+            case 2: return babl_format ("B u32");
+            case 3: return babl_format ("A u32");
+            default:
+              break;
+            }
+          break;
+
         case GIMP_PRECISION_HALF:
           switch (index)
             {
@@ -430,6 +485,16 @@ gimp_babl_component_format (GimpImageBaseType base_type,
             }
           break;
 
+        case GIMP_PRECISION_U32:
+          switch (index)
+            {
+            case 0: return babl_format ("Y u32");
+            case 1: return babl_format ("A u32");
+            default:
+              break;
+            }
+          break;
+
         case GIMP_PRECISION_HALF:
           switch (index)
             {
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 293d526..92d722d 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -118,6 +118,7 @@
 #define GIMP_HELP_IMAGE_CONVERT_INDEXED           "gimp-image-convert-indexed"
 #define GIMP_HELP_IMAGE_CONVERT_U8                "gimp-image-convert-u8"
 #define GIMP_HELP_IMAGE_CONVERT_U16               "gimp-image-convert-u16"
+#define GIMP_HELP_IMAGE_CONVERT_U32               "gimp-image-convert-u32"
 #define GIMP_HELP_IMAGE_CONVERT_HALF              "gimp-image-convert-half"
 #define GIMP_HELP_IMAGE_CONVERT_FLOAT             "gimp-image-convert-float"
 #define GIMP_HELP_IMAGE_FLIP_HORIZONTAL           "gimp-image-flip-horizontal"
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index c338a7c..5c992cb 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -266,6 +266,7 @@ typedef enum
 {
   GIMP_PRECISION_U8,
   GIMP_PRECISION_U16,
+  GIMP_PRECISION_U32,
   GIMP_PRECISION_HALF,
   GIMP_PRECISION_FLOAT
 } GimpPrecision;
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 101742b..f2eef9a 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -323,6 +323,7 @@
       <menu action="image-precision-menu" name="Precision">
         <menuitem action="image-convert-u8" />
         <menuitem action="image-convert-u16" />
+        <menuitem action="image-convert-u32" />
         <menuitem action="image-convert-half" />
         <menuitem action="image-convert-float" />
         <separator />
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index 1936163..154eef2 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -541,11 +541,13 @@ package Gimp::CodeGen::enums;
 	{ contig => 1,
 	  header => 'core/core-enums.h',
 	  symbols => [ qw(GIMP_PRECISION_U8 GIMP_PRECISION_U16
-			  GIMP_PRECISION_HALF GIMP_PRECISION_FLOAT) ],
+			  GIMP_PRECISION_U32 GIMP_PRECISION_HALF
+			  GIMP_PRECISION_FLOAT) ],
 	  mapping => { GIMP_PRECISION_U8 => '0',
 		       GIMP_PRECISION_U16 => '1',
-		       GIMP_PRECISION_HALF => '2',
-		       GIMP_PRECISION_FLOAT => '3' }
+		       GIMP_PRECISION_U32 => '2',
+		       GIMP_PRECISION_HALF => '3',
+		       GIMP_PRECISION_FLOAT => '4' }
 	},
     GimpRotationType =>
 	{ contig => 1,



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