**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
switch(color_type)
{
case PNG_COLOR_TYPE_RGB:
- DEBUGPOINT();
for(y=0;y<surface_buffer.get_h();y++)
for(x=0;x<surface_buffer.get_w();x++)
{
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
- DEBUGPOINT();
for(y=0;y<surface_buffer.get_h();y++)
for(x=0;x<surface_buffer.get_w();x++)
{
float r=gamma().r_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].red);
float g=gamma().g_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].green);
float b=gamma().b_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].blue);
+ float a=1.0;
+ if(info_ptr->valid & PNG_INFO_tRNS)
+ a = (float)(unsigned char)png_ptr->trans[row_pointers[y][x]]*(1.0/255.0);
surface_buffer[y][x]=Color(
r,
g,
b,
- 1.0
+ a
);
}
break;
return;
}
- DEBUGPOINT();
-
- // \fixme These shouldn't be uncommented, but for some
- // reason, they crash the program. I will have to look into this
- // later. This is a memory leak, but it shouldn't be too bad.
-
png_read_end(png_ptr, end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
fclose(file);
png_mptr::~png_mptr()
{
- DEBUGPOINT();
}
bool
png_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*cb*/)
{
- surface.mirror(surface_buffer);
-// surface=surface_buffer;
+ surface=surface_buffer;
return true;
}