zoukankan      html  css  js  c++  java
  • 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;

            }
        }

    }

  • 相关阅读:
    [ACM] POJ 3258 River Hopscotch (二分,最大化最小值)
    c语言全局变量和局部变量问题汇总
    surfaceDestroyed什么时候被调用
    JDBC连接MySQL数据库及演示样例
    30天自制操作系统之第11天 制作窗体
    bugFree与zentao
    java实现第七届蓝桥杯生日蜡烛
    java实现第七届蓝桥杯生日蜡烛
    java实现第七届蓝桥杯生日蜡烛
    java实现第七届蓝桥杯生日蜡烛
  • 原文地址:https://www.cnblogs.com/perock/p/2555878.html
Copyright © 2011-2022 走看看