/[public]/psiconv/trunk/lib/psiconv/parse_image.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 230 Revision 351
1/* 1/*
2 parse_image.c - Part of psiconv, a PSION 5 file formats converter 2 parse_image.c - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 1999-2004 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 1999-2014 Frodo Looijaard <frodo@frodo.looijaard.name>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
126 psiconv_u32 off, int *length,int isclipart, 126 psiconv_u32 off, int *length,int isclipart,
127 psiconv_paint_data_section *result) 127 psiconv_paint_data_section *result)
128{ 128{
129 int res = 0; 129 int res = 0;
130 int len = 0; 130 int len = 0;
131 psiconv_u32 size,offset,picsize,temp,datasize,color, 131 psiconv_u32 size,offset,temp,datasize,color,
132 redbits,bluebits,greenbits; 132 redbits,bluebits,greenbits;
133 psiconv_u8 byte; 133 psiconv_u8 byte;
134 int leng,i; 134 int leng,i;
135 psiconv_u32 bits_per_pixel,compression; 135 psiconv_u32 bits_per_pixel,compression;
136 psiconv_pixel_bytes bytes,decoded; 136 psiconv_pixel_bytes bytes,decoded;
175 (*result)->ysize = psiconv_read_u32(config,buf,lev+2,off+len,&res); 175 (*result)->ysize = psiconv_read_u32(config,buf,lev+2,off+len,&res);
176 if (res) 176 if (res)
177 goto ERROR3; 177 goto ERROR3;
178 psiconv_debug(config,lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize); 178 psiconv_debug(config,lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize);
179 len += 4; 179 len += 4;
180
181 picsize = (*result)->ysize * (*result)->xsize;
182 180
183 psiconv_progress(config,lev+2,off+len,"Going to read the real picture x size"); 181 psiconv_progress(config,lev+2,off+len,"Going to read the real picture x size");
184 (*result)->pic_xsize = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res); 182 (*result)->pic_xsize = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res);
185 if (res) 183 if (res)
186 goto ERROR3; 184 goto ERROR3;
1002 psiconv_progress(config,lev+2,off, "Handling pixel %04x (%04x)",i,*pixel); 1000 psiconv_progress(config,lev+2,off, "Handling pixel %04x (%04x)",i,*pixel);
1003#endif 1001#endif
1004 if (!palet.length) { 1002 if (!palet.length) {
1005 if (color) { 1003 if (color) {
1006 (*floats).blue[i] = ((float) (*pixel & ((1 << bluebits) - 1))) / 1004 (*floats).blue[i] = ((float) (*pixel & ((1 << bluebits) - 1))) /
1007 (1 << bluebits); 1005 ((1 << bluebits) - 1);
1008 (*floats).green[i] = ((float) ((*pixel >> bluebits) & 1006 (*floats).green[i] = ((float) ((*pixel >> bluebits) &
1009 ((1 << greenbits) - 1))) / (1 << greenbits); 1007 ((1 << greenbits) - 1))) / ((1 << greenbits) - 1);
1010 (*floats).red[i] = ((float) ((*pixel >> (bluebits+greenbits)) & 1008 (*floats).red[i] = ((float) ((*pixel >> (bluebits+greenbits)) &
1011 ((1 << redbits) - 1))) / (1 << redbits); 1009 ((1 << redbits) - 1))) / ((1 << redbits) - 1);
1012 } else { 1010 } else {
1013 (*floats).red[i] = (*floats).green[i] = 1011 (*floats).red[i] = (*floats).green[i] =
1014 (*floats).blue[i] = ((float) *pixel) / 1012 (*floats).blue[i] = ((float) *pixel) /
1015 (1 << colordepth); 1013 ((1 << colordepth) - 1);
1016 } 1014 }
1017 } else { 1015 } else {
1018 if (*pixel >= palet.length) { 1016 if (*pixel >= palet.length) {
1019 psiconv_warn(config,lev+2,off, 1017 psiconv_warn(config,lev+2,off,
1020 "Invalid palet color found (using color 0x00)"); 1018 "Invalid palet color found (using color 0x00)");

Legend:
Removed from v.230  
changed lines
  Added in v.351

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26