diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-01 22:22:32 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-01 22:22:32 +0200 |
commit | 46e597df44402086edd010b69702c2de52b75fc8 (patch) | |
tree | fa9528f19f951b765b071c239b09547cf69bd169 /tools/convpic | |
parent | 57729cf285b058d192a60bd7fce1b2d29bdd9650 (diff) | |
download | graphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.gz graphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.bz2 |
initial upload to branch 'touchcol'. see file 'HISTORY' for changes
Diffstat (limited to 'tools/convpic')
-rw-r--r-- | tools/convpic/bmp.c | 9 | ||||
-rw-r--r-- | tools/convpic/tiff.c | 6 | ||||
-rw-r--r-- | tools/convpic/tuxbox.c | 21 | ||||
-rw-r--r-- | tools/convpic/tuxbox.h | 6 |
4 files changed, 28 insertions, 14 deletions
diff --git a/tools/convpic/bmp.c b/tools/convpic/bmp.c index 0829302..0357988 100644 --- a/tools/convpic/bmp.c +++ b/tools/convpic/bmp.c @@ -89,7 +89,8 @@ bool cBMPFile::Load(GLCD::cImage & image, const std::string & fileName) long iSize; uint32_t x, y; uint16_t iRead; - uint8_t * bitmap = NULL; +// uint8_t * bitmap = NULL; + uint32_t *bitmap = NULL; bool bInvert = false; if (fileName.length() > 0) @@ -163,7 +164,8 @@ bool cBMPFile::Load(GLCD::cImage & image, const std::string & fileName) image.SetWidth(bmpHeader.bmpWidth); image.SetHeight(bmpHeader.bmpHeight); image.SetDelay(100); - bitmap = new unsigned char[bmpHeader.bmpHeight * ((bmpHeader.bmpWidth + 7) / 8)]; +// bitmap = new unsigned char[bmpHeader.bmpHeight * ((bmpHeader.bmpWidth + 7) / 8)]; + bitmap = new uint32_t [bmpHeader.bmpHeight * bmpHeader.bmpWidth]; if (!bitmap) { fprintf(stderr, "ERROR: cannot allocate memory\n"); @@ -260,7 +262,8 @@ bool cBMPFile::Save(const GLCD::cBitmap * bitmap, const std::string & fileName) char Dummy = 0x00; uint32_t x, y; uint16_t iWrote; - const uint8_t * bmpdata = bitmap->Data(); +// const uint8_t * bmpdata = bitmap->Data(); + const uint32_t * bmpdata = bitmap->Data(); if (bitmap && bitmap->Width() > 0 diff --git a/tools/convpic/tiff.c b/tools/convpic/tiff.c index 4b8bf0e..3eb8cad 100644 --- a/tools/convpic/tiff.c +++ b/tools/convpic/tiff.c @@ -71,7 +71,8 @@ bool cTIFFFile::Load(GLCD::cImage & image, const std::string & fileName) unsigned char fLittleEndian=0; int j; int t; - unsigned char *bitmap = NULL; +// unsigned char *bitmap = NULL; + uint32_t *bitmap = NULL; bool bInvert = false; if (fileName.length() > 0) @@ -152,7 +153,8 @@ bool cTIFFFile::Load(GLCD::cImage & image, const std::string & fileName) image.SetWidth(width); image.SetHeight(height); image.SetDelay(100); - bitmap = new unsigned char[height * ((width + 7) / 8)]; +// bitmap = new unsigned char[height * ((width + 7) / 8)]; + bitmap = new uint32_t[height * width]; if (bitmap) { if (fread(bitmap, height*((width+7)/8), 1, fIN)!=1) diff --git a/tools/convpic/tuxbox.c b/tools/convpic/tuxbox.c index 55d6e1d..9e3f558 100644 --- a/tools/convpic/tuxbox.c +++ b/tools/convpic/tuxbox.c @@ -118,15 +118,19 @@ bool cTuxBoxFile::Load(GLCD::cImage & image, const std::string & fileName) for (unsigned int n=0;n<ntohs(header.count);++n) { ret = false; - unsigned int nBmpSize = image.Height() * ((image.Width() + 7) / 8); - unsigned char *bitmap = new unsigned char[nBmpSize]; +// unsigned int nBmpSize = image.Height() * ((image.Width() + 7) / 8); + unsigned int nBmpSize = image.Height() * image.Width(); +// unsigned char *bitmap = new unsigned char[nBmpSize]; + uint32_t *bitmap = new uint32_t [nBmpSize]; if (!bitmap) { fprintf(stderr, "ERROR: malloc failed."); break; } - unsigned int nAniSize = image.Width() * ((image.Height() + 7) / 8); - unsigned char *pAni = new unsigned char[nAniSize]; +// unsigned int nAniSize = image.Width() * ((image.Height() + 7) / 8); + unsigned int nAniSize = image.Width() * image.Height(); +// unsigned char *pAni = new unsigned char[nAniSize]; + uint32_t *pAni = new uint32_t [nAniSize]; if (!pAni) { delete[] bitmap; @@ -200,7 +204,8 @@ bool cTuxBoxFile::Save(GLCD::cImage & image, const std::string & fileName) { bRet = false; unsigned int nAniSize = image.Width() * ((image.Height() + 7) / 8); - unsigned char *pAni = new unsigned char[nAniSize]; +// unsigned char *pAni = new unsigned char[nAniSize]; + uint32_t *pAni = new uint32_t [nAniSize]; if (!pAni) { fprintf(stderr, "ERROR: malloc failed."); @@ -233,7 +238,8 @@ rotate from {Byte} to {Byte} {o}[o][o][o][o][o][o][o] => [ oooooooo ] {o}[o][o][o][o][o][o][o] => [ oooooooo ] {o}[o][o][o][o][o][o][o] => [ oooooooo ]*/ -void cTuxBoxFile::vert2horz(const unsigned char* source, unsigned char* dest, int width, int height) { +//void cTuxBoxFile::vert2horz(const unsigned char* source, unsigned char* dest, int width, int height) { +void cTuxBoxFile::vert2horz(const uint32_t *source, uint32_t *dest, int width, int height) { int x, y, off; memset(dest,0,height*((width+7)/8)); @@ -261,7 +267,8 @@ rotate from {Byte} to {Byte} [ oooooooo ] => {o}[o][o][o][o][o][o][o] [ oooooooo ] => {o}[o][o][o][o][o][o][o] [ oooooooo ] => {o}[o][o][o][o][o][o][o]*/ -void cTuxBoxFile::horz2vert(const unsigned char* source, unsigned char* dest, int width, int height) { +//void cTuxBoxFile::horz2vert(const unsigned char* source, unsigned char* dest, int width, int height) { +void cTuxBoxFile::horz2vert(const uint32_t *source, uint32_t *dest, int width, int height) { int x, y, off; memset(dest,0,width*((height+7)/8)); diff --git a/tools/convpic/tuxbox.h b/tools/convpic/tuxbox.h index 1214fb5..8d19ebd 100644 --- a/tools/convpic/tuxbox.h +++ b/tools/convpic/tuxbox.h @@ -32,8 +32,10 @@ class cTuxBoxFile : public GLCD::cImageFile { private: - void vert2horz(const unsigned char* source, unsigned char* dest, int width, int height); - void horz2vert(const unsigned char* source, unsigned char* dest, int width, int height); +// void vert2horz(const unsigned char* source, unsigned char* dest, int width, int height); +// void horz2vert(const unsigned char* source, unsigned char* dest, int width, int height); + void vert2horz(const uint32_t *source, uint32_t *dest, int width, int height); + void horz2vert(const uint32_t *source, uint32_t *dest, int width, int height); public: cTuxBoxFile(); virtual ~cTuxBoxFile(); |