[gimp/soc-2013-psd: 1/10] plug-ins: Initial branch creation and updated documentation.



commit 4039ff8579e01648a02b46537df31f8fc0893e8e
Author: Simon Lui <simonlui src gnome org>
Date:   Wed Jun 19 13:15:52 2013 -0400

    plug-ins: Initial branch creation and updated documentation.

 plug-ins/file-psd/psd-image-res-load.c |  299 ++++++++++++++++++++++----------
 plug-ins/file-psd/psd-layer-res-load.c |   92 +++++++----
 plug-ins/file-psd/psd.h                |   92 +++++++++-
 3 files changed, 353 insertions(+), 130 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c
index 9691ff0..bc7b624 100644
--- a/plug-ins/file-psd/psd-image-res-load.c
+++ b/plug-ins/file-psd/psd-image-res-load.c
@@ -77,9 +77,37 @@
   PSD_VERSION_INFO      = 1057,               * 0x0421 - Version info *
   PSD_EXIF_DATA         = 1058,    Loaded     * 0x0422 - Exif data block *
   PSD_XMP_DATA          = 1060,    Loaded     * 0x0424 - XMP data block *
+  PSD_CAPTION_DIGEST    = 1061,               * 0x0425 - Caption digest *
+  PSD_PRINT_SCALE       = 1062,               * 0x0426 - Print scale *
+  PSD_PIXEL_AR          = 1064,               * 0x0428 - Pixel aspect ratio *
+  PSD_LAYER_COMPS       = 1065,               * 0x0429 - Layer comps *
+  PSD_ALT_DUOTONE_COLOR = 1066,               * 0x042A - Alternative Duotone colors *
+  PSD_ALT_SPOT_COLOR    = 1067,               * 0x042B - Alternative Spot colors *
+  PSD_LAYER_SELECT_ID   = 1069,               * 0x042D - Layer selection ID *
+  PSD_HDR_TONING_INFO   = 1070,               * 0x042E - HDR toning information *
+  PSD_PRINT_INFO_SCALE  = 1071,               * 0x042F - Print scale *
+  PSD_LAYER_GROUP_E_ID  = 1072,               * 0x0430 - Layer group(s) enabled ID *
+  PSD_COLOR_SAMPLER_NEW = 1073,               * 0x0431 - Color sampler resource for ps CS3 and higher PSD 
files *
+  PSD_MEASURE_SCALE     = 1074,               * 0x0432 - Measurement scale *
+  PSD_TIMELINE_INFO     = 1075,               * 0x0433 - Timeline information *
+  PSD_SHEET_DISCLOSE    = 1076,               * 0x0434 - Sheet discloser *
+  PSD_DISPLAY_INFO_NEW  = 1077,               * 0x0435 - DisplayInfo structure for ps CS3 and higher PSD 
files *
+  PSD_ONION_SKINS       = 1078,               * 0x0436 - Onion skins *
+  PSD_COUNT_INFO        = 1080,               * 0x0438 - Count information*
+  PSD_PRINT_INFO        = 1082,               * 0x043A - Print information added in ps CS5*
+  PSD_PRINT_STYLE       = 1083,               * 0x043B - Print style *
+  PSD_MAC_NSPRINTINFO   = 1084,               * 0x043C - Mac NSPrintInfo*
+  PSD_WIN_DEVMODE       = 1085,               * 0x043D - Windows DEVMODE *
+  PSD_AUTO_SAVE_PATH    = 1086,               * 0x043E - Auto save file path *
+  PSD_AUTO_SAVE_FORMAT  = 1087,               * 0x043F - Auto save format *
   PSD_PATH_INFO_FIRST   = 2000,    Loaded     * 0x07d0 - First path info block *
   PSD_PATH_INFO_LAST    = 2998,    Loaded     * 0x0bb6 - Last path info block *
   PSD_CLIPPING_PATH     = 2999,               * 0x0bb7 - Name of clipping path *
+  PSD_PLUGIN_R_FIRST    = 4000,               * 0x0FA0 - First plugin resource *
+  PSD_PLUGIN_R_LAST     = 4999,               * 0x1387 - Last plugin resource *
+  PSD_IMAGEREADY_VARS   = 7000,               * 0x1B58 - Name of clipping path *
+  PSD_IMAGEREADY_DATA   = 7001,               * 0x1B59 - Name of clipping path *
+  PSD_LIGHTROOM_WORK    = 8000,               * 0x1F40 - Lightroom workflow *
   PSD_PRINT_FLAGS_2     = 10000               * 0x2710 - Print flags *
 */
 
@@ -254,7 +282,7 @@ load_image_resource (PSDimageres   *res_a,
       return -1;
     }
 
