[gimp] app: add double precision support, for completeness



commit 3c918353fb517290fba4d1e8f02d0fc5f5b4d240
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 9 00:41:58 2014 +0100

    app: add double precision support, for completeness
    
    and because it makes us look utterly cool.

 app/actions/image-actions.c            |   20 ++-
 app/core/core-enums.c                  |    6 +
 app/core/core-enums.h                  |   33 ++--
 app/core/gimpimage-convert-precision.c |    6 +
 app/core/gimpimage-metadata.c          |    4 +
 app/core/gimpimage.c                   |    4 +
 app/gegl/gimp-babl.c                   |  303 +++++++++++++++++++++++---------
 app/plug-in/gimppluginshm.c            |    2 +-
 app/widgets/gimpcolorframe.c           |    2 +
 app/widgets/gimphelp-ids.h             |    1 +
 app/xcf/xcf-save.c                     |    4 +
 libgimp/gimpenums.h                    |    7 +-
 menus/image-menu.xml.in                |    2 +
 tools/pdbgen/enums.pl                  |   14 +-
 14 files changed, 303 insertions(+), 105 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 21b908a..1703805 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -222,7 +222,19 @@ static const GimpRadioActionEntry image_convert_precision_actions[] =
     NC_("image-convert-action", "32 bit floating point (gamma)"), NULL,
     NC_("image-convert-action",
         "Convert the image to 32 bit gamma-corrected floating point"),
-    GIMP_PRECISION_FLOAT_GAMMA, GIMP_HELP_IMAGE_CONVERT_FLOAT }
+    GIMP_PRECISION_FLOAT_GAMMA, GIMP_HELP_IMAGE_CONVERT_FLOAT },
+
+  { "image-convert-double-linear", NULL,
+    NC_("image-convert-action", "64 bit floating point (linear)"), NULL,
+    NC_("image-convert-action",
+        "Convert the image to 64 bit linear floating point"),
+    GIMP_PRECISION_DOUBLE_LINEAR, GIMP_HELP_IMAGE_CONVERT_DOUBLE },
+
+  { "image-convert-double-gamma", NULL,
+    NC_("image-convert-action", "64 bit floating point (gamma)"), NULL,
+    NC_("image-convert-action",
+        "Convert the image to 64 bit gamma-corrected floating point"),
+    GIMP_PRECISION_DOUBLE_GAMMA, GIMP_HELP_IMAGE_CONVERT_DOUBLE }
 };
 
 static const GimpEnumActionEntry image_flip_actions[] =
@@ -359,6 +371,12 @@ image_actions_update (GimpActionGroup *group,
         case GIMP_PRECISION_FLOAT_GAMMA:
           action = "image-convert-float-gamma";
           break;
+        case GIMP_PRECISION_DOUBLE_LINEAR:
+          action = "image-convert-double-linear";
+          break;
+        case GIMP_PRECISION_DOUBLE_GAMMA:
+          action = "image-convert-double-gamma";
+          break;
         }
 
       gimp_action_group_set_action_active (group, action, TRUE);
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index b47176b..7ec1164 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -53,6 +53,7 @@ gimp_component_type_get_type (void)
     { GIMP_COMPONENT_TYPE_U32, "GIMP_COMPONENT_TYPE_U32", "u32" },
     { GIMP_COMPONENT_TYPE_HALF, "GIMP_COMPONENT_TYPE_HALF", "half" },
     { GIMP_COMPONENT_TYPE_FLOAT, "GIMP_COMPONENT_TYPE_FLOAT", "float" },
+    { GIMP_COMPONENT_TYPE_DOUBLE, "GIMP_COMPONENT_TYPE_DOUBLE", "double" },
     { 0, NULL, NULL }
   };
 
@@ -63,6 +64,7 @@ gimp_component_type_get_type (void)
     { GIMP_COMPONENT_TYPE_U32, NC_("component-type", "32-bit integer"), NULL },
     { GIMP_COMPONENT_TYPE_HALF, NC_("component-type", "16-bit floating point"), NULL },
     { GIMP_COMPONENT_TYPE_FLOAT, NC_("component-type", "32-bit floating point"), NULL },
+    { GIMP_COMPONENT_TYPE_DOUBLE, NC_("component-type", "64-bit floating point"), NULL },
     { 0, NULL, NULL }
   };
 
@@ -798,6 +800,8 @@ gimp_precision_get_type (void)
     { GIMP_PRECISION_HALF_GAMMA, "GIMP_PRECISION_HALF_GAMMA", "half-gamma" },
     { GIMP_PRECISION_FLOAT_LINEAR, "GIMP_PRECISION_FLOAT_LINEAR", "float-linear" },
     { GIMP_PRECISION_FLOAT_GAMMA, "GIMP_PRECISION_FLOAT_GAMMA", "float-gamma" },
+    { GIMP_PRECISION_DOUBLE_LINEAR, "GIMP_PRECISION_DOUBLE_LINEAR", "double-linear" },
+    { GIMP_PRECISION_DOUBLE_GAMMA, "GIMP_PRECISION_DOUBLE_GAMMA", "double-gamma" },
     { 0, NULL, NULL }
   };
 
@@ -813,6 +817,8 @@ gimp_precision_get_type (void)
     { GIMP_PRECISION_HALF_GAMMA, NC_("precision", "16-bit gamma floating point"), NULL },
     { GIMP_PRECISION_FLOAT_LINEAR, NC_("precision", "32-bit linear floating point"), NULL },
     { GIMP_PRECISION_FLOAT_GAMMA, NC_("precision", "32-bit gamma floating point"), NULL },
+    { GIMP_PRECISION_DOUBLE_LINEAR, NC_("precision", "64-bit linear floating point"), NULL },
+    { GIMP_PRECISION_DOUBLE_GAMMA, NC_("precision", "64-bit gamma floating point"), NULL },
     { 0, NULL, NULL }
   };
 
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index b8339df..bab4702 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -60,11 +60,12 @@ GType gimp_component_type_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_COMPONENT_TYPE_U8    = 100, /*< desc="8-bit integer"         >*/
-  GIMP_COMPONENT_TYPE_U16   = 200, /*< desc="16-bit integer"        >*/
-  GIMP_COMPONENT_TYPE_U32   = 300, /*< desc="32-bit integer"        >*/
-  GIMP_COMPONENT_TYPE_HALF  = 400, /*< desc="16-bit floating point" >*/
-  GIMP_COMPONENT_TYPE_FLOAT = 500  /*< desc="32-bit floating point" >*/
+  GIMP_COMPONENT_TYPE_U8     = 100, /*< desc="8-bit integer"         >*/
+  GIMP_COMPONENT_TYPE_U16    = 200, /*< desc="16-bit integer"        >*/
+  GIMP_COMPONENT_TYPE_U32    = 300, /*< desc="32-bit integer"        >*/
+  GIMP_COMPONENT_TYPE_HALF   = 400, /*< desc="16-bit floating point" >*/
+  GIMP_COMPONENT_TYPE_FLOAT  = 500, /*< desc="32-bit floating point" >*/
+  GIMP_COMPONENT_TYPE_DOUBLE = 600  /*< desc="64-bit floating point" >*/
 } GimpComponentType;
 
 
@@ -362,16 +363,18 @@ GType gimp_precision_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_PRECISION_U8_LINEAR    = 100, /*< desc="8-bit linear integer"         >*/
-  GIMP_PRECISION_U8_GAMMA     = 150, /*< desc="8-bit gamma integer"          >*/
-  GIMP_PRECISION_U16_LINEAR   = 200, /*< desc="16-bit linear integer"        >*/
-  GIMP_PRECISION_U16_GAMMA    = 250, /*< desc="16-bit gamma integer"         >*/
-  GIMP_PRECISION_U32_LINEAR   = 300, /*< desc="32-bit linear integer"        >*/
-  GIMP_PRECISION_U32_GAMMA    = 350, /*< desc="32-bit gamma integer"         >*/
-  GIMP_PRECISION_HALF_LINEAR  = 400, /*< desc="16-bit linear floating point" >*/
-  GIMP_PRECISION_HALF_GAMMA   = 450, /*< desc="16-bit gamma floating point"  >*/
-  GIMP_PRECISION_FLOAT_LINEAR = 500, /*< desc="32-bit linear floating point" >*/
-  GIMP_PRECISION_FLOAT_GAMMA  = 550  /*< desc="32-bit gamma floating point"  >*/
+  GIMP_PRECISION_U8_LINEAR     = 100, /*< desc="8-bit linear integer"         >*/
+  GIMP_PRECISION_U8_GAMMA      = 150, /*< desc="8-bit gamma integer"          >*/
+  GIMP_PRECISION_U16_LINEAR    = 200, /*< desc="16-bit linear integer"        >*/
+  GIMP_PRECISION_U16_GAMMA     = 250, /*< desc="16-bit gamma integer"         >*/
+  GIMP_PRECISION_U32_LINEAR    = 300, /*< desc="32-bit linear integer"        >*/
+  GIMP_PRECISION_U32_GAMMA     = 350, /*< desc="32-bit gamma integer"         >*/
+  GIMP_PRECISION_HALF_LINEAR   = 400, /*< desc="16-bit linear floating point" >*/
+  GIMP_PRECISION_HALF_GAMMA    = 450, /*< desc="16-bit gamma floating point"  >*/
+  GIMP_PRECISION_FLOAT_LINEAR  = 500, /*< desc="32-bit linear floating point" >*/
+  GIMP_PRECISION_FLOAT_GAMMA   = 550, /*< desc="32-bit gamma floating point"  >*/
+  GIMP_PRECISION_DOUBLE_LINEAR = 600, /*< desc="64-bit linear floating point" >*/
+  GIMP_PRECISION_DOUBLE_GAMMA  = 650  /*< desc="64-bit gamma floating point"  >*/
 } GimpPrecision;
 
 
