亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? resizer.cs

?? 這是一個(gè)小型的相片管理器
?? CS
字號(hào):


using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;

namespace VirtualPhotoOrganizer.Photo
{
	/// <summary>
	/// Handles resizing, cropping, rotating, and the creation of thumbnails
	/// </summary>
	internal class Resizer
	{
		public Resizer() { }

		/// <summary>
		/// Resizes the specified image to the specified size with the specified InterpolationMode
		/// </summary>
		public Bitmap Resize(Bitmap image, int width, int height, InterpolationMode interpolationMode) {
			// create the resized Bitmap and its Graphics object
			Bitmap resizedImage = new Bitmap(width, height);
			Graphics g = Graphics.FromImage(resizedImage);
			g.InterpolationMode = interpolationMode;

			// fill the resized Bitmap with the resized image
			Rectangle destRect = new Rectangle(0, 0, width, height);
			g.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);

			// dispose the unneeded objects and return the resized Bitmap
			g.Dispose();
			return resizedImage;
		}

		/// <summary>
		/// Returns a Bitmap containing the specified cropArea
		/// </summary>
		public Bitmap Crop(Bitmap image, Rectangle cropArea) {
			// create the resized Bitmap and its Graphics object
			Bitmap croppedImage = new Bitmap(cropArea.Width, cropArea.Height);
			Graphics g = Graphics.FromImage(croppedImage);

			// fill the resized Bitmap with the cropArea
			Rectangle destRect = new Rectangle(0, 0, cropArea.Width, cropArea.Height);
			g.DrawImage(image, destRect, cropArea, GraphicsUnit.Pixel);

			// dispose the unneeded objects and return the cropped Bitmap
			g.Dispose();
			return croppedImage;
		}

		/// <summary>
		/// Rotates the given image according to the specified RotateFlipType
		/// </summary>
		public Bitmap Rotate(Bitmap image, RotateFlipType flipType) {
			image.RotateFlip(flipType);
			return image;
		}

		public void Rotate(string path, RotateFlipType flipType, int quality) {
			Image image = Bitmap.FromFile(path);
			Bitmap b = new Bitmap(image);	// create the bitmap
			image.Dispose();

			// rotate and save the bitmap
			b.RotateFlip(flipType);
			JpegSaver js = new JpegSaver();
			js.SaveJpeg(path, b, quality);

			// dispose the bitmap
			b.Dispose();
		}

		/// <summary>
		/// Saves a thumbnail of the specified image in the specified path
		/// </summary>
		public void CreateThumbnail(string srcPath, string destPath) {
			// the defined constants for the max thumbnail dimensions
			const int cthWidth = 150;
			const int cthHeight = 113;

			// the aspect ratio and the newly calculated thumbnail dimensions
			int thWidth = 0;
			int thHeight = 0;

			// load the source image
			Image img = Bitmap.FromFile(srcPath);
			Bitmap srcImage = new Bitmap(img);

			// calculate the new tumbnail dimensions, based on the longer side of the image
			double ratio = srcImage.Height / srcImage.Width;
			if (ratio < cthHeight / cthWidth) {
				// Width is constant
				thWidth = cthWidth;
				thHeight = (srcImage.Height * cthWidth) / srcImage.Width;
			} else {
				// Height is constant
				thHeight = cthHeight;
				thWidth = (srcImage.Width * cthHeight) / srcImage.Height;
			}


			// create the thumbnail
			Image thumb = srcImage.GetThumbnailImage(thWidth, thHeight, null, IntPtr.Zero);

			// create a new bitmap for the border creation
			Bitmap finthumb = new Bitmap(cthWidth, cthHeight);
			Graphics g = Graphics.FromImage(finthumb);

			// draw thumb into finthumb
			Rectangle dest;
			double size;
			if (thumb.Width > thumb.Height) {
				size = (cthHeight - thumb.Height) / 2;
				if (size != cthHeight / 2)	// check if image does not have cthWidth
					dest = new Rectangle(0, (int) Math.Round(size, 0), thumb.Width, thumb.Height);
				else
					dest = new Rectangle(0, 0, thumb.Width, thumb.Height);
			} else {
				size = (cthWidth - thumb.Width) / 2;
				if (size != cthWidth / 2)	// check if image does not have cthWidth
					dest = new Rectangle((int) Math.Round(size, 0), 0, thumb.Width, thumb.Height);
				else
					dest = new Rectangle(0, 0, thumb.Width, thumb.Height);
			}

			g.DrawImage(thumb, dest);

			// save finthumb
			finthumb.Save(destPath);

			// dispose the gdi+ objects
			g.Dispose();
			img.Dispose();
			srcImage.Dispose();
			thumb.Dispose();
			finthumb.Dispose();
		}

		#region HTMLExport

		/// <summary>
		/// Saves a thumbnail (without borders) of the specified image in the specified path
		/// </summary>
		public void CreateThumbnailWoBorders(string srcPath, string destPath) {
			// the defined constants for the max thumbnail dimensions
			const int cthWidth = 150;
			const int cthHeight = 113;

			// the aspect ratio and the newly calculated thumbnail dimensions
			int thWidth = 0;
			int thHeight = 0;

			// load the source image
			Image img = Bitmap.FromFile(srcPath);
			Bitmap srcImage = new Bitmap(img);

			// calculate the new tumbnail dimensions, based on the longer side of the image
			double ratio = srcImage.Height / srcImage.Width;
			if (ratio < cthHeight / cthWidth) {
				// Width is constant
				thWidth = cthWidth;
				thHeight = (srcImage.Height * cthWidth) / srcImage.Width;
			} else {
				// Height is constant
				thHeight = cthHeight;
				thWidth = (srcImage.Width * cthHeight) / srcImage.Height;
			}


			// create the thumbnail
			Image thumb = srcImage.GetThumbnailImage(thWidth, thHeight, null, IntPtr.Zero);

			// save the thumbnail
			thumb.Save(destPath);

			// dispose the gdi+ objects
			thumb.Dispose();
			srcImage.Dispose();
			img.Dispose();
		}

		/// <summary>
		/// Resizes the specified image to the specified size with the specified InterpolationMode and then saves it with the specified quality
		/// </summary>
		public void Resize(string srcPath, string destPath, int width, int height, int quality, InterpolationMode interpolationMode) {
			// open the original image
			Image img = Bitmap.FromFile(srcPath);
			Bitmap image = new Bitmap(img);

			// calculate the right size for the destRect
			Rectangle destRect = new Rectangle(0, 0, width, height);
			// calculate the new tumbnail dimensions, based on the longer side of the image
			double ratio = image.Height / image.Width;
			if (ratio < height / width) {
				// Width is constant
				destRect.Width = width;
				destRect.Height = (image.Height * width) / image.Width;
			} else {
				// Height is constant
				destRect.Height = height;
				destRect.Width = (image.Width * height) / image.Height;
			}

			// create the resized Bitmap and its Graphics object
			Bitmap resizedImage = new Bitmap(destRect.Width, destRect.Height);
			Graphics g = Graphics.FromImage(resizedImage);
			g.InterpolationMode = interpolationMode;

			// fill the resized Bitmap with the resized image
			g.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);

			// save the resized image
			JpegSaver js = new JpegSaver();
			js.SaveJpeg(destPath, resizedImage, quality);

			// dispose the unneeded objects
			g.Dispose();
			resizedImage.Dispose();
			img.Dispose();
			image.Dispose();
		}

		#endregion
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲大型综合色站| 麻豆成人久久精品二区三区小说| 欧美日韩国产精品成人| 国产一区二区三区视频在线播放| 亚洲欧洲中文日韩久久av乱码| 欧美一区二区三区视频免费播放| 成人国产视频在线观看| 久久91精品国产91久久小草| 亚洲一区精品在线| 国产精品情趣视频| 日韩女优av电影在线观看| 色狠狠av一区二区三区| 粉嫩aⅴ一区二区三区四区 | 337p粉嫩大胆色噜噜噜噜亚洲| 94色蜜桃网一区二区三区| 国产传媒日韩欧美成人| 日韩av一区二区在线影视| 一区二区三区四区在线播放| 国产精品美日韩| 久久久久国产精品人| 精品国产乱码久久久久久闺蜜| 欧美视频一区二区三区在线观看| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品一区二区视频| 激情五月激情综合网| 日本aⅴ免费视频一区二区三区| 亚洲一区二区五区| 一区二区三区国产豹纹内裤在线| 亚洲人成7777| 亚洲美女视频在线观看| 国产精品白丝在线| 最近中文字幕一区二区三区| 国产精品欧美一级免费| 久久综合国产精品| 久久久三级国产网站| 精品1区2区在线观看| 精品国产免费久久| 亚洲精品一区二区三区99| 精品久久国产老人久久综合| 欧美电影免费提供在线观看| 日韩女优电影在线观看| ww久久中文字幕| 久久久综合激的五月天| 亚洲国产精华液网站w| 国产清纯在线一区二区www| 国产精品污网站| 自拍偷拍国产精品| 亚洲图片自拍偷拍| 爽好久久久欧美精品| 日韩成人午夜精品| 久久 天天综合| 国产成人在线视频免费播放| 成人免费看黄yyy456| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 久久久99精品免费观看不卡| 久久精品在线观看| 欧美高清视频不卡网| 日韩精品最新网址| 中文字幕的久久| 亚洲乱码国产乱码精品精的特点| 亚洲高清久久久| 蜜臀久久99精品久久久画质超高清| 久久成人免费日本黄色| 欧美性大战久久| 欧美日韩电影在线播放| 精品久久人人做人人爰| 日本一区二区三区国色天香 | 久久久久免费观看| 国产精品久久久久久久久搜平片 | 成av人片一区二区| 欧美在线观看禁18| 精品免费日韩av| 国产精品久久久久久久久动漫 | 看电视剧不卡顿的网站| 国产成人aaa| 在线观看亚洲精品视频| 日韩免费一区二区三区在线播放| 国产精品素人视频| 日本成人中文字幕| eeuss鲁片一区二区三区在线观看| 69精品人人人人| 欧美激情一区不卡| 婷婷中文字幕综合| 成人一区二区视频| 欧美一区二区三区在线视频| 国产日韩欧美精品电影三级在线| 亚洲国产成人tv| 成人永久免费视频| 欧美日韩不卡一区| 国产精品欧美久久久久无广告 | 亚洲婷婷国产精品电影人久久| 亚洲动漫第一页| 国产盗摄精品一区二区三区在线| 欧美午夜免费电影| 国产精品狼人久久影院观看方式| 日韩中文字幕不卡| 91麻豆精品一区二区三区| 精品国偷自产国产一区| 亚洲小说欧美激情另类| av在线播放不卡| 亚洲精品在线免费观看视频| 亚洲制服丝袜在线| 99精品欧美一区| 久久久亚洲午夜电影| 亚洲图片欧美视频| 99国产精品久久久久久久久久 | 白白色亚洲国产精品| 日韩欧美综合一区| 婷婷综合另类小说色区| 色婷婷狠狠综合| 中文字幕一区二区三区蜜月| 国产精品一区二区三区四区| 欧美成人伊人久久综合网| 五月激情丁香一区二区三区| 91免费视频大全| 国产精品久久久久久久久久免费看 | 狠狠色丁香九九婷婷综合五月| 欧美在线视频不卡| 亚洲一区二区视频| 色婷婷国产精品| 玉足女爽爽91| 色94色欧美sute亚洲线路二| 中文字幕亚洲一区二区av在线 | 亚洲一区自拍偷拍| 91在线免费播放| 中文字幕在线不卡视频| 不卡av在线网| 最新高清无码专区| 色综合久久中文字幕| 亚洲女人的天堂| 99久久99久久久精品齐齐| 成人免费小视频| 99久久99久久精品免费观看| 亚洲四区在线观看| 一本到不卡免费一区二区| 亚洲男女一区二区三区| 91丨porny丨国产入口| 亚洲人妖av一区二区| 91浏览器打开| 亚洲超碰精品一区二区| 欧美日韩午夜在线视频| 日韩专区一卡二卡| 欧美成人aa大片| 国模套图日韩精品一区二区| 国产亚洲综合在线| 成人av资源下载| 亚洲一二三四久久| 3d动漫精品啪啪| 免费人成精品欧美精品| 亚洲精品一区二区三区在线观看 | 99久久精品国产麻豆演员表| 综合av第一页| 在线免费观看不卡av| 免费看欧美女人艹b| 精品久久久久99| 99精品欧美一区二区三区综合在线| 亚洲免费观看在线观看| 67194成人在线观看| 国产精品影视网| 亚洲素人一区二区| 91精品国产乱码久久蜜臀| 韩国成人福利片在线播放| 国产精品理论在线观看| 欧美日韩不卡视频| 国产精品一区二区久久精品爱涩| 国产精品不卡在线| 欧美日韩一二三| 国产精品自产自拍| 亚洲综合成人在线| 精品国产亚洲在线| 91女厕偷拍女厕偷拍高清| 免费观看在线综合| 国产精品色哟哟| 欧美久久一区二区| 成人污视频在线观看| 调教+趴+乳夹+国产+精品| 中文字幕精品在线不卡| 欧美日韩精品一区二区在线播放 | 成人v精品蜜桃久久一区| 亚洲一二三四区不卡| 久久久久国产一区二区三区四区 | 99精品久久只有精品| 美女视频黄a大片欧美| 亚洲欧洲成人自拍| 欧美成人乱码一区二区三区| 91小视频免费看| 精品无码三级在线观看视频| 欧美亚州韩日在线看免费版国语版| 日韩欧美在线123| 蜜臀久久99精品久久久久久9| 国产精品久久久久9999吃药| 欧美精品v国产精品v日韩精品| 国产一区二区三区香蕉| 午夜伦欧美伦电影理论片| 国产欧美一区二区精品仙草咪| 欧美日韩色一区| caoporn国产精品| 精品亚洲欧美一区| 亚洲国产aⅴ成人精品无吗| 精品日本一线二线三线不卡|