-   /* Process image resource blocks */
+  /* Process image resource blocks */
   if (memcmp (res_a->type, "8BIM", 4) != 0 &&
       memcmp (res_a->type, "MeSa", 4) !=0)
     {
@@ -265,6 +293,7 @@ load_image_resource (PSDimageres   *res_a,
     {
       switch (res_a->id)
         {
+<<<<<<< HEAD
           case PSD_PS2_IMAGE_INFO:
           case PSD_PS2_COLOR_TAB:
           case PSD_OBSOLETE_01:
@@ -355,6 +384,98 @@ load_image_resource (PSDimageres   *res_a,
               load_resource_2000 (res_a, image_id, f, error);
             else
               load_resource_unknown (res_a, image_id, f, error);
+=======
+       case PSD_PS2_IMAGE_INFO:
+       case PSD_PS2_COLOR_TAB:
+       case PSD_OBSOLETE_01:
+       case PSD_OBSOLETE_02:
+       case PSD_OBSOLETE_03:
+         /* Drop obsolete image resource blocks */
+         IFDBG(2) g_debug ("Obsolete image resource block: %d",
+                           res_a->id);
+         break;
+
+       case PSD_THUMB_RES:
+       case PSD_THUMB_RES2:
+         /* Drop thumbnails from standard file load */
+         IFDBG(2) g_debug ("Thumbnail resource block: %d",
+                           res_a->id);
+         break;
+
+       case PSD_MAC_PRINT_INFO:
+       case PSD_JPEG_QUAL:
+         /* Save photoshop resources with no meaning for GIMP
+            as image parasites */
+         load_resource_ps_only (res_a, image_id, f, error);
+         break;
+
+       case PSD_RESN_INFO:
+         load_resource_1005 (res_a, image_id, f, error);
+         break;
+
+       case PSD_ALPHA_NAMES:
+         load_resource_1006 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_DISPLAY_INFO:
+         load_resource_1007 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_CAPTION:
+         load_resource_1008 (res_a, image_id, f, error);
+         break;
+
+       case PSD_QUICK_MASK:
+         load_resource_1022 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_LAYER_STATE:
+         load_resource_1024 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_WORKING_PATH:
+         load_resource_2000 (res_a, image_id, f, error);
+         break;
+
+       case PSD_IPTC_NAA_DATA:
+         load_resource_1028 (res_a, image_id, f, error);
+         break;
+
+       case PSD_GRID_GUIDE:
+         load_resource_1032 (res_a, image_id, f, error);
+         break;
+
+       case PSD_ICC_PROFILE:
+         load_resource_1039 (res_a, image_id, f, error);
+         break;
+
+       case PSD_ALPHA_NAMES_UNI:
+         load_resource_1045 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_IDX_COL_TAB_CNT:
+         load_resource_1046 (res_a, image_id, f, error);
+         break;
+
+       case PSD_ALPHA_ID:
+         load_resource_1053 (res_a, image_id, img_a, f, error);
+         break;
+
+       case PSD_EXIF_DATA:
+         load_resource_1058 (res_a, image_id, f, error);
+         break;
+
+       case PSD_XMP_DATA:
+         load_resource_1060 (res_a, image_id, f, error);
+         break;
+
+       default:
+         if (res_a->id >= 2000 &&
+             res_a->id <  2999)
+           load_resource_2000 (res_a, image_id, f, error);
+         else
+           load_resource_unknown (res_a, image_id, f, error);
+>>>>>>> plug-ins: Initial branch creation and updated documentation.
         }
     }
 
@@ -390,14 +511,14 @@ load_thumbnail_resource (PSDimageres   *res_a,
       return -1;
     }
 
-   /* Process image resource blocks */
- if (res_a->id == PSD_THUMB_RES
-     || res_a->id == PSD_THUMB_RES2)
-   {
-        /* Load thumbnails from standard file load */
-        load_resource_1033 (res_a, image_id, f, error);
-        rtn = 1;
-   }
+  /* Process image resource blocks */
+  if (res_a->id == PSD_THUMB_RES
+      || res_a->id == PSD_THUMB_RES2)
+    {
+      /* Load thumbnails from standard file load */
+      load_resource_1033 (res_a, image_id, f, error);
+      rtn = 1;
+    }
 
   /* Image blocks are null padded to even length */
   if (res_a->data_len % 2 == 0)
@@ -439,7 +560,7 @@ load_resource_unknown (const PSDimageres  *res_a,
     }
 
   name = g_strdup_printf ("psd-image-resource-%.4s-%.4x",
-                            res_a->type, res_a->id);
+                         res_a->type, res_a->id);
   IFDBG(2) g_debug ("Parasite name: %s", name);
 
   parasite = gimp_parasite_new (name, 0, res_a->data_len, data);
@@ -474,7 +595,7 @@ load_resource_ps_only (const PSDimageres  *res_a,
     }
 
   name = g_strdup_printf ("psd-image-resource-%.4s-%.4x",
-                            res_a->type, res_a->id);
+                         res_a->type, res_a->id);
   IFDBG(2) g_debug ("Parasite name: %s", name);
 
   parasite = gimp_parasite_new (name, 0, res_a->data_len, data);
@@ -519,12 +640,12 @@ load_resource_1005 (const PSDimageres  *res_a,
   res_info.heightUnit = GINT16_FROM_BE (res_info.heightUnit);
 
   IFDBG(3) g_debug ("Resolution: %d, %d, %d, %d, %d, %d",
-                      res_info.hRes,
-                      res_info.hResUnit,
-                      res_info.widthUnit,
-                      res_info.vRes,
-                      res_info.vResUnit,
-                      res_info.heightUnit);
+                   res_info.hRes,
+                   res_info.hResUnit,
+                   res_info.widthUnit,
+                   res_info.vRes,
+                   res_info.vResUnit,
+                   res_info.heightUnit);
 
   /* Resolution always recorded as pixels / inch in a fixed point implied
      decimal int32 with 16 bits before point and 16 after (i.e. cast as
@@ -535,14 +656,14 @@ load_resource_1005 (const PSDimageres  *res_a,
   /* GIMP only has one display unit so use ps horizontal resolution unit */
   switch (res_info.hResUnit)
     {
-      case PSD_RES_INCH:
-        image_unit = GIMP_UNIT_INCH;
-        break;
-      case PSD_RES_CM:
-        image_unit = GIMP_UNIT_MM;
-        break;
-      default:
-        image_unit = GIMP_UNIT_INCH;
+    case PSD_RES_INCH:
+      image_unit = GIMP_UNIT_INCH;
+      break;
+    case PSD_RES_CM:
+      image_unit = GIMP_UNIT_MM;
+      break;
+    default:
+      image_unit = GIMP_UNIT_INCH;
     }
 
   gimp_image_set_unit (image_id, image_unit);
@@ -636,58 +757,58 @@ load_resource_1007 (const PSDimageres  *res_a,
 
       switch (dsp_info.colorSpace)
         {
-          case PSD_CS_RGB:
-            gimp_rgb_set (&gimp_rgb, ps_color.rgb.red / 65535.0,
-                          ps_color.rgb.green / 65535.0,
-                          ps_color.rgb.blue / 65535.0);
-            break;
-
-          case PSD_CS_HSB:
-            gimp_hsv_set (&gimp_hsv, ps_color.hsv.hue / 65535.0,
-                          ps_color.hsv.saturation / 65535.0,
-                          ps_color.hsv.value / 65535.0);
-            gimp_hsv_to_rgb (&gimp_hsv, &gimp_rgb);
-            break;
-
-          case PSD_CS_CMYK:
-            gimp_cmyk_set (&gimp_cmyk, 1.0 - ps_color.cmyk.cyan / 65535.0,
-                           1.0 - ps_color.cmyk.magenta / 65535.0,
-                           1.0 - ps_color.cmyk.yellow / 65535.0,
-                           1.0 - ps_color.cmyk.black / 65535.0);
-            gimp_cmyk_to_rgb (&gimp_cmyk, &gimp_rgb);
-            break;
-
-          case PSD_CS_GRAYSCALE:
-            gimp_rgb_set (&gimp_rgb, ps_color.gray.gray / 10000.0,
-                          ps_color.gray.gray / 10000.0,
-                          ps_color.gray.gray / 10000.0);
-            break;
-
-          case PSD_CS_FOCOLTONE:
-          case PSD_CS_TRUMATCH:
-          case PSD_CS_HKS:
-          case PSD_CS_LAB:
-          case PSD_CS_PANTONE:
-          case PSD_CS_TOYO:
-          case PSD_CS_DIC:
-          case PSD_CS_ANPA:
-          default:
-            if (CONVERSION_WARNINGS)
-              g_message ("Unsupported color space: %d",
-                         dsp_info.colorSpace);
-            gimp_rgb_set (&gimp_rgb, 1.0, 0.0, 0.0);
+       case PSD_CS_RGB:
+         gimp_rgb_set (&gimp_rgb, ps_color.rgb.red / 65535.0,
+                       ps_color.rgb.green / 65535.0,
+                       ps_color.rgb.blue / 65535.0);
+         break;
+
+       case PSD_CS_HSB:
+         gimp_hsv_set (&gimp_hsv, ps_color.hsv.hue / 65535.0,
+                       ps_color.hsv.saturation / 65535.0,
+                       ps_color.hsv.value / 65535.0);
+         gimp_hsv_to_rgb (&gimp_hsv, &gimp_rgb);
+         break;
+
+       case PSD_CS_CMYK:
+         gimp_cmyk_set (&gimp_cmyk, 1.0 - ps_color.cmyk.cyan / 65535.0,
+                        1.0 - ps_color.cmyk.magenta / 65535.0,
+                        1.0 - ps_color.cmyk.yellow / 65535.0,
+                        1.0 - ps_color.cmyk.black / 65535.0);
+         gimp_cmyk_to_rgb (&gimp_cmyk, &gimp_rgb);
+         break;
+
+       case PSD_CS_GRAYSCALE:
+         gimp_rgb_set (&gimp_rgb, ps_color.gray.gray / 10000.0,
+                       ps_color.gray.gray / 10000.0,
+                       ps_color.gray.gray / 10000.0);
+         break;
+
+       case PSD_CS_FOCOLTONE:
+       case PSD_CS_TRUMATCH:
+       case PSD_CS_HKS:
+       case PSD_CS_LAB:
+       case PSD_CS_PANTONE:
+       case PSD_CS_TOYO:
+       case PSD_CS_DIC:
+       case PSD_CS_ANPA:
+       default:
+         if (CONVERSION_WARNINGS)
+           g_message ("Unsupported color space: %d",
+                      dsp_info.colorSpace);
+         gimp_rgb_set (&gimp_rgb, 1.0, 0.0, 0.0);
         }
 
       gimp_rgb_set_alpha (&gimp_rgb, 1.0);
 
       IFDBG(2) g_debug ("PS cSpace: %d, col: %d %d %d %d, opacity: %d, kind: %d",
-             dsp_info.colorSpace, ps_color.cmyk.cyan, ps_color.cmyk.magenta,
-             ps_color.cmyk.yellow, ps_color.cmyk.black, dsp_info.opacity,
-             dsp_info.kind);
+                       dsp_info.colorSpace, ps_color.cmyk.cyan, ps_color.cmyk.magenta,
+                       ps_color.cmyk.yellow, ps_color.cmyk.black, dsp_info.opacity,
+                       dsp_info.kind);
 
       IFDBG(2) g_debug ("cSpace: %d, col: %g %g %g, opacity: %d, kind: %d",
-             dsp_info.colorSpace, gimp_rgb.r * 255 , gimp_rgb.g * 255,
-             gimp_rgb.b * 255, dsp_info.opacity, dsp_info.kind);
+                       dsp_info.colorSpace, gimp_rgb.r * 255 , gimp_rgb.g * 255,
+                       gimp_rgb.b * 255, dsp_info.opacity, dsp_info.kind);
 
       img_a->alpha_display_info[cidx] = g_malloc (sizeof (PSDchanneldata));
       img_a->alpha_display_info[cidx]->gimp_color = gimp_rgb;