diff --git a/app/core/gimpimage-convert-precision.c b/app/core/gimpimage-convert-precision.c
index c8fc19a..1781c21 100644
--- a/app/core/gimpimage-convert-precision.c
+++ b/app/core/gimpimage-convert-precision.c
@@ -95,6 +95,12 @@ gimp_image_convert_precision (GimpImage     *image,
     case GIMP_PRECISION_FLOAT_GAMMA:
       undo_desc = C_("undo-type", "Convert Image to 32 bit gamma floating point");
       break;
+    case GIMP_PRECISION_DOUBLE_LINEAR:
+      undo_desc = C_("undo-type", "Convert Image to 64 bit linear floating point");
+      break;
+    case GIMP_PRECISION_DOUBLE_GAMMA:
+      undo_desc = C_("undo-type", "Convert Image to 64 bit gamma floating point");
+      break;
     }
 
   if (progress)
diff --git a/app/core/gimpimage-metadata.c b/app/core/gimpimage-metadata.c
index fb947ec..459dac1 100644
--- a/app/core/gimpimage-metadata.c
+++ b/app/core/gimpimage-metadata.c
@@ -91,6 +91,10 @@ gimp_image_set_metadata (GimpImage    *image,
             case GIMP_COMPONENT_TYPE_FLOAT:
               gimp_metadata_set_bits_per_sample (metadata, 32);
               break;
+
+            case GIMP_COMPONENT_TYPE_DOUBLE:
+              gimp_metadata_set_bits_per_sample (metadata, 64);
+              break;
             }
 
           gimp_image_get_resolution (image, &xres, &yres);
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 226b872..8df0e36 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1230,6 +1230,10 @@ gimp_image_real_precision_changed (GimpImage *image)
         case GIMP_COMPONENT_TYPE_FLOAT:
           gimp_metadata_set_bits_per_sample (metadata, 32);
           break;
+
+        case GIMP_COMPONENT_TYPE_DOUBLE:
+          gimp_metadata_set_bits_per_sample (metadata, 64);
+          break;
         }
     }
 
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index 8284571..c5f97dd 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -212,6 +212,36 @@ gimp_babl_init (void)
                    babl_component ("A"),
                    NULL);
 
