Has anyone worked on TIFF images !! please reply ..
Thank you ..
regards,
micromysore
code:-----------------------------------------------------------------------
-------
In onFileopen function
m_dib->Create(w,h,32);
uint32 dibwidth = m_dib->GetTotalWidth();
unsigned long * dest = (unsigned long *)m_dib->GetBits();
unsigned long * src = (unsigned long*)malloc(w*sizeof(unsigned long));
void * ptr_src = src;
for (int row = 0; row < h; row++){
int readlen=TIFFReadScanline(tiff,src,h-row,0);
for(int i=0;i<w;i++) src[i]=(src[i]/255)<<16 | (src[i]/255)<<8 |
(src[i]/255);
void * ptr_dest = dest + row * w;
for (int col = 0; col < w; col++)
{
void *ptr_src=src;
void *ptr_dest=dest+row*w;
memcpy(ptr_dest,ptr_src,w*sizeof(int));
}
----------------------------------------------------------------------------
--
DibSection part of code
code:-----------------------------------------------------------------------
-------
class DIBSection
{
void InitObject(void);
protected:
HBITMAP m_hbmp;
HBITMAP m_hbmOld;
void* m_pBits;
CSize m_size;
CDC* m_pdc;
int m_total_width;
BITMAPINFOHEADER m_bih;
public:
DIBSection() ;
virtual ~DIBSection() ;
void Close(void);
// Create a DIBSection
void Create(int cx, int cy, int nbits ) ;
// Draw method
void Draw(CDC* pdcDest, int x, int y) ;
// Set the palette
void SetPalette(CPalette* pPal) ;
CDC* GetDC() {return m_pdc;}
HBITMAP GetHandle() {return m_hbmp;}
unsigned long Width(void)const{ return m_size.cx;}
unsigned long Height(void)const{ return m_size.cy;}
unsigned long GetTotalWidth(void)const{ return m_total_width;}
void * GetBits(void){ return m_pBits;}
BITMAPINFOHEADER& GetBIH(void){ return m_bih;}
};
Regards,
Madan S Ankapura
Nothing in GDI or GDI+ is prepared to deal with more than 8 bits per band. Your
best bet with a 16 bit image is to read it with the www.libtiff.org library and munch
it down to 8 bits yourself.
//memcpy(ptr_dest,ptr_src,w*sizeof(int));
for (int col = 0; col < w; col++)
{
void *ptr_src=src1;
void *ptr_dest=dest+row*w;
memcpy(ptr_dest,ptr_src,w*sizeof(BYTE));
}
But it wont work .. it is displaying the image is in very small are .. and i
see 3 images :-( ..
Lucas/
"Madan S Ankapura" <madana...@spendloveresearch.org> wrote in message
news:%23xqoGbC...@tk2msftngp13.phx.gbl...