@@ -748,8 +869,8 @@ load_resource_1022 (const PSDimageres  *res_a,
   img_a->quick_mask_id = GUINT16_FROM_BE (img_a->quick_mask_id);
 
   IFDBG(3) g_debug ("Quick mask channel: %d, empty: %d",
-                      img_a->quick_mask_id,
-                      quick_mask_empty);
+                   img_a->quick_mask_id,
+                   quick_mask_empty);
 
   return 0;
 }
@@ -828,7 +949,7 @@ load_resource_1028 (const PSDimageres  *res_a,
   /* Store resource data as a standard psd parasite */
   IFDBG (2) g_debug ("Processing IPTC data as psd parasite");
   name = g_strdup_printf ("psd-image-resource-%.4s-%.4x",
-                           res_a->type, res_a->id);
+                         res_a->type, res_a->id);
   IFDBG(3) g_debug ("Parasite name: %s", name);
 
   parasite = gimp_parasite_new (name, 0, res_a->data_len, res_data);
@@ -872,10 +993,10 @@ load_resource_1032 (const PSDimageres  *res_a,
   hdr.fGuideCount = GUINT32_FROM_BE (hdr.fGuideCount);
 
   IFDBG(3) g_debug ("Grids & Guides: %d, %d, %d, %d",
-                     hdr.fVersion,
-                     hdr.fGridCycleV,
-                     hdr.fGridCycleH,
-                     hdr.fGuideCount);
+                   hdr.fVersion,
+                   hdr.fGridCycleV,
+                   hdr.fGridCycleH,
+                   hdr.fGuideCount);
 
   for (i = 0; i < hdr.fGuideCount; ++i)
     {
@@ -889,8 +1010,8 @@ load_resource_1032 (const PSDimageres  *res_a,
       guide.fLocation /= 32;
 
       IFDBG(3) g_debug ("Guide: %d px, %d",
-                         guide.fLocation,
-                         guide.fDirection);
+                       guide.fLocation,
+                       guide.fDirection);
 
       if (guide.fDirection == PSD_VERTICAL)
         gimp_image_add_vguide (image_id, guide.fLocation);
@@ -948,9 +1069,9 @@ load_resource_1033 (const PSDimageres  *res_a,
   IFDBG(2) g_debug ("\nThumbnail:\n"
                     "\tFormat: %d\n"
                     "\tDimensions: %d x %d\n",
-                      thumb_info.format,
-                      thumb_info.width,
-                      thumb_info.height);
+                   thumb_info.format,
+                   thumb_info.width,
+                   thumb_info.height);
 
   if (thumb_info.format != 1)
     {
@@ -1220,7 +1341,7 @@ load_resource_1058 (const PSDimageres  *res_a,
   /* Store resource data as a standard psd parasite */
   IFDBG (2) g_debug ("Processing exif data as psd parasite");
   name = g_strdup_printf ("psd-image-resource-%.4s-%.4x",
-                           res_a->type, res_a->id);
+                         res_a->type, res_a->id);
   IFDBG(3) g_debug ("Parasite name: %s", name);
 
   parasite = gimp_parasite_new (name, 0, res_a->data_len, res_data);
@@ -1377,11 +1498,11 @@ load_resource_2000 (const PSDimageres  *res_a,
                   || type == PSD_PATH_OP_UNLNK)
                 {
                   if (fread (&y[0], 4, 1, f) < 1
-                    || fread (&x[0], 4, 1, f) < 1
-                    || fread (&y[1], 4, 1, f) < 1
-                    || fread (&x[1], 4, 1, f) < 1
-                    || fread (&y[2], 4, 1, f) < 1
-                    || fread (&x[2], 4, 1, f) < 1)
+                     || fread (&x[0], 4, 1, f) < 1
+                     || fread (&y[1], 4, 1, f) < 1
+                     || fread (&x[1], 4, 1, f) < 1
+                     || fread (&y[2], 4, 1, f) < 1
+                     || fread (&x[2], 4, 1, f) < 1)
                     {
                       psd_set_error (feof (f), errno, error);
                       return -1;
@@ -1429,5 +1550,5 @@ load_resource_2000 (const PSDimageres  *res_a,
       path_rec--;
     }
 
- return 0;
+  return 0;
 }
diff --git a/plug-ins/file-psd/psd-layer-res-load.c b/plug-ins/file-psd/psd-layer-res-load.c
index f98377f..8884ea1 100644
--- a/plug-ins/file-psd/psd-layer-res-load.c
+++ b/plug-ins/file-psd/psd-layer-res-load.c
@@ -22,7 +22,7 @@
   All layer resources not otherwise handled, including unknown types
   are dropped with a warning.
 
- * Adjustment layer IDs *
+  * Adjustment layer IDs *
   PSD_LADJ_LEVEL          "levl"    Drop Layer  * Adjustment layer - levels (PS4) *
   PSD_LADJ_CURVE          "curv"    Drop Layer  * Adjustment layer - curves (PS4) *
   PSD_LADJ_BRIGHTNESS     "brit"    Drop Layer  * Adjustment layer - brightness contrast (PS4) *
@@ -38,21 +38,23 @@
   PSD_LADJ_INVERT         "nvrt"    Drop Layer  * Adjustment layer - invert (PS4) *
   PSD_LADJ_THRESHOLD      "thrs"    Drop Layer  * Adjustment layer - threshold (PS4) *
   PSD_LADJ_POSTERIZE      "post"    Drop Layer  * Adjustment layer - posterize (PS4) *
+  PSD_LADJ_VIBRANCE       "vibA"        -       * Adjustment layer - vibrance (PS10) *
+  PSD_LADJ_COLOR_LOOKUP   "clrL"        -       * Adjustment layer - color lookup (PS13) *
 
- * Fill Layer IDs *
+  * Fill Layer IDs *
   PSD_LFIL_SOLID          "SoCo"        -       * Solid color sheet setting (PS6) *
   PSD_LFIL_PATTERN        "PtFl"        -       * Pattern fill setting (PS6) *
   PSD_LFIL_GRADIENT       "GdFl"        -       * Gradient fill setting (PS6) *
 
- * Effects Layer IDs *
+  * Effects Layer IDs *
   PSD_LFX_FX              "lrFX"        -       * Effects layer info (PS5) *
   PSD_LFX_FX2             "lfx2"        -       * Object based effects layer info (PS6) *
 
- * Type Tool Layers *
+  * Type Tool Layers *
   PSD_LTYP_TYPE           "tySh"        -       * Type tool layer (PS5) *
   PSD_LTYP_TYPE2          "TySh"        -       * Type tool object setting (PS6) *
 
- * Layer Properties *
+  * Layer Properties *
   PSD_LPRP_UNICODE        "luni"     Loaded     * Unicode layer name (PS5) *
   PSD_LPRP_SOURCE         "lnsr"     Loaded     * Layer name source setting (PS6) *
   PSD_LPRP_ID             "lyid"     Loaded     * Layer ID (PS5) *
@@ -63,13 +65,13 @@
   PSD_LPRP_COLOR          "lclr"        -       * Sheet color setting (PS6) *
   PSD_LPRP_REF_POINT      "fxrp"        -       * Reference point (PS6) *
 
- * Vector mask *
+  * Vector mask *
   PSD_LMSK_VMASK          "vmsk"        -       * Vector mask setting (PS6) *
 
- * Parasites *
+  * Parasites *
   PSD_LPAR_ANNOTATE       "Anno"        -       * Annotation (PS6) *
 
- * Other *
+  * Other *
   PSD_LOTH_PATTERN        "Patt"        -       * Patterns (PS6) *
   PSD_LOTH_GRADIENT       "grdm"        -       * Gradient settings (PS6) *
   PSD_LOTH_SECTION        "lsct"     Loaded     * Section divider setting (PS6) (Layer Groups) *
@@ -78,14 +80,42 @@
   PSD_LOTH_PATT_DATA      "shpa"        -       * Pattern data (PS6) *
   PSD_LOTH_META_DATA      "shmd"        -       * Meta data setting (PS6) *
   PSD_LOTH_LAYER_DATA     "layr"        -       * Layer data (PS6) *
-
- * Effects layer resource IDs *
+  PSD_LOTH_CONTENT_GEN    "CgEd"        -       * Content generator extra data (PS12) *
+  PSD_LOTH_TEXT_ENGINE    "Txt2"        -       * Text engine data (PS10) *
+  PSD_LOTH_PATH_NAME      "pths"        -       * Unicode path name (PS13) *
+  PSD_LOTH_ANIMATION_FX   "anFX"        -       * Animation effects (PS13) *
+  PSD_LOTH_FILTER_MASK    "FMsk"        -       * Filter mask (PS10) *
+  PSD_LOTH_VECTOR_STROKE  "vscg"        -       * Vector stroke data (PS13) *
+  PSD_LOTH_ALIGN_RENDER   "sn2P"        -       * Aligned rendering flag (?) *
+  PSD_LOTH_USER_MASK      "LMsk"        -       * User mask (?) *
+
+  * Effects layer resource IDs *
   PSD_LFX_COMMON          "cmnS"        -       * Effects layer - common state (PS5) *
   PSD_LFX_DROP_SDW        "dsdw"        -       * Effects layer - drop shadow (PS5) *
   PSD_LFX_INNER_SDW       "isdw"        -       * Effects layer - inner shadow (PS5) *
   PSD_LFX_OUTER_GLW       "oglw"        -       * Effects layer - outer glow (PS5) *
   PSD_LFX_INNER_GLW       "iglw"        -       * Effects layer - inner glow (PS5) *
   PSD_LFX_BEVEL           "bevl"        -       * Effects layer - bevel (PS5) *
+  
+  * New stuff temporarily until I can get them sorted out *
+
+  * Placed Layer *
+ PSD_LPL_PLACE_LAYER      "plLd"        -       * Placed layer (?) *
+ PSD_LPL_PLACE_LAYER_NEW  "SoLd"        -       * Placed layer (PS10) *
+
+ * Linked Layer *
+ PSD_LLL_LINKED_LAYER     "lnkD"        -       * Linked layer (?) *
+ PSD_LLL_LINKED_LAYER_2   "lnk2"        -       * Linked layer 2nd key *
+ PSD_LLL_LINKED_LAYER_3   "lnk3"        -       * Linked layer 3rd key *
+
+ * Merged Transparency *
+ PSD_LMT_MERGE_TRANS      "Mtrn"        -       * Merged transperency save flag (?) *
+ PSD_LMT_MERGE_TRANS_16   "Mt16"        -       * Merged transperency save flag 2 *
+ PSD_LMT_MERGE_TRANS_32   "Mt32"        -       * Merged transperency save flag 3 *
+
+ * Filter Effects *
+ PSD_LFFX_FILTER_FX       "FXid"        -       * Filter effects (?) *
+ PSD_LFFX_FILTER_FX_2     "FEid"        -       * Filter effects 2 *
 */
 
 #include "config.h"
@@ -161,7 +191,7 @@ get_layer_resource_header (PSDlayerres  *res_a,
   res_a->data_start = ftell (f);
 
   IFDBG(2) g_debug ("Sig: %.4s, key: %.4s, start: %d, len: %d",
-                     res_a->sig, res_a->key, res_a->data_start, res_a->data_len);
+                   res_a->sig, res_a->key, res_a->data_start, res_a->data_len);
 
   return 0;
 }
@@ -179,7 +209,7 @@ load_layer_resource (PSDlayerres  *res_a,
       return -1;
     }
 
-   /* Process layer resource blocks */
+  /* Process layer resource blocks */
   if (memcmp (res_a->sig, "8BIM", 4) != 0)
     {
       IFDBG(1) g_debug ("Unknown layer resource signature %.4s", res_a->sig);
@@ -201,29 +231,29 @@ load_layer_resource (PSDlayerres  *res_a,
           || memcmp (res_a->key, PSD_LADJ_THRESHOLD, 4) == 0
           || memcmp (res_a->key, PSD_LADJ_INVERT, 4) == 0
           || memcmp (res_a->key, PSD_LADJ_POSTERIZE, 4) == 0)
-            load_resource_ladj (res_a, lyr_a, f, error);
+       load_resource_ladj (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LFIL_SOLID, 4) == 0
-          || memcmp (res_a->key, PSD_LFIL_PATTERN, 4) == 0
-          || memcmp (res_a->key, PSD_LFIL_GRADIENT, 4) == 0)
-            load_resource_lfil (res_a, lyr_a, f, error);
+              || memcmp (res_a->key, PSD_LFIL_PATTERN, 4) == 0
+              || memcmp (res_a->key, PSD_LFIL_GRADIENT, 4) == 0)
+       load_resource_lfil (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LFX_FX, 4) == 0
-          || memcmp (res_a->key, PSD_LFX_FX2, 4) == 0)
-            load_resource_lfx (res_a, lyr_a, f, error);
+              || memcmp (res_a->key, PSD_LFX_FX2, 4) == 0)
+       load_resource_lfx (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LTYP_TYPE, 4) == 0
-          || memcmp (res_a->key, PSD_LTYP_TYPE2, 4) == 0)
-            load_resource_ltyp (res_a, lyr_a, f, error);
+              || memcmp (res_a->key, PSD_LTYP_TYPE2, 4) == 0)
+       load_resource_ltyp (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LPRP_UNICODE, 4) == 0)
-            load_resource_luni (res_a, lyr_a, f, error);
+       load_resource_luni (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LPRP_ID, 4) == 0)
-            load_resource_lyid (res_a, lyr_a, f, error);
+       load_resource_lyid (res_a, lyr_a, f, error);
 
       else if (memcmp (res_a->key, PSD_LOTH_SECTION, 4) == 0)
-            load_resource_lsct (res_a, lyr_a, f, error);
+       load_resource_lsct (res_a, lyr_a, f, error);
 
       else
         load_resource_unknown (res_a, lyr_a, f, error);
@@ -374,12 +404,12 @@ load_resource_ltyp (const PSDlayerres  *res_a,
       version = GINT16_FROM_BE (version);
       text_desc_vers = GINT16_FROM_BE (text_desc_vers);
       desc_version = GINT32_FROM_BE (desc_version);
-//      t_xx = GUINT64_FROM_BE (t_xx);
-//      t_xy = GUINT64_FROM_BE (t_xy);
-//      t_yx = GUINT64_FROM_BE (t_yx);
-//      t_yy = GUINT64_FROM_BE (t_yy);
-//      t_tx = GUINT64_FROM_BE (t_tx);
-//      t_ty = GUINT64_FROM_BE (t_ty);
+      //      t_xx = GUINT64_FROM_BE (t_xx);
+      //      t_xy = GUINT64_FROM_BE (t_xy);
+      //      t_yx = GUINT64_FROM_BE (t_yx);
+      //      t_yy = GUINT64_FROM_BE (t_yy);
+      //      t_tx = GUINT64_FROM_BE (t_tx);
+      //      t_ty = GUINT64_FROM_BE (t_ty);
 
       transform_xx = t_xx >> 11;
       transform_xy = t_xy >> 11;
@@ -396,8 +426,8 @@ load_resource_ltyp (const PSDlayerres  *res_a,
                         transform_xx, transform_xy, transform_yx,
                         transform_yy, transform_tx, transform_ty);
 
-//      classID = fread_unicode_string (&read_len, &write_len, 4, f);
-//      IFDBG(2) g_debug ("Unicode name: %s", classID);
+      //      classID = fread_unicode_string (&read_len, &write_len, 4, f);
+      //      IFDBG(2) g_debug ("Unicode name: %s", classID);
 
     }
 
