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;

            }
        }

    }

  • 相关阅读:
    各种协议与HTTP协议之间的关系
    在浏览器中输入url地址到显示主页的过程
    TCP 协议如何保证可靠传输
    TCP,UDP 协议的区别
    TCP 三次握手和四次挥手
    OSI与TCP/IP各层的结构与功能,用到的协议
    424. 替换后的最长重复字符
    webstorm快捷键
    S1:动态方法调用:call & apply
    S1:原型继承
  • 原文地址:https://www.cnblogs.com/perock/p/2555878.html
Copyright © 2011-2022 走看看