[gdal-dev] how can I configue which lib and .h files in vc2005 smart device application to open img?

liu_daojie liu_daojie at 163.com
Sat Sep 27 23:11:34 EDT 2008


 
 hello:
    
    how can I configue which lib and  .h files in vc2005 smart device application to  open img?
   and 
    
 
   m_pMemoryDC->SelectObject(m_pMemoryBitMap);
  CRect rc(0,0,m_pViewWidth,m_pViewHeight); 
  CBrush brush(RGB(255,255,255));
     m_pMemoryDC->FillRect(rc,&brush); 
  GDALAllRegister(); 
  poDataset = (GDALDataset *) GDALOpen(m_strimagePath, GA_ReadOnly );
  if( poDataset != NULL )
  {
 
   GDALRasterBand *poBand1;   //Ò£¸ÐµÄÒ»¸ö²¨¶Î
   GDALRasterBand *poBand2;
   GDALRasterBand *poBand3;
   int nBandCount,i;
   nBandCount=poDataset->GetRasterCount();
   poBand1=poDataset->GetRasterBand(1);
   poBand2=poDataset->GetRasterBand(2);
   poBand3=poDataset->GetRasterBand(3);
   
   if (poBand1!=NULL && poBand2 != NULL &&poBand3!=NULL)  
   {
   
   //»ñȡͼÏñµÄ³ß´ç
   //»ñȡͼÏñ´°¿Ú³ß´ç
    
   
   int nImgSizeX=poDataset->GetRasterXSize();
   int nImgSizeY=poDataset->GetRasterYSize();
 int nBufferSizeX,nBufferSizeY;
   
   nBufferSizeX = nImgSizeX;
   nBufferSizeY= nImgSizeY;
   
   
   
   byte *pafScanblock1 ;
   byte *pafScanblock2 ;
   byte *pafScanblock3 ;
   
     pafScanblock1 =new byte[(nBufferSizeX)*(nBufferSizeY)];
   pafScanblock2 = new byte[(nBufferSizeX)*(nBufferSizeY)];
   pafScanblock3 =new byte[(nBufferSizeX)*(nBufferSizeY)];
   
   byte *m_ByteBuff = new byte[(nBufferSizeX)*(nBufferSizeY)*3];
     
   
   poBand1->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY, 
    pafScanblock1,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );
 poBand2->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY, 
    pafScanblock2,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );
   
   poBand3->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY, 
    pafScanblock3,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );  
   //ÔÚViewÖðµãÏÔʾͼÏñ
    
   for (int x = 0; x < nBufferSizeX; x ++) 
            { 
              for (int  y = 0; y < nBufferSizeY; y ++) 
                 { 
                  m_pMemoryDC->SetPixel(x,y,RGB(pafScanblock1[y*nBufferSizeX+x],pafScanblock2[y*nBufferSizeX+x],pafScanblock3[y*nBufferSizeX+x])); 
                 } 
            }  
    GDALClose(poDataset);
   }
 can not get r g b ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080928/4ec530e3/attachment.html


More information about the gdal-dev mailing list