diff --git a/plug-ins/file-psd/psd.h b/plug-ins/file-psd/psd.h
index 1bba60b..7221632 100644
--- a/plug-ins/file-psd/psd.h
+++ b/plug-ins/file-psd/psd.h
@@ -83,6 +83,8 @@
 #define PSD_LADJ_INVERT         "nvrt"          /* Adjustment layer - invert (PS4) */
 #define PSD_LADJ_THRESHOLD      "thrs"          /* Adjustment layer - threshold (PS4) */
 #define PSD_LADJ_POSTERIZE      "post"          /* Adjustment layer - posterize (PS4) */
+#define PSD_LADJ_VIBRANCE       "vibA"          /* Adjustment layer - vibrance (PS10) */
+#define PSD_LADJ_COLOR_LOOKUP   "clrL"          /* Adjustment layer - color lookup (PS13) */
 
 /* Fill Layer IDs */
 #define PSD_LFIL_SOLID          "SoCo"          /* Solid color sheet setting (PS6) */
@@ -117,12 +119,22 @@
 /* Other */
 #define PSD_LOTH_SECTION        "lsct"          /* Section divider setting - Layer groups (PS6) */
 #define PSD_LOTH_PATTERN        "Patt"          /* Patterns (PS6) */
+#define PSD_LOTH_PATTERN_2      "Pat2"          /* Patterns 2nd key (PS6) */
+#define PSD_LOTH_PATTERN_3      "Pat3"          /* Patterns 3rd key (PS6) */
 #define PSD_LOTH_GRADIENT       "grdm"          /* Gradient settings (PS6) */
 #define PSD_LOTH_RESTRICT       "brst"          /* Channel blending restriction setting (PS6) */
 #define PSD_LOTH_FOREIGN_FX     "ffxi"          /* Foreign effect ID (PS6) */
 #define PSD_LOTH_PATT_DATA      "shpa"          /* Pattern data (PS6) */
 #define PSD_LOTH_META_DATA      "shmd"          /* Meta data setting (PS6) */
 #define PSD_LOTH_LAYER_DATA     "layr"          /* Layer data (PS6) */
