resize
void resize()
{
;
if (toWidth > toHeight)
{
if(orgHeight > orgWidth)
{
retHeight = toHeight;
retWidth = orgWidth / orgHeight * toHeight;
}
if (orgHeight < orgWidth)
{
if (orgHeight / orgWidth * toWidth > toHeight)
{
retHeight = toHeight;
retWidth = orgWidth / orgHeight * toHeight;
}
else
{
retWidth = toWidth;
retHeight = orgHeight /orgWidth * toWidth;
}
}
if (orgHeight == orgWidth)
{
retHeight = toHeight;
retWidth = orgWidth / orgHeight * toHeight;
}
}
if (toWidth < toHeight)
{
if(orgHeight > orgWidth)
{
if (orgWidth / orgHeight * toHeight > toWidth)
{
retWidth = toWidth;
retHeight = orgHeight / orgWidth * toWidth;
}
else
{
retHeight = toHeight;
retWidth = orgWidth / orgHeight * toHeight;
}
}
if (orgHeight < orgWidth)
{
retWidth = toWidth;
retHeight = orgHeight / orgWidth * toWidth;
}
if (orgHeight == orgWidth)
{
retWidth = toWidth;
retHeight = orgHeight / orgWidth * toWidth;
}
}
if (toWidth == toHeight)
{
if(orgHeight > orgWidth)
{
retHeight = toHeight;
retWidth = orgWidth / orgHeight * toHeight;
}
if (orgHeight < orgWidth)
{
retWidth = toWidth;
retHeight = orgHeight / orgWidth * toWidth;
}
if (orgHeight == orgWidth)
{
retHeight = toHeight;
retWidth = toWidth;
}
}
}