-/*! ========================================================================
-** Synfig
-** bmp Target Module
-** $Id: mptr_bmp.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*! \file mptr_bmp.cpp
+** \brief bmp Target Module
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
** 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.
** 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.
/* === G L O B A L S ======================================================= */
SYNFIG_IMPORTER_INIT(bmp_mptr);
/* === G L O B A L S ======================================================= */
SYNFIG_IMPORTER_INIT(bmp_mptr);
SYNFIG_IMPORTER_SET_EXT(bmp_mptr,"bmp");
SYNFIG_IMPORTER_SET_VERSION(bmp_mptr,"0.1");
SYNFIG_IMPORTER_SET_EXT(bmp_mptr,"bmp");
SYNFIG_IMPORTER_SET_VERSION(bmp_mptr,"0.1");
-
- if(fread(&fileheader.bfSize, 1, sizeof(BITMAPFILEHEADER)-4, file)!=sizeof(BITMAPFILEHEADER)-4)
+
+ if(fread(&fileheader.bfSize, 1, sizeof(synfig::BITMAPFILEHEADER)-4, file)!=sizeof(synfig::BITMAPFILEHEADER)-4)
-
- if(fread(&infoheader, 1, sizeof(BITMAPINFOHEADER), file)!=sizeof(BITMAPINFOHEADER))
+
+ if(fread(&infoheader, 1, sizeof(synfig::BITMAPINFOHEADER), file)!=sizeof(synfig::BITMAPINFOHEADER))
- String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPFILEHEADER in %s. (bfOffsetBits=%d, should be %d)"),filename.c_str(),offset,sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)-2));
- if(cb)cb->error(str);
+ String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPFILEHEADER in %s. (bfOffsetBits=%d, should be %d)"),filename.c_str(),offset,sizeof(synfig::BITMAPFILEHEADER)+sizeof(synfig::BITMAPINFOHEADER)-2));
+ if(cb)cb->error(str);
- String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPINFOHEADER in %s. (biSize=%d, should be 40)"),filename.c_str(),little_endian(infoheader.biSize)));
- if(cb)cb->error(str);
+ String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPINFOHEADER in %s. (biSize=%d, should be 40)"),filename.c_str(),little_endian(infoheader.biSize)));
+ if(cb)cb->error(str);
int w,h,bit_count;
w=little_endian(infoheader.biWidth);
h=little_endian(infoheader.biHeight);
bit_count=little_endian_short(infoheader.biBitCount);
int w,h,bit_count;
w=little_endian(infoheader.biWidth);
h=little_endian(infoheader.biHeight);
bit_count=little_endian_short(infoheader.biBitCount);
synfig::warning("w:%d\n",w);
synfig::warning("h:%d\n",h);
synfig::warning("bit_count:%d\n",bit_count);
synfig::warning("w:%d\n",w);
synfig::warning("h:%d\n",h);
synfig::warning("bit_count:%d\n",bit_count);
else synfig::error("bmp_mptr::GetFrame(): "+string(_("Reading compressed bitmaps is not supported")));
return false;
}
if(bit_count!=24 && bit_count!=32)
{
else synfig::error("bmp_mptr::GetFrame(): "+string(_("Reading compressed bitmaps is not supported")));
return false;
}
if(bit_count!=24 && bit_count!=32)
{
- if(cb)cb->error("bmp_mptr::GetFrame(): "+strprintf(_("Unsupported bit depth (bit_count=%d, should be 24 or 32)"),bit_count));
+ if(cb)cb->error("bmp_mptr::GetFrame(): "+strprintf(_("Unsupported bit depth (bit_count=%d, should be 24 or 32)"),bit_count));
else synfig::error("bmp_mptr::GetFrame(): "+strprintf(_("Unsupported bit depth (bit_count=%d, should be 24 or 32)"),bit_count));
return false;
}
else synfig::error("bmp_mptr::GetFrame(): "+strprintf(_("Unsupported bit depth (bit_count=%d, should be 24 or 32)"),bit_count));
return false;
}
float b=gamma().b_U8_to_F32((unsigned char)fgetc(file));
float g=gamma().g_U8_to_F32((unsigned char)fgetc(file));
float r=gamma().r_U8_to_F32((unsigned char)fgetc(file));
float b=gamma().b_U8_to_F32((unsigned char)fgetc(file));
float g=gamma().g_U8_to_F32((unsigned char)fgetc(file));
float r=gamma().r_U8_to_F32((unsigned char)fgetc(file));