private void HandleSizePrepared(object obj, SizePreparedArgs args)
        {
            switch (orientation)
            {
            case PixbufOrientation.LeftTop:
            case PixbufOrientation.LeftBottom:
            case PixbufOrientation.RightTop:
            case PixbufOrientation.RightBottom:
                int tmp = max_width;
                max_width  = max_height;
                max_height = tmp;
                break;

            default:
                break;
            }

            double scale = Math.Min(max_width / (double)args.Width,
                                    max_height / (double)args.Height);


            int scale_width  = (int)(scale * args.Width);
            int scale_height = (int)(scale * args.Height);

            if (scale < 1.0)
            {
                loader.SetSize(scale_width, scale_height);
            }
        }
示例#2
0
        private void HandleSizePrepared(object obj, SizePreparedArgs args)
        {
            switch (orientation)
            {
            case ImageOrientation.LeftTop:
            case ImageOrientation.LeftBottom:
            case ImageOrientation.RightTop:
            case ImageOrientation.RightBottom:
                int tmp = max_width;
                max_width  = max_height;
                max_height = tmp;
                break;

            default:
                break;
            }

            int scale_width  = 0;
            int scale_height = 0;

            double scale = Fit(args.Width, args.Height, max_width, max_height, true, out scale_width, out scale_height);

            if (scale < 1.0)
            {
                loader.SetSize(scale_width, scale_height);
            }
        }
示例#3
0
		private void HandleSizePrepared (object obj, SizePreparedArgs args)
		{
			switch (orientation) {
			case PixbufOrientation.LeftTop:
			case PixbufOrientation.LeftBottom:
			case PixbufOrientation.RightTop:
			case PixbufOrientation.RightBottom:	
				int tmp = max_width;
				max_width = max_height;
				max_height = tmp;
				break;
			default:
				break;
			}

			double scale = Math.Min (max_width / (double)args.Width,
						 max_height / (double)args.Height);

			
			int scale_width = (int)(scale * args.Width);
			int scale_height = (int)(scale * args.Height);

			if (scale < 1.0)
				loader.SetSize (scale_width, scale_height);
		}