+  babl_format_new ("name", "R double",
+                   babl_model ("RGBA"),
+                   babl_type ("double"),
+                   babl_component ("R"),
+                   NULL);
+  babl_format_new ("name", "R' double",
+                   babl_model ("R'G'B'A"),
+                   babl_type ("double"),
+                   babl_component ("R'"),
+                   NULL);
+  babl_format_new ("name", "G double",
+                   babl_model ("RGBA"),
+                   babl_type ("double"),
+                   babl_component ("G"),
+                   NULL);
+  babl_format_new ("name", "G' double",
+                   babl_model ("R'G'B'A"),
+                   babl_type ("double"),
+                   babl_component ("G'"),
+                   NULL);
+  babl_format_new ("name", "B double",
+                   babl_model ("RGBA"),
+                   babl_type ("double"),
+                   babl_component ("B"),
+                   NULL);
+  babl_format_new ("name", "B' double",
+                   babl_model ("R'G'B'A"),
+                   babl_type ("double"),
+                   babl_component ("B'"),
+                   NULL);
   babl_format_new ("name", "A double",
                    babl_model ("RGBA"),
                    babl_type ("double"),
@@ -226,82 +256,96 @@ static const struct
 }
 babl_descriptions[] =
 {
-  { "RGB u8",        N_("RGB") },
-  { "R'G'B' u8",     N_("RGB") },
-  { "RGB u16",       N_("RGB") },
-  { "R'G'B' u16",    N_("RGB") },
-  { "RGB u32",       N_("RGB") },
-  { "R'G'B' u32",    N_("RGB") },
-  { "RGB half",      N_("RGB") },
-  { "R'G'B' half",   N_("RGB") },
-  { "RGB float",     N_("RGB") },
-  { "R'G'B' float",  N_("RGB") },
-
-  { "RGBA u8",       N_("RGB-alpha") },
-  { "R'G'B'A u8",    N_("RGB-alpha") },
-  { "RGBA u16",      N_("RGB-alpha") },
-  { "R'G'B'A u16",   N_("RGB-alpha") },
-  { "RGBA u32",      N_("RGB-alpha") },
-  { "R'G'B'A u32",   N_("RGB-alpha") },
-  { "RGBA half",     N_("RGB-alpha") },
-  { "R'G'B'A half",  N_("RGB-alpha") },
-  { "RGBA float",    N_("RGB-alpha") },
-  { "R'G'B'A float", N_("RGB-alpha") },
-
-  { "Y u8",          N_("Grayscale") },
-  { "Y' u8",         N_("Grayscale") },
-  { "Y u16",         N_("Grayscale") },
-  { "Y' u16",        N_("Grayscale") },
-  { "Y u32",         N_("Grayscale") },
-  { "Y' u32",        N_("Grayscale") },
-  { "Y half",        N_("Grayscale") },
-  { "Y' half",       N_("Grayscale") },
-  { "Y float",       N_("Grayscale") },
-  { "Y' float",      N_("Grayscale") },
-
-  { "YA u8",         N_("Grayscale-alpha") },
-  { "Y'A u8",        N_("Grayscale-alpha") },
-  { "YA u16",        N_("Grayscale-alpha") },
-  { "Y'A u16",       N_("Grayscale-alpha") },
-  { "YA u32",        N_("Grayscale-alpha") },
-  { "Y'A u32",       N_("Grayscale-alpha") },
-  { "YA half",       N_("Grayscale-alpha") },
-  { "Y'A half",      N_("Grayscale-alpha") },
-  { "YA float",      N_("Grayscale-alpha") },
-  { "Y'A float",     N_("Grayscale-alpha") },
-
-  { "R u8",          N_("Red component") },
-  { "R' u8",         N_("Red component") },
-  { "R u16",         N_("Red component") },
-  { "R' u16",        N_("Red component") },
-  { "R u32",         N_("Red component") },
-  { "R' u32",        N_("Red component") },
-  { "R half",        N_("Red component") },
-  { "R' half",       N_("Red component") },
-  { "R float",       N_("Red component") },
-  { "R' float",      N_("Red component") },
-
-  { "G u8",          N_("Green component") },
-  { "G' u8",         N_("Green component") },
-  { "G u16",         N_("Green component") },
-  { "G' u16",        N_("Green component") },
-  { "G u32",         N_("Green component") },
-  { "G' u32",        N_("Green component") },
-  { "G half",        N_("Green component") },
-  { "G' half",       N_("Green component") },
-  { "G float",       N_("Green component") },
-  { "G' float",      N_("Green component") },
-
-  { "B u8",          N_("Blue component") },
-  { "B' u8",         N_("Blue component") },
-  { "B u16",         N_("Blue component") },
-  { "B' u16",        N_("Blue component") },
-  { "B u32",         N_("Blue component") },
-  { "B' u32",        N_("Blue component") },
-  { "B half",        N_("Blue component") },
-  { "B' half",       N_("Blue component") },
-  { "B float",       N_("Blue component") },
-  { "B' float",      N_("Blue component") },
+  { "RGB u8",         N_("RGB") },
+  { "R'G'B' u8",      N_("RGB") },
+  { "RGB u16",        N_("RGB") },
+  { "R'G'B' u16",     N_("RGB") },
+  { "RGB u32",        N_("RGB") },
+  { "R'G'B' u32",     N_("RGB") },
+  { "RGB half",       N_("RGB") },
+  { "R'G'B' half",    N_("RGB") },
+  { "RGB float",      N_("RGB") },
+  { "R'G'B' float",   N_("RGB") },
+  { "RGB double",     N_("RGB") },
+  { "R'G'B' double",  N_("RGB") },
+
+  { "RGBA u8",        N_("RGB-alpha") },
+  { "R'G'B'A u8",     N_("RGB-alpha") },
+  { "RGBA u16",       N_("RGB-alpha") },
+  { "R'G'B'A u16",    N_("RGB-alpha") },
+  { "RGBA u32",       N_("RGB-alpha") },
+  { "R'G'B'A u32",    N_("RGB-alpha") },
+  { "RGBA half",      N_("RGB-alpha") },
+  { "R'G'B'A half",   N_("RGB-alpha") },
+  { "RGBA float",     N_("RGB-alpha") },
+  { "R'G'B'A float",  N_("RGB-alpha") },
+  { "RGBA double",    N_("RGB-alpha") },
+  { "R'G'B'A double", N_("RGB-alpha") },
+
+  { "Y u8",           N_("Grayscale") },
+  { "Y' u8",          N_("Grayscale") },
+  { "Y u16",          N_("Grayscale") },
+  { "Y' u16",         N_("Grayscale") },
+  { "Y u32",          N_("Grayscale") },
+  { "Y' u32",         N_("Grayscale") },
+  { "Y half",         N_("Grayscale") },
+  { "Y' half",        N_("Grayscale") },
+  { "Y float",        N_("Grayscale") },
+  { "Y' float",       N_("Grayscale") },
+  { "Y double",       N_("Grayscale") },
+  { "Y' double",      N_("Grayscale") },
+
+  { "YA u8",          N_("Grayscale-alpha") },
+  { "Y'A u8",         N_("Grayscale-alpha") },
+  { "YA u16",         N_("Grayscale-alpha") },
+  { "Y'A u16",        N_("Grayscale-alpha") },
+  { "YA u32",         N_("Grayscale-alpha") },
+  { "Y'A u32",        N_("Grayscale-alpha") },
+  { "YA half",        N_("Grayscale-alpha") },
+  { "Y'A half",       N_("Grayscale-alpha") },
+  { "YA float",       N_("Grayscale-alpha") },
+  { "Y'A float",      N_("Grayscale-alpha") },
+  { "YA double",      N_("Grayscale-alpha") },
+  { "Y'A double",     N_("Grayscale-alpha") },
+
+  { "R u8",           N_("Red component") },
+  { "R' u8",          N_("Red component") },
+  { "R u16",          N_("Red component") },
+  { "R' u16",         N_("Red component") },
+  { "R u32",          N_("Red component") },
+  { "R' u32",         N_("Red component") },
+  { "R half",         N_("Red component") },
+  { "R' half",        N_("Red component") },
+  { "R float",        N_("Red component") },
+  { "R' float",       N_("Red component") },
+  { "R double",       N_("Red component") },
+  { "R' double",      N_("Red component") },
+
+  { "G u8",           N_("Green component") },
+  { "G' u8",          N_("Green component") },
+  { "G u16",          N_("Green component") },
+  { "G' u16",         N_("Green component") },
+  { "G u32",          N_("Green component") },
+  { "G' u32",         N_("Green component") },
+  { "G half",         N_("Green component") },
+  { "G' half",        N_("Green component") },
+  { "G float",        N_("Green component") },
+  { "G' float",       N_("Green component") },
+  { "G double",       N_("Green component") },
+  { "G' double",      N_("Green component") },
+
+  { "B u8",           N_("Blue component") },
+  { "B' u8",          N_("Blue component") },
+  { "B u16",          N_("Blue component") },
+  { "B' u16",         N_("Blue component") },
+  { "B u32",          N_("Blue component") },
+  { "B' u32",         N_("Blue component") },
+  { "B half",         N_("Blue component") },
+  { "B' half",        N_("Blue component") },
+  { "B float",        N_("Blue component") },
+  { "B' float",       N_("Blue component") },
+  { "B double",       N_("Blue component") },
+  { "B' double",      N_("Blue component") },
 
   { "A u8",          N_("Alpha component") },
   { "A u16",         N_("Alpha component") },
@@ -401,6 +445,8 @@ gimp_babl_format_get_component_type (const Babl *format)
     return GIMP_COMPONENT_TYPE_HALF;
   else if (type == babl_type ("float"))
     return GIMP_COMPONENT_TYPE_FLOAT;
+  else if (type == babl_type ("double"))
+    return GIMP_COMPONENT_TYPE_DOUBLE;
 
   g_return_val_if_reached (-1);
 }
