From 516ec006bfcf433e810bc75ba7e7e44b31968fd9 Mon Sep 17 00:00:00 2001 From: "GMT 1999 Adam D. Moss" Date: Mon, 18 Jan 1999 18:58:43 +0000 Subject: [PATCH] Better guess at how PSD files store Guide position precision. Mon Jan 18 18:56:05 GMT 1999 Adam D. Moss * plug-ins/psd/psd.c: Better guess at how PSD files store Guide position precision. --- ChangeLog | 5 +++++ plug-ins/common/psd.c | 47 ++++++++++++++++++++++++++++--------------- plug-ins/psd/psd.c | 47 ++++++++++++++++++++++++++++--------------- 3 files changed, 67 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68d11691a9..f6bea9070c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 18 18:56:05 GMT 1999 Adam D. Moss + + * plug-ins/psd/psd.c: Better guess at how PSD files store + Guide position precision. + Sun Jan 17 22:42:26 GMT 1999 Adam D. Moss * app/gdisplay.c app/gdisplay.h app/gimage_cmds.c: diff --git a/plug-ins/common/psd.c b/plug-ins/common/psd.c index 2151758f9d..b41b21307c 100644 --- a/plug-ins/common/psd.c +++ b/plug-ins/common/psd.c @@ -1,5 +1,5 @@ /* - * PSD Plugin version 2.0.1 + * PSD Plugin version 2.0.2 * This GIMP plug-in is designed to load Adobe Photoshop(tm) files (.PSD) * * Adam D. Moss @@ -9,7 +9,7 @@ * about the image you tried to load. Please don't send big PSD * files to me without asking first. * - * Copyright (C) 1997-98 Adam D. Moss + * Copyright (C) 1997-99 Adam D. Moss * Copyright (C) 1996 Torsten Martinsen * * This program is free software; you can redistribute it and/or modify @@ -35,6 +35,9 @@ /* * Revision history: * + * 1999.01.18 / v2.0.2 / Adam D. Moss + * Better guess at how PSD files store Guide position precision. + * * 1999.01.10 / v2.0.1 / Adam D. Moss * Greatly reduced memory requirements for layered image loading - * we now do just-in-time channel unpacking. Some little @@ -701,21 +704,21 @@ dispatch_resID(guint ID, FILE *fd, guint32 *offset, guint32 Size) if (Size > 0) { - glong magic1, magic2, magic3; + gshort magic1, magic2, magic3, magic4, magic5, magic6; glong num_guides; - magic1 = getglong(fd, "guide"); - (*offset) += 4; - magic2 = getglong(fd, "guide"); - (*offset) += 4; - magic3 = getglong(fd, "guide"); - (*offset) += 4; + magic1 = getgshort(fd, "guide"); (*offset) += 2; + magic2 = getgshort(fd, "guide"); (*offset) += 2; + magic3 = getgshort(fd, "guide"); (*offset) += 2; + magic4 = getgshort(fd, "guide"); (*offset) += 2; + magic5 = getgshort(fd, "guide"); (*offset) += 2; + magic6 = getgshort(fd, "guide"); (*offset) += 2; remaining -= 12; - IFDBG printf("\t\t\tMagic: %ld %ld %ld\n", - magic1, magic2, magic3); - IFDBG printf("\t\t\tMagic: %lx %lx %lx\n", - magic1, magic2, magic3); + IFDBG printf("\t\t\tMagic: %d %d %d %d %d %d\n", + magic1, magic2, magic3, magic4, magic5, magic6); + IFDBG printf("\t\t\tMagic: 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", + magic1, magic2, magic3, magic4, magic5, magic6); num_guides = getglong(fd, "guide"); (*offset) += 4; remaining -= 4; @@ -739,13 +742,25 @@ dispatch_resID(guint ID, FILE *fd, guint32 *offset, guint32 Size) for (i=0; i>8)) + /(double)(magic4&255)); + } + else + { + psd_image.guides[i].position = + rint((double)(psd_image.guides[i].position * + (magic6>>8)) + /(double)(magic6&255)); + } + IFDBG printf("\t\t\tGuide %d at %d, %s\n", i+1, psd_image.guides[i].position, psd_image.guides[i].horizontal ? "horizontal" : diff --git a/plug-ins/psd/psd.c b/plug-ins/psd/psd.c index 2151758f9d..b41b21307c 100644 --- a/plug-ins/psd/psd.c +++ b/plug-ins/psd/psd.c @@ -1,5 +1,5 @@ /* - * PSD Plugin version 2.0.1 + * PSD Plugin version 2.0.2 * This GIMP plug-in is designed to load Adobe Photoshop(tm) files (.PSD) * * Adam D. Moss @@ -9,7 +9,7 @@ * about the image you tried to load. Please don't send big PSD * files to me without asking first. * - * Copyright (C) 1997-98 Adam D. Moss + * Copyright (C) 1997-99 Adam D. Moss * Copyright (C) 1996 Torsten Martinsen * * This program is free software; you can redistribute it and/or modify @@ -35,6 +35,9 @@ /* * Revision history: * + * 1999.01.18 / v2.0.2 / Adam D. Moss + * Better guess at how PSD files store Guide position precision. + * * 1999.01.10 / v2.0.1 / Adam D. Moss * Greatly reduced memory requirements for layered image loading - * we now do just-in-time channel unpacking. Some little @@ -701,21 +704,21 @@ dispatch_resID(guint ID, FILE *fd, guint32 *offset, guint32 Size) if (Size > 0) { - glong magic1, magic2, magic3; + gshort magic1, magic2, magic3, magic4, magic5, magic6; glong num_guides; - magic1 = getglong(fd, "guide"); - (*offset) += 4; - magic2 = getglong(fd, "guide"); - (*offset) += 4; - magic3 = getglong(fd, "guide"); - (*offset) += 4; + magic1 = getgshort(fd, "guide"); (*offset) += 2; + magic2 = getgshort(fd, "guide"); (*offset) += 2; + magic3 = getgshort(fd, "guide"); (*offset) += 2; + magic4 = getgshort(fd, "guide"); (*offset) += 2; + magic5 = getgshort(fd, "guide"); (*offset) += 2; + magic6 = getgshort(fd, "guide"); (*offset) += 2; remaining -= 12; - IFDBG printf("\t\t\tMagic: %ld %ld %ld\n", - magic1, magic2, magic3); - IFDBG printf("\t\t\tMagic: %lx %lx %lx\n", - magic1, magic2, magic3); + IFDBG printf("\t\t\tMagic: %d %d %d %d %d %d\n", + magic1, magic2, magic3, magic4, magic5, magic6); + IFDBG printf("\t\t\tMagic: 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", + magic1, magic2, magic3, magic4, magic5, magic6); num_guides = getglong(fd, "guide"); (*offset) += 4; remaining -= 4; @@ -739,13 +742,25 @@ dispatch_resID(guint ID, FILE *fd, guint32 *offset, guint32 Size) for (i=0; i>8)) + /(double)(magic4&255)); + } + else + { + psd_image.guides[i].position = + rint((double)(psd_image.guides[i].position * + (magic6>>8)) + /(double)(magic6&255)); + } + IFDBG printf("\t\t\tGuide %d at %d, %s\n", i+1, psd_image.guides[i].position, psd_image.guides[i].horizontal ? "horizontal" :