~ubuntu-branches/ubuntu/edgy/gimp/edgy-updates

« back to all changes in this revision

Viewing changes to plug-ins/common/psd_save.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-04-21 13:00:24 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060421130024-0haogkgt8adj9qjj
Tags: 2.2.11-1ubuntu1
* Resynchronized with Debian, only changes to Debian are:
  - debian/rules:
    - added gettext Domain to .desktop file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
#define IFDBG if (DEBUG)
88
88
#define IF_DEEP_DBG if (DEBUG && DEBUG_LEVEL == 2)
89
89
 
 
90
 
 
91
#define PSD_UNIT_INCH 1
 
92
#define PSD_UNIT_CM   2
 
93
 
90
94
/* *** END OF DEFINES *** */
91
95
 
92
96
 
800
804
      IFDBG printf ("      Total length of 0x0400 resource: %d\n", (int) sizeof (gshort));
801
805
    }
802
806
 
 
807
  /* --------------- Write resolution data ------------------- */
 
808
  {
 
809
    gdouble xres = 0, yres = 0;
 
810
    guint32 xres_fix, yres_fix;
 
811
    GimpUnit g_unit;
 
812
    gshort psd_unit;
 
813
 
 
814
    g_unit = gimp_image_get_unit (image_id);
 
815
    gimp_image_get_resolution (image_id, &xres, &yres);
 
816
 
 
817
    if (g_unit == GIMP_UNIT_MM)
 
818
      {
 
819
        gdouble factor = gimp_unit_get_factor (g_unit) / 10.0;
 
820
 
 
821
        xres /= factor;
 
822
        yres /= factor;
 
823
 
 
824
        psd_unit = PSD_UNIT_CM;
 
825
      }
 
826
    else
 
827
      {
 
828
        psd_unit = PSD_UNIT_INCH;
 
829
      }
 
830
 
 
831
    xres_fix = xres * 65536.0 + .5; /* Convert to 16.16 fixed point */
 
832
    yres_fix = yres * 65536.0 + .5; /* Convert to 16.16 fixed point */
 
833
 
 
834
    xfwrite (fd, "8BIM", 4, "imageresources signature (for resolution)");
 
835
    write_gshort(fd, 0x03ed, "0x03ed Id (resolution)");
 
836
    write_gshort (fd, 0, "Id name"); /* Set to null string (two zeros) */
 
837
    write_glong (fd, 16, "0x0400 resource size");
 
838
    write_glong (fd,  xres_fix, "hRes (16.16 fixed point)");
 
839
    write_gshort (fd, psd_unit, "hRes unit");
 
840
    write_gshort (fd, psd_unit, "width unit");
 
841
    write_glong (fd,  yres_fix, "vRes (16.16 fixed point)");
 
842
    write_gshort (fd, psd_unit, "vRes unit");
 
843
    write_gshort (fd, psd_unit, "height unit");
 
844
  }
803
845
  /* --------------- Write Active Layer Number --------------- */
804
846
 
805
847
  if (ActiveLayerPresent)