@@ -426,6 +472,8 @@ gimp_babl_format_get_precision (const Babl *format)
         return GIMP_PRECISION_HALF_LINEAR;
       else if (type == babl_type ("float"))
         return GIMP_PRECISION_FLOAT_LINEAR;
+      else if (type == babl_type ("double"))
+        return GIMP_PRECISION_DOUBLE_LINEAR;
     }
   else
     {
@@ -439,6 +487,8 @@ gimp_babl_format_get_precision (const Babl *format)
         return GIMP_PRECISION_HALF_GAMMA;
       else if (type == babl_type ("float"))
         return GIMP_PRECISION_FLOAT_GAMMA;
+      else if (type == babl_type ("double"))
+        return GIMP_PRECISION_DOUBLE_GAMMA;
     }
 
   g_return_val_if_reached (-1);
@@ -499,6 +549,10 @@ gimp_babl_component_type (GimpPrecision precision)
     case GIMP_PRECISION_FLOAT_LINEAR:
     case GIMP_PRECISION_FLOAT_GAMMA:
       return GIMP_COMPONENT_TYPE_FLOAT;
+
+    case GIMP_PRECISION_DOUBLE_LINEAR:
+    case GIMP_PRECISION_DOUBLE_GAMMA:
+      return GIMP_COMPONENT_TYPE_DOUBLE;
     }
 
   g_return_val_if_reached (-1);
@@ -524,7 +578,7 @@ gimp_babl_precision (GimpComponentType component,
 
     case GIMP_COMPONENT_TYPE_U32:
       if (linear)
-         return GIMP_PRECISION_U32_LINEAR;
+        return GIMP_PRECISION_U32_LINEAR;
       else
         return GIMP_PRECISION_U32_GAMMA;
 
@@ -540,6 +594,12 @@ gimp_babl_precision (GimpComponentType component,
       else
         return GIMP_PRECISION_FLOAT_GAMMA;
 
+    case GIMP_COMPONENT_TYPE_DOUBLE:
+      if (linear)
+        return GIMP_PRECISION_DOUBLE_LINEAR;
+      else
+        return GIMP_PRECISION_DOUBLE_GAMMA;
+
     default:
       break;
     }
@@ -617,6 +677,18 @@ gimp_babl_format (GimpImageBaseType  base_type,
           else
             return babl_format ("R'G'B' float");
 
+        case GIMP_PRECISION_DOUBLE_LINEAR:
+          if (with_alpha)
+            return babl_format ("RGBA double");
+          else
+            return babl_format ("RGB double");
+
+        case GIMP_PRECISION_DOUBLE_GAMMA:
+          if (with_alpha)
+            return babl_format ("R'G'B'A double");
+          else
+            return babl_format ("R'G'B' double");
+
         default:
           break;
         }
@@ -685,6 +757,18 @@ gimp_babl_format (GimpImageBaseType  base_type,
           else
             return babl_format ("Y' float");
 
+        case GIMP_PRECISION_DOUBLE_LINEAR:
+          if (with_alpha)
+            return babl_format ("YA double");
+          else
+            return babl_format ("Y double");
+
+        case GIMP_PRECISION_DOUBLE_GAMMA:
+          if (with_alpha)
+            return babl_format ("Y'A double");
+          else
+            return babl_format ("Y' double");
+
         default:
           break;
         }
@@ -703,11 +787,12 @@ gimp_babl_mask_format (GimpPrecision precision)
 {
   switch (gimp_babl_component_type (precision))
     {
-    case GIMP_COMPONENT_TYPE_U8:    return babl_format ("Y u8");
-    case GIMP_COMPONENT_TYPE_U16:   return babl_format ("Y u16");
-    case GIMP_COMPONENT_TYPE_U32:   return babl_format ("Y u32");
-    case GIMP_COMPONENT_TYPE_HALF:  return babl_format ("Y half");
-    case GIMP_COMPONENT_TYPE_FLOAT: return babl_format ("Y float");
+    case GIMP_COMPONENT_TYPE_U8:     return babl_format ("Y u8");
+    case GIMP_COMPONENT_TYPE_U16:    return babl_format ("Y u16");
+    case GIMP_COMPONENT_TYPE_U32:    return babl_format ("Y u32");
+    case GIMP_COMPONENT_TYPE_HALF:   return babl_format ("Y half");
+    case GIMP_COMPONENT_TYPE_FLOAT:  return babl_format ("Y float");
+    case GIMP_COMPONENT_TYPE_DOUBLE: return babl_format ("Y double");
     }
 
   g_return_val_if_reached (NULL);
@@ -843,6 +928,30 @@ gimp_babl_component_format (GimpImageBaseType base_type,
             }
           break;
 
+        case GIMP_PRECISION_DOUBLE_LINEAR:
+          switch (index)
+            {
+            case 0: return babl_format ("R double");
+            case 1: return babl_format ("G double");
+            case 2: return babl_format ("B double");
+            case 3: return babl_format ("A double");
+            default:
+              break;
+            }
+          break;
+
+        case GIMP_PRECISION_DOUBLE_GAMMA:
+          switch (index)
+            {
+            case 0: return babl_format ("R' double");
+            case 1: return babl_format ("G' double");
+            case 2: return babl_format ("B' double");
+            case 3: return babl_format ("A double");
+            default:
+              break;
+            }
+          break;
+
         default:
           break;
         }
@@ -951,6 +1060,26 @@ gimp_babl_component_format (GimpImageBaseType base_type,
             }
           break;
 
+        case GIMP_PRECISION_DOUBLE_LINEAR:
+          switch (index)
+            {
+            case 0: return babl_format ("Y double");
+            case 1: return babl_format ("A double");
+            default:
+              break;
+            }
+          break;
+
+        case GIMP_PRECISION_DOUBLE_GAMMA:
+          switch (index)
+            {
+            case 0: return babl_format ("Y' double");
+            case 1: return babl_format ("A double");
+            default:
+              break;
+            }
+          break;
+
         default:
           break;
         }