+#define PSD_LOTH_CONTENT_GEN    "CgEd"          /* Content generator extra data (PS12) */
+#define PSD_LOTH_TEXT_ENGINE    "Txt2"          /* Text engine data (PS10) */
+#define PSD_LOTH_PATH_NAME      "pths"          /* Unicode path name (PS13) */
+#define PSD_LOTH_ANIMATION_FX   "anFX"          /* Animation effects (PS13) */
+#define PSD_LOTH_FILTER_MASK    "FMsk"          /* Filter mask (PS10) */
+#define PSD_LOTH_VECTOR_STROKE  "vscg"          /* Vector stroke data (PS13) */
+#define PSD_LOTH_ALIGN_RENDER   "sn2P"          /* Aligned rendering flag (?) */
+#define PSD_LOTH_USER_MASK      "LMsk"          /* User mask (?) */
 
 /* Effects layer resource IDs */
 #define PSD_LFX_COMMON          "cmnS"          /* Effects layer - common state (PS5) */
@@ -132,6 +144,26 @@
 #define PSD_LFX_INNER_GLW       "iglw"          /* Effects layer - inner glow (PS5) */
 #define PSD_LFX_BEVEL           "bevl"          /* Effects layer - bevel (PS5) */
 
+/* New stuff temporarily until I can get them sorted out */
+
+/* Placed Layer */
+#define PSD_LPL_PLACE_LAYER     "plLd"          /* Placed layer (?) */
+#define PSD_LPL_PLACE_LAYER_NEW "SoLd"          /* Placed layer (PS10) */
+
+/* Linked Layer */
+#define PSD_LLL_LINKED_LAYER    "lnkD"          /* Linked layer (?) */
+#define PSD_LLL_LINKED_LAYER_2  "lnk2"          /* Linked layer 2nd key */
+#define PSD_LLL_LINKED_LAYER_3  "lnk3"          /* Linked layer 3rd key */
+
+/* Merged Transparency */
+#define PSD_LMT_MERGE_TRANS     "Mtrn"          /* Merged transperency save flag (?) */
+#define PSD_LMT_MERGE_TRANS_16  "Mt16"          /* Merged transperency save flag 2 */
+#define PSD_LMT_MERGE_TRANS_32  "Mt32"          /* Merged transperency save flag 3 */
+
+/* Filter Effects */
+#define PSD_LFFX_FILTER_FX      "FXid"          /* Filter effects (?) */
+#define PSD_LFFX_FILTER_FX_2    "FEid"          /* Filter effects 2 */
+
 /* PSD spec enums */
 
 /* Image color modes */
