0 Replies Latest reply on Jan 25, 2011 12:02 PM by chandu3107

    How to fit Image inside canvas after rotation?

    chandu3107 Level 2

      Hi All,

       

      I am fitting an image inside a canvas after rotation. I am using following code based on rotation.

      Image is not fitting perfect inside a canvas. Please provide the soultion.

       

      switch(thumbImage.rotation)

      {

      case 0:

      thumbImage.x=0;

      thumbImage.y=0;

      baseCanvas.width= thumbImage.width;

      baseCanvas.height = thumbImage.height;

      break;

      case 180:

      thumbImage.x = baseCanvas.width;

      thumbImage.y= baseCanvas.height;

       

      baseCanvas.width= thumbImage.width;

      baseCanvas.height = thumbImage.height;

       

       

      break;

      case -90:

      baseCanvas.width= thumbImage.height;

      baseCanvas.height = thumbImage.width;

      thumbImage.y=thumbImage.height;

      thumbImage.x=0; 

       

      break;

      case -180:

      thumbImage.x = baseCanvas.width;

      thumbImage.y= baseCanvas.height;

      baseCanvas.width= thumbImage.width;

      baseCanvas.height = thumbImage.height;

      break;

      case -270:

      thumbImage.x= baseCanvas.width;

      thumbImage.y=0;

       

      baseCanvas.width= thumbImage.height;

      baseCanvas.height = thumbImage.width;

       

      break;

      case 90:

      thumbImage.x= baseCanvas.width;

      thumbImage.y=0;

      baseCanvas.width= thumbImage.height;

      baseCanvas.height = thumbImage.width;

       

      break;

      case 270:

      thumbImage.x=0

      thumbImage.y=baseCanvas.height;

      baseCanvas.width= thumbImage.height;

      baseCanvas.height = thumbImage.width;

      break;

      }