📄 form1.cs
字号:
this.ImageSkewing.Index = 4;
this.ImageSkewing.Text = "绘制映射图片";
this.ImageSkewing.Click += new System.EventHandler(this.ImageSkewing_Click);
//
// Cubeimage
//
this.Cubeimage.Index = 5;
this.Cubeimage.Text = "立方体贴图";
this.Cubeimage.Click += new System.EventHandler(this.Cubeimage_Click);
//
// ThumbnailImage
//
this.ThumbnailImage.Index = 6;
this.ThumbnailImage.Text = "GDI+中处理缩略图";
this.ThumbnailImage.Click += new System.EventHandler(this.ThumbnailImage_Click);
//
// Clone
//
this.Clone.Index = 7;
this.Clone.Text = "分块显示图片";
this.Clone.Click += new System.EventHandler(this.Clone_Click);
//
// Picturescale
//
this.Picturescale.Index = 8;
this.Picturescale.Text = "图片局部放大(缩小)显示";
this.Picturescale.Click += new System.EventHandler(this.Picturescale_Click);
//
// menuItem15
//
this.menuItem15.Index = 7;
this.menuItem15.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.ImageAttributesSetNoOp,
this.SetColorMatrices,
this.SetOutputChannelColorProfile,
this.Gammaadjust,
this.SetOutputChannel,
this.Colorkey,
this.Setthreshold,
this.AdjustedPalette,
this.SetWrapMode});
this.menuItem15.Text = "图像色彩信息的调整";
//
// ImageAttributesSetNoOp
//
this.ImageAttributesSetNoOp.Index = 0;
this.ImageAttributesSetNoOp.Text = "色彩校正的启用与禁用";
this.ImageAttributesSetNoOp.Click += new System.EventHandler(this.ImageAttributesSetNoOp_Click);
//
// SetColorMatrices
//
this.SetColorMatrices.Index = 1;
this.SetColorMatrices.Text = "设置不同的色彩调整对象";
this.SetColorMatrices.Click += new System.EventHandler(this.SetColorMatrices_Click);
//
// SetOutputChannelColorProfile
//
this.SetOutputChannelColorProfile.Index = 2;
this.SetOutputChannelColorProfile.Text = "使用色彩配置文件进行色彩校正";
this.SetOutputChannelColorProfile.Click += new System.EventHandler(this.SetOutputChannelColorProfile_Click);
//
// Gammaadjust
//
this.Gammaadjust.Index = 3;
this.Gammaadjust.Text = "修改Gamma值进行图片输出";
this.Gammaadjust.Click += new System.EventHandler(this.Gammaadjust_Click);
//
// SetOutputChannel
//
this.SetOutputChannel.Index = 4;
this.SetOutputChannel.Text = "设置色彩输出通道";
this.SetOutputChannel.Click += new System.EventHandler(this.SetOutputChannel_Click);
//
// Colorkey
//
this.Colorkey.Index = 5;
this.Colorkey.Text = "使用关键色";
this.Colorkey.Click += new System.EventHandler(this.Colorkey_Click);
//
// Setthreshold
//
this.Setthreshold.Index = 6;
this.Setthreshold.Text = "阈值运用演示程序";
this.Setthreshold.Click += new System.EventHandler(this.Setthreshold_Click);
//
// AdjustedPalette
//
this.AdjustedPalette.Index = 7;
this.AdjustedPalette.Text = "获取色彩校正调色板";
this.AdjustedPalette.Click += new System.EventHandler(this.AdjustedPalette_Click);
//
// SetWrapMode
//
this.SetWrapMode.Index = 8;
this.SetWrapMode.Text = "设置色彩校正的环绕模式和颜色";
this.SetWrapMode.Click += new System.EventHandler(this.SetWrapMode_Click);
//
// menuItem16
//
this.menuItem16.Index = 8;
this.menuItem16.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.ListAllImageEncoders,
this.ListImageEncoder_Detail,
this.ListImageDecoder,
this.GetEncoderParameter,
this.GetAllEncoderParameter,
this.menuItem17,
this.SaveBmp2tif,
this.SaveBMP2JPG,
this.TransformingJPEG,
this.MultipleFrameImage,
this.GetImageFromMultyFrame,
this.QueryImage,
this.SetProp});
this.menuItem16.Text = "图形的编码与解码";
//
// ListAllImageEncoders
//
this.ListAllImageEncoders.Index = 0;
this.ListAllImageEncoders.Text = "输出编码器信息";
this.ListAllImageEncoders.Click += new System.EventHandler(this.ListAllImageEncoders_Click);
//
// ListImageEncoder_Detail
//
this.ListImageEncoder_Detail.Index = 1;
this.ListImageEncoder_Detail.Text = "输出编码器信息";
this.ListImageEncoder_Detail.Click += new System.EventHandler(this.ListImageEncoder_Detail_Click);
//
// ListImageDecoder
//
this.ListImageDecoder.Index = 2;
this.ListImageDecoder.Text = "列出系统可用的解码器信息";
this.ListImageDecoder.Click += new System.EventHandler(this.ListImageDecoder_Click);
//
// GetEncoderParameter
//
this.GetEncoderParameter.Index = 3;
this.GetEncoderParameter.Text = "查看将位图保存为JPEG时需要设置的参数信息";
this.GetEncoderParameter.Click += new System.EventHandler(this.GetEncoderParameter_Click);
//
// GetAllEncoderParameter
//
this.GetAllEncoderParameter.Index = 4;
this.GetAllEncoderParameter.Text = "查看所有的编码信息所需的参数列表";
this.GetAllEncoderParameter.Click += new System.EventHandler(this.GetAllEncoderParameter_Click);
//
// menuItem17
//
this.menuItem17.Index = 5;
this.menuItem17.Text = "将BMP文件另存为PNG格式的文件";
this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
//
// SaveBmp2tif
//
this.SaveBmp2tif.Index = 6;
this.SaveBmp2tif.Text = "将BMP文件保存为TIF文件";
this.SaveBmp2tif.Click += new System.EventHandler(this.SaveBmp2tif_Click);
//
// SaveBMP2JPG
//
this.SaveBMP2JPG.Index = 7;
this.SaveBMP2JPG.Text = "使用不同的压缩质量保存JPEG文件";
this.SaveBMP2JPG.Click += new System.EventHandler(this.SaveBMP2JPG_Click);
//
// TransformingJPEG
//
this.TransformingJPEG.Index = 8;
this.TransformingJPEG.Text = "JPEG文件的保存与变换";
this.TransformingJPEG.Click += new System.EventHandler(this.TransformingJPEG_Click);
//
// MultipleFrameImage
//
this.MultipleFrameImage.Index = 9;
this.MultipleFrameImage.Text = "保存多帧图片";
this.MultipleFrameImage.Click += new System.EventHandler(this.MultipleFrameImage_Click);
//
// GetImageFromMultyFrame
//
this.GetImageFromMultyFrame.Index = 10;
this.GetImageFromMultyFrame.Text = "读取多帧图片的子图片";
this.GetImageFromMultyFrame.Click += new System.EventHandler(this.GetImageFromMultyFrame_Click);
//
// QueryImage
//
this.QueryImage.Index = 11;
this.QueryImage.Text = "获取图像属性列表";
this.QueryImage.Click += new System.EventHandler(this.QueryImage_Click);
//
// SetProp
//
this.SetProp.Index = 12;
this.SetProp.Text = "修改图片属性";
this.SetProp.Click += new System.EventHandler(this.SetProp_Click);
//
// menuItem18
//
this.menuItem18.Index = 9;
this.menuItem18.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.FadeInOut,
this.GrayScale,
this.Inverse,
this.Emboss,
this.OnCanvas,
this.OnWood,
this.Flashligt,
this.BlurAndSharpen});
this.menuItem18.Text = "图形特技处理";
//
// FadeInOut
//
this.FadeInOut.Index = 0;
this.FadeInOut.Text = "淡入浅出";
this.FadeInOut.Click += new System.EventHandler(this.menuItem2_Click);
//
// GrayScale
//
this.GrayScale.Index = 1;
this.GrayScale.Text = "灰度处理与还原";
this.GrayScale.Click += new System.EventHandler(this.GrayScale_Click);
//
// Inverse
//
this.Inverse.Index = 2;
this.Inverse.Text = "底片(负片)滤镜";
this.Inverse.Click += new System.EventHandler(this.Inverse_Click);
//
// Emboss
//
this.Emboss.Index = 3;
this.Emboss.Text = "浮雕及雕刻";
this.Emboss.Click += new System.EventHandler(this.Emboss_Click);
//
// OnCanvas
//
this.OnCanvas.Index = 4;
this.OnCanvas.Text = "油画效果的制作";
this.OnCanvas.Click += new System.EventHandler(this.OnCanvas_Click);
//
// OnWood
//
this.OnWood.Index = 5;
this.OnWood.Text = "木刻滤镜";
this.OnWood.Click += new System.EventHandler(this.OnWood_Click);
//
// Flashligt
//
this.Flashligt.Index = 6;
this.Flashligt.Text = "强光照射滤镜";
this.Flashligt.Click += new System.EventHandler(this.Flashligt_Click);
//
// BlurAndSharpen
//
this.BlurAndSharpen.Index = 7;
this.BlurAndSharpen.Text = "柔化与锐化滤镜";
this.BlurAndSharpen.Click += new System.EventHandler(this.BlurAndSharpen_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.HighlightText;
this.ClientSize = new System.Drawing.Size(560, 313);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "GDIPlusDemo";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Resize += new System.EventHandler(this.Form1_Resize);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
Graphics g=this.CreateGraphics();
g.Clear(Color.Black);
Bitmap bitmap=new Bitmap("demo.bmp");
int iWidth = bitmap.Width;
int iHeight = bitmap.Height;
//初始化色彩变换矩阵
float[][] tem=
{
new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[]{0.0f, 0.0f, 0.0f, 1.0f, 0.0f},
new float[]{0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
};
ColorMatrix colorMatrix=new ColorMatrix(tem);
ImageAttributes imageAtt=new Imag
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -