zoukankan      html  css  js  c++  java
  • ShowBitMap

    static FormWindowControl showBitmap(FormWindowControl _control, Bitmap _bitmap,
                                       int _width=0, int _height=0)
    {
        real    ratio;
        Image   _image;
        ;
        if (_bitmap != connull())
            {
            _image = new Image();
            _image.setData(_bitmap);

            if (_width == 0 && _height == 0) // use default image hxw if no width or height pass in
                {
                _width = _image.width();
                _height = _image.height();
                }
            else // max width or height in not 0 is passed in
                {
                ratio = _image.width() > _image.height() ? _image.width() / _width : _image.height() / _height;

                _width = real2int(_image.width()/ratio);
                _height = real2int(_image.height()/ratio);

                _image.resize(_width, _height, InterpolationMode::InterpolationModeHighQuality);
                }

            _control.width(_width);
            _control.height(_height);
            _control.imagemode(0);
            _control.image(_image);
            }
        else
            {
            _control.imageResource(0);
            }

        return _control;
    }

  • 相关阅读:
    HDU 1058
    Codeforces 349C
    HDU 2602
    HDU 2571
    HDU 2955
    HDU 2084
    HDU 1003
    HDU 1506 & 1505
    POJ 1854
    HDU 2095
  • 原文地址:https://www.cnblogs.com/perock/p/2375293.html
Copyright © 2011-2022 走看看