@@ -1052,6 +1181,16 @@ gimp_babl_print_pixel (const Babl *format,
           strings[i] = g_strdup_printf ("%0.6f", color[i]);
       }
       break;
+
+    case GIMP_COMPONENT_TYPE_DOUBLE:
+      {
+        gdouble *color = pixel;
+        gint     i;
+
+        for (i = 0; i < n_components; i++)
+          strings[i] = g_strdup_printf ("%0.6f", color[i]);
+      }
+      break;
     }
 
   return strings;
diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c
index b854ff5..11029c0 100644
--- a/app/plug-in/gimppluginshm.c
+++ b/app/plug-in/gimppluginshm.c
@@ -70,7 +70,7 @@
 #include "gimp-log.h"
 
 
-#define TILE_MAP_SIZE (GIMP_PLUG_IN_TILE_WIDTH * GIMP_PLUG_IN_TILE_HEIGHT * 16)
+#define TILE_MAP_SIZE (GIMP_PLUG_IN_TILE_WIDTH * GIMP_PLUG_IN_TILE_HEIGHT * 32)
 
 #define ERRMSG_SHM_DISABLE "Disabling shared memory tile transport"
 
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index adf522f..5df85b1 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -531,6 +531,8 @@ gimp_color_frame_update (GimpColorFrame *frame)
               case GIMP_PRECISION_U32_GAMMA:
               case GIMP_PRECISION_FLOAT_LINEAR:
               case GIMP_PRECISION_FLOAT_GAMMA:
+              case GIMP_PRECISION_DOUBLE_LINEAR:
+              case GIMP_PRECISION_DOUBLE_GAMMA:
                 print_format = frame->sample_format;
                 break;
 
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index e5fe99f..95d7464 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -126,6 +126,7 @@
 #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_CONVERT_DOUBLE            "gimp-image-convert-double"
 #define GIMP_HELP_IMAGE_CONVERT_PRECISION         "gimp-image-convert-precision"
 #define GIMP_HELP_IMAGE_FLIP_HORIZONTAL           "gimp-image-flip-horizontal"
 #define GIMP_HELP_IMAGE_FLIP_VERTICAL             "gimp-image-flip-vertical"
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 91b192e..3d849b8 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -223,6 +223,10 @@ xcf_save_choose_format (XcfInfo   *info,
   if (gimp_image_get_metadata (image))
     save_version = MAX (6, save_version);
 
+  /* need version 7 for double precision images */
+  if (gimp_image_get_component_type (image) != GIMP_COMPONENT_TYPE_DOUBLE)
+    save_version = MAX (7, save_version);
+
   info->file_version = save_version;
 }
 
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index 77c0c63..029c0f5 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -57,7 +57,8 @@ typedef enum
   GIMP_COMPONENT_TYPE_U16 = 200,
   GIMP_COMPONENT_TYPE_U32 = 300,
   GIMP_COMPONENT_TYPE_HALF = 400,