@@ -169,7 +201,7 @@ typedef enum {
   PSD_PS2_COLOR_TAB     = 1003,         /* 0x03eb - Obsolete - ps 2.0 indexed color table */
   PSD_RESN_INFO         = 1005,         /* 0x03ed - ResolutionInfo structure */
   PSD_ALPHA_NAMES       = 1006,         /* 0x03ee - Alpha channel names */
-  PSD_DISPLAY_INFO      = 1007,         /* 0x03ef - DisplayInfo structure */
+  PSD_DISPLAY_INFO      = 1007,         /* 0x03ef - Superceded by PSD_DISPLAY_INFO_NEW for ps CS3 and higher 
- DisplayInfo structure */
   PSD_CAPTION           = 1008,         /* 0x03f0 - Optional - Caption string */
   PSD_BORDER_INFO       = 1009,         /* 0x03f1 - Border info */
   PSD_BACKGROUND_COL    = 1010,         /* 0x03f2 - Background color */
@@ -198,8 +230,8 @@ typedef enum {
   PSD_COPYRIGHT_FLG     = 1034,         /* 0x040a - Copyright flag */
   PSD_URL               = 1035,         /* 0x040b - URL string */
   PSD_THUMB_RES2        = 1036,         /* 0x040c - Thumbnail resource */
-  PSD_GLOBAL_ANGLE      = 1037,         /* 0x040d - Global angle */
-  PSD_COLOR_SAMPLER     = 1038,         /* 0x040e - Color samplers resource */
+  PSD_GLOBAL_ANGLE      = 1037,         /* 0x040d - Superceded by PSD_NEW_COLOR_SAMPLER for ps CS3 and 
higher - Global angle */
+  PSD_COLOR_SAMPLER     = 1038,         /* 0x040e - Superceded by PSD_NEW_COLOR_SAMPLER for ps CS3 and 
higher - Color samplers resource */
   PSD_ICC_PROFILE       = 1039,         /* 0x040f - ICC Profile */
   PSD_WATERMARK         = 1040,         /* 0x0410 - Watermark */
   PSD_ICC_UNTAGGED      = 1041,         /* 0x0411 - Do not use ICC profile flag */
@@ -218,9 +250,37 @@ typedef enum {
   PSD_VERSION_INFO      = 1057,         /* 0x0421 - Version info */
   PSD_EXIF_DATA         = 1058,         /* 0x0422 - Exif data block */
   PSD_XMP_DATA          = 1060,         /* 0x0424 - XMP data block */
+  PSD_CAPTION_DIGEST    = 1061,         /* 0x0425 - Caption digest */
+  PSD_PRINT_SCALE       = 1062,         /* 0x0426 - Print scale */
+  PSD_PIXEL_AR          = 1064,         /* 0x0428 - Pixel aspect ratio */
+  PSD_LAYER_COMPS       = 1065,         /* 0x0429 - Layer comps */
+  PSD_ALT_DUOTONE_COLOR = 1066,         /* 0x042A - Alternative Duotone colors */
+  PSD_ALT_SPOT_COLOR    = 1067,         /* 0x042B - Alternative Spot colors */
+  PSD_LAYER_SELECT_ID   = 1069,         /* 0x042D - Layer selection ID */
+  PSD_HDR_TONING_INFO   = 1070,         /* 0x042E - HDR toning information */
+  PSD_PRINT_INFO_SCALE  = 1071,         /* 0x042F - Print scale */
+  PSD_LAYER_GROUP_E_ID  = 1072,         /* 0x0430 - Layer group(s) enabled ID */
+  PSD_COLOR_SAMPLER_NEW = 1073,         /* 0x0431 - Color sampler resource for ps CS3 and higher PSD files */
+  PSD_MEASURE_SCALE     = 1074,         /* 0x0432 - Measurement scale */
+  PSD_TIMELINE_INFO     = 1075,         /* 0x0433 - Timeline information */
+  PSD_SHEET_DISCLOSE    = 1076,         /* 0x0434 - Sheet discloser */
+  PSD_DISPLAY_INFO_NEW  = 1077,         /* 0x0435 - DisplayInfo structure for ps CS3 and higher PSD files */
+  PSD_ONION_SKINS       = 1078,         /* 0x0436 - Onion skins */
+  PSD_COUNT_INFO        = 1080,         /* 0x0438 - Count information*/
+  PSD_PRINT_INFO        = 1082,         /* 0x043A - Print information added in ps CS5*/
+  PSD_PRINT_STYLE       = 1083,         /* 0x043B - Print style */
+  PSD_MAC_NSPRINTINFO   = 1084,         /* 0x043C - Mac NSPrintInfo*/
+  PSD_WIN_DEVMODE       = 1085,         /* 0x043D - Windows DEVMODE */
+  PSD_AUTO_SAVE_PATH    = 1086,         /* 0x043E - Auto save file path */
+  PSD_AUTO_SAVE_FORMAT  = 1087,         /* 0x043F - Auto save format */
   PSD_PATH_INFO_FIRST   = 2000,         /* 0x07d0 - First path info block */
   PSD_PATH_INFO_LAST    = 2998,         /* 0x0bb6 - Last path info block */
   PSD_CLIPPING_PATH     = 2999,         /* 0x0bb7 - Name of clipping path */
+  PSD_PLUGIN_R_FIRST    = 4000,         /* 0x0FA0 - First plugin resource */
+  PSD_PLUGIN_R_LAST     = 4999,         /* 0x1387 - Last plugin resource */
+  PSD_IMAGEREADY_VARS   = 7000,         /* 0x1B58 - Name of clipping path */
+  PSD_IMAGEREADY_DATA   = 7001,         /* 0x1B59 - Name of clipping path */
+  PSD_LIGHTROOM_WORK    = 8000,         /* 0x1F40 - Lightroom workflow */
   PSD_PRINT_FLAGS_2     = 10000         /* 0x2710 - Print flags */
 } PSDImageResID;
 
@@ -363,14 +423,14 @@ typedef struct
 } CMGrayColor ;
 
 /* The color union is defined by the CMColor type definition.
-*/
+ */
 typedef union
 {
-   CMRGBColor        rgb;
-   CMHSVColor        hsv;
-   CMLabColor        Lab;
-   CMCMYKColor       cmyk;
-   CMGrayColor       gray;
+  CMRGBColor        rgb;
+  CMHSVColor        hsv;
+  CMLabColor        Lab;
+  CMCMYKColor       cmyk;
+  CMGrayColor       gray;
 } CMColor;
 
 
@@ -410,7 +470,7 @@ typedef struct {
   gint16        planes;                 /* Number of planes (always 1) */
 } ThumbnailInfo;
 
-/* Channel display info data */
+/* Channel display info data for Adobe Photoshop CS2 and lower */
 typedef struct {
   gint16        colorSpace;             /* Color space from  PSDColorSpace */
   guint16       color[4];               /* 4 * 16 bit color components */
@@ -419,6 +479,18 @@ typedef struct {
   gchar         padding;                /* Padding */
 } DisplayInfo;
 
+/* Channel display info data for Adobe Photoshop CS3 and higher to support floating point colors
+--Note-- There are an additional 4 bytes at the beginning of the block, that contain the version number 
+(which seems to be 1). */
+  typedef struct {
+    gint16        colorSpace;             /* Color space from  PSDColorSpace */
+    guint16       color[4];               /* 4 * 16 bit color components */
+    gint16        opacity;                /* Opacity 0 to 100 */
+    gchar         kind;                   /* Selected = 0, Protected = 1 */
+    gchar         mode;                   /* Alpha = 0, Inverted alpha = 1, Spot = 2 */
+  } DisplayInfoNew;
+
+
 /* PSD Channel length info data structure */
 typedef struct
 {


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