系统架构设计师辅导:处理图像

时间:2022-06-03 03:55:37 系统架构师 我要投稿
  • 相关推荐

系统架构设计师辅导:处理图像

  如果您的应用程序显示大量图像文件(例如,.jpg 和 .gif 文件),则您可以通过以位图格式预先呈现图像来显著改善显示性能。要使用该技术,请首先从文件中加载图像,然后使用 PARGB 格式将其呈现为位图。下面的代码示例从磁盘中加载文件,然后使用该类将图像呈现为预乘的、Alpha 混合 RGB 格式。例如:

系统架构设计师辅导:处理图像

  [C#]

  if ( image != null && image is Bitmap )

  {

  Bitmap bm = (Bitmap)image;

  Bitmap newImage = new Bitmap( bm.Width, bm.Height,

  System.Drawing.Imaging.PixelFormat.Format32bppPArgb );

  using ( Graphics g = Graphics.FromImage( newImage ) )

  {

  g.DrawImage( bm, new Rectangle( 0,0, bm.Width, bm.Height ) );

  }

  image = newImage;

  }

  [Visual Basic .NET]

  If Not(image Is Nothing) AndAlso (TypeOf image Is Bitmap) Then

  Dim bm As Bitmap = CType(image, Bitmap)

  Dim newImage As New Bitmap(bm.Width, bm.Height, _

  System.Drawing.Imaging.PixelFormat.Format32bppPArgb)

  Using g As Graphics = Graphics.FromImage(newImage)

  g.DrawImage(bm, New Rectangle(0, 0, bm.Width, bm.Height))

  End Using

  image = newImage

  End If

【系统架构设计师辅导:处理图像】相关文章:

PS图像处理的技巧10-21

图像处理就业前景04-02

PS图像处理中选区的选取12-21

图书检索系统体系架构研究12-05

如何成为优秀的系统架构师08-30

PS图像处理的规范流程和技巧12-22

微处理器与嵌入式系统的区别08-29

插花的艺术处理12-15

反比例函数的图像和性质教案(精选8篇)05-15

成本核算帐务处理程序及成本项目设置的处理08-29