-  GIMP_COMPONENT_TYPE_FLOAT = 500
+  GIMP_COMPONENT_TYPE_FLOAT = 500,
+  GIMP_COMPONENT_TYPE_DOUBLE = 600
 } GimpComponentType;
 
 
@@ -287,7 +288,9 @@ typedef enum
   GIMP_PRECISION_HALF_LINEAR = 400,
   GIMP_PRECISION_HALF_GAMMA = 450,
   GIMP_PRECISION_FLOAT_LINEAR = 500,
-  GIMP_PRECISION_FLOAT_GAMMA = 550
+  GIMP_PRECISION_FLOAT_GAMMA = 550,
+  GIMP_PRECISION_DOUBLE_LINEAR = 600,
+  GIMP_PRECISION_DOUBLE_GAMMA = 650
 } GimpPrecision;
 
 
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 4e6c790..c003dff 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -338,6 +338,8 @@
         <menuitem action="image-convert-half-gamma" />
         <menuitem action="image-convert-float-linear" />
         <menuitem action="image-convert-float-gamma" />
+        <menuitem action="image-convert-double-linear" />
+        <menuitem action="image-convert-double-gamma" />
         <separator />
       </menu>
       <menu action="image-transform-menu" name="Transform">
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index 6132b72..4b2378c 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -420,12 +420,14 @@ package Gimp::CodeGen::enums;
          header => 'core/core-enums.h',
          symbols => [ qw(GIMP_COMPONENT_TYPE_U8 GIMP_COMPONENT_TYPE_U16
                          GIMP_COMPONENT_TYPE_U32 GIMP_COMPONENT_TYPE_HALF
-                         GIMP_COMPONENT_TYPE_FLOAT) ],
+                         GIMP_COMPONENT_TYPE_FLOAT
+                         GIMP_COMPONENT_TYPE_DOUBLE) ],
          mapping => { GIMP_COMPONENT_TYPE_U8 => '100',
                       GIMP_COMPONENT_TYPE_U16 => '200',
                       GIMP_COMPONENT_TYPE_U32 => '300',
                       GIMP_COMPONENT_TYPE_HALF => '400',
-                      GIMP_COMPONENT_TYPE_FLOAT => '500' }
+                      GIMP_COMPONENT_TYPE_FLOAT => '500',
+                      GIMP_COMPONENT_TYPE_DOUBLE => '600' }
        },
     GimpConvertDitherType =>
        { contig => 1,
@@ -562,7 +564,9 @@ package Gimp::CodeGen::enums;
                          GIMP_PRECISION_HALF_LINEAR
                          GIMP_PRECISION_HALF_GAMMA
                          GIMP_PRECISION_FLOAT_LINEAR
-                         GIMP_PRECISION_FLOAT_GAMMA) ],
+                         GIMP_PRECISION_FLOAT_GAMMA
+                         GIMP_PRECISION_DOUBLE_LINEAR
+                         GIMP_PRECISION_DOUBLE_GAMMA) ],
          mapping => { GIMP_PRECISION_U8_LINEAR => '100',
                       GIMP_PRECISION_U8_GAMMA => '150',
                       GIMP_PRECISION_U16_LINEAR => '200',
@@ -572,7 +576,9 @@ package Gimp::CodeGen::enums;
                       GIMP_PRECISION_HALF_LINEAR => '400',
                       GIMP_PRECISION_HALF_GAMMA => '450',
                       GIMP_PRECISION_FLOAT_LINEAR => '500',
-                      GIMP_PRECISION_FLOAT_GAMMA => '550' }
+                      GIMP_PRECISION_FLOAT_GAMMA => '550',
+                      GIMP_PRECISION_DOUBLE_LINEAR => '600',
+                      GIMP_PRECISION_DOUBLE_GAMMA => '650' }
        },
     GimpRotationType =>
        { contig => 1,


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