<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: opacity code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 07:08:03 GMT</pubDate>
    <description>DZone Snippets: opacity code</description>
    <item>
      <title>Set image opacity</title>
      <link>http://snippets.dzone.com/posts/show/3895</link>
      <description>&lt;code&gt;&lt;br /&gt;        public static Image SetOpacity(Image original, float opacity)&lt;br /&gt;        {&lt;br /&gt;            Bitmap temp = new Bitmap(original.Width, original.Height);&lt;br /&gt;            Graphics g = Graphics.FromImage(temp);&lt;br /&gt;            ColorMatrix cm = new ColorMatrix();&lt;br /&gt;            cm.Matrix33 = opacity;&lt;br /&gt;&lt;br /&gt;            ImageAttributes ia = new ImageAttributes();&lt;br /&gt;            ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);&lt;br /&gt;            g.DrawImage(original, new Rectangle(0, 0, temp.Width, temp.Height), 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);&lt;br /&gt;            g.Dispose();&lt;br /&gt;&lt;br /&gt;            return temp;&lt;br /&gt;        } &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 24 Apr 2007 22:46:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3895</guid>
      <author>mstampar (Miroslav Stampar)</author>
    </item>
  </channel>
</rss>
