I am trying to rotate Device 90 Degrees from landscape to portrait with live preview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tvnaidu
    Contributor
    • Oct 2009
    • 365

    I am trying to rotate Device 90 Degrees from landscape to portrait with live preview

    I am trying to rotate Device 90 Degrees from landscape to portrait with live preview image, Image rotation not taking place, rotation method not working with Live preview Images of Landscape size 640x480 and portrait is 480x640, any idea?
    Code:
    void OrientationTransform::RotateImage90(BYTE* data, int dataLength)
    {
    
    	BYTE *dataTemp;
    
    	dataTemp = new BYTE[dataLength];
    	memcpy(dataTemp, data, dataLength);
    
    	BITMAPINFOHEADER bih = m_videoInfo.bmiHeader;
    	Bitmap bmp2(bih.biWidth, bih.biHeight, m_stride, m_pixFmt, dataTemp);
    	Bitmap bmp(bih.biWidth, bih.biHeight, m_stride, m_pixFmt, data);
    
    	bmp2.RotateFlip(Rotate90FlipXY);
    
    	Graphics g(&bmp);
    	g.Clear(Color::Black);
    	
    	g.ScaleTransform(bmp2.GetWidth(), bmp2.GetHeight() );  
    	g.DrawImage(&bmp2, 0, 0);
    	delete dataTemp;
    }
Working...