/* This file is part of PSPFormat, a File Format plugin for Adobe Photoshop Copyright (C) 2003-7 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* PSP File Format Specification is Copyright (C) 2000 Jasc Software, Inc. See http://www.jasc.com/specs/psp.asp */ enum{ PSP_SIG_LENGTH = 32, PSP_LAYER_NAME_MAX = 0x100, PSP_BLEND_RANGE_BYTES = 40, }; #define PSP_SIGNATURE "Paint Shop Pro Image File\012\032" #define PSP_BLOCK_ID "~BK" typedef struct{ char signature[PSP_SIG_LENGTH]; WORD major_version; WORD minor_version; } PSP_file_header; typedef struct{ char header_id[4]; WORD block_id; DWORD initial_len; // spec5 only DWORD block_len; } PSP_block_header; typedef struct{ DWORD chunk_size; // absent from spec5 LONG image_width; LONG image_height; DOUBLE resolution; BYTE res_metric; WORD comp_type; WORD bit_depth; WORD plane_count; DWORD colour_count; BYTE greyscale_flag; DWORD total_size; LONG active_layer; WORD layer_count; DWORD graphic_contents; // absent from spec5 /*...unknown data...*/ } PSP_image_attr_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 DWORD image_count; // absent from spec5 } PSP7_composite_image_bank_chunk; typedef struct{ LONG width; LONG height; WORD bit_depth; WORD comp_type; WORD plane_count; DWORD colour_count; DWORD palette_entry_count; WORD channel_count; } PSP5_thumbnail_attr_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 char name[PSP_LAYER_NAME_MAX]; // variable length string in spec6,7 BYTE type; RECT image_rect; RECT saved_rect; BYTE opacity; BYTE blending_mode; BYTE flags; BYTE transparency_flags; BYTE link_group_id; RECT mask_rect; RECT saved_mask_rect; BYTE mask_linked; BYTE mask_disabled; BYTE invert_mask_on_blend; WORD blend_range_count; BYTE blend_range_data[PSP_BLEND_RANGE_BYTES]; WORD bitmap_count; // absent from spec7 WORD channel_count; // absent from spec7 /*...unknown data...*/ // utility fields - not in file format long datapos; int index; } PSP_layer_info_chunk; typedef struct{ DWORD chunk_size; WORD bitmap_count; WORD channel_count; /*...unknown data...*/ } PSP7_layer_bitmap_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 DWORD comp_length; DWORD uncomp_length; WORD bitmap_type; WORD channel_type; /*...unknown data...*/ /* followed by Channel content... */ // not part of PSP format; long datapos; // file offset to channel data } PSP_channel_info_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 DWORD entry_count; /*...unknown data...*/ } PSP_palette_info_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 WORD alpha_count; /*...unknown data...*/ } PSP_alpha_bank_info_chunk; typedef struct{ DWORD chunk_size; // absent from spec5 char name[PSP_LAYER_NAME_MAX]; RECT alpha_rect; RECT saved_rect; WORD bitmap_count; // absent from spec6,7 WORD channel_count; // absent from spec6,7 /*...unknown data...*/ } PSP_alpha_channel_info_chunk; typedef struct{ DWORD chunk_size; WORD bitmap_count; WORD channel_count; /*...unknown data...*/ /* followed by Channel sub-block */ } PSP7_alpha_channel_chunk; extern char *psp7_block_id_strings[]; #define PSP7_LAST_BLOCK_ID_STR PSP_PATTERN_BLOCK extern char *psp7_dibtype_strings[]; #define PSP7_LAST_DIBTYPE_STR PSP_DIB_PATTERN_TRANS_MASK extern char *psp7_channeltype_strings[]; #define PSP7_LAST_CHANNELTYPE_STR PSP_CHANNEL_BLUE extern char *psp7_comptype_strings[]; #define PSP7_LAST_COMPTYPE_STR PSP_COMP_JPEG extern char *psp7_layertype_strings[]; #define PSP7_LAST_LAYERTYPE_STR keGLTAdjustment