<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Brightness and contrast manipulation in WPF 3.5 SP1</title>
	<atom:link href="http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/feed/" rel="self" type="application/rss+xml" />
	<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/</link>
	<description>Take care of the sense, and the sounds will take care of themselves.</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:57:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: abo</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-3631</link>
		<dc:creator>abo</dc:creator>
		<pubDate>Sun, 28 Feb 2010 07:26:04 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-3631</guid>
		<description>The contrast equation in this is actually wrong... that line should be;

result = (result - 0.5) * contrast + 0.5;

Where the contrast value is between 0 to infinity, and 1 means no change.

Also, brightness is normally implemented as;

result = result * brightness

Where brightness is between 0 and infinity, and 1 means no change. This will increase the brightness while keeping blacks black.</description>
		<content:encoded><![CDATA[<p>The contrast equation in this is actually wrong&#8230; that line should be;</p>
<p>result = (result &#8211; 0.5) * contrast + 0.5;</p>
<p>Where the contrast value is between 0 to infinity, and 1 means no change.</p>
<p>Also, brightness is normally implemented as;</p>
<p>result = result * brightness</p>
<p>Where brightness is between 0 and infinity, and 1 means no change. This will increase the brightness while keeping blacks black.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-3492</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 03 Dec 2009 19:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-3492</guid>
		<description>I am trying to use your code in my WPF application and the everything compiles fine, however, when the xaml gets executed. The construction of the ShaderEffects errors.
Here is the error:

Cannot create instance of &#039;BrightContrastEffect&#039; defined in assembly &#039;WPFBrowserApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#039;. Exception has been thrown by the target of an invocation.</description>
		<content:encoded><![CDATA[<p>I am trying to use your code in my WPF application and the everything compiles fine, however, when the xaml gets executed. The construction of the ShaderEffects errors.<br />
Here is the error:</p>
<p>Cannot create instance of &#8216;BrightContrastEffect&#8217; defined in assembly &#8216;WPFBrowserApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#8217;. Exception has been thrown by the target of an invocation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rudy</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-2954</link>
		<dc:creator>Rudy</dc:creator>
		<pubDate>Wed, 22 Apr 2009 14:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-2954</guid>
		<description>I am trying to get this to work in SilverLight 3.0 and it does not want to accept any value for Brightness or Contrast.  I get &quot;0.1 is not a valid value for Brightness&quot; on the SetValue call.  I am using

Effecter.Brightness = 0.1F;

Thoughts?</description>
		<content:encoded><![CDATA[<p>I am trying to get this to work in SilverLight 3.0 and it does not want to accept any value for Brightness or Contrast.  I get &#8220;0.1 is not a valid value for Brightness&#8221; on the SetValue call.  I am using</p>
<p>Effecter.Brightness = 0.1F;</p>
<p>Thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jelpudu</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-2861</link>
		<dc:creator>jelpudu</dc:creator>
		<pubDate>Wed, 25 Mar 2009 14:31:23 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-2861</guid>
		<description>Hi HCN Husni,

Appreciate for the explanation on how to do it.

Futher info required since lost ctc with you since 2004.

jelpudu 
jlpd--&gt;track this id</description>
		<content:encoded><![CDATA[<p>Hi HCN Husni,</p>
<p>Appreciate for the explanation on how to do it.</p>
<p>Futher info required since lost ctc with you since 2004.</p>
<p>jelpudu<br />
jlpd&#8211;&gt;track this id</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dubcio</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-2797</link>
		<dc:creator>Dubcio</dc:creator>
		<pubDate>Tue, 24 Feb 2009 23:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-2797</guid>
		<description>Hi,

I want to use the example to not only change the brightnes on teh screen but also use the same effect by RenderTargetBitmap functionality, and it&#039;s works! (answer for GRiNSER question).

I notice on litle &quot;bug&quot; that on the screeen the image is going to be white when i decreshe the brightnes and when render it to the file it became black as suspected. What is wrong? As Mark wrote the orginal posted effect shader code affect the alpha channel and the window is white... RenderTargetBitmap use as default the black bacground so this is why? I think that solutions provided by Husni Che Ngah and Mark will solve the problem.

Becouse i play with this stuff just 1 hour i dont know where i will found the shader compiler... probably in DirectX SDK ;) I will go deep in it soon...

Best.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I want to use the example to not only change the brightnes on teh screen but also use the same effect by RenderTargetBitmap functionality, and it&#8217;s works! (answer for GRiNSER question).</p>
<p>I notice on litle &#8220;bug&#8221; that on the screeen the image is going to be white when i decreshe the brightnes and when render it to the file it became black as suspected. What is wrong? As Mark wrote the orginal posted effect shader code affect the alpha channel and the window is white&#8230; RenderTargetBitmap use as default the black bacground so this is why? I think that solutions provided by Husni Che Ngah and Mark will solve the problem.</p>
<p>Becouse i play with this stuff just 1 hour i dont know where i will found the shader compiler&#8230; probably in DirectX SDK <img src='http://khason.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I will go deep in it soon&#8230;</p>
<p>Best.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niko Suni</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-1464</link>
		<dc:creator>Niko Suni</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-1464</guid>
		<description>&lt;p&gt;It is worth noting that any optimizations in the pixel shader code are very important since the code runs potentially billions of times per second. For example:&lt;/p&gt;
&lt;p&gt; &#160; &#160;result = result * (1.0+contrast)/1.0; &lt;/p&gt;
&lt;p&gt;You don&#039;t actually need to perform the division with one here; yet, it may get compiled to the shader anyway, and division is one of the most difficult calculations for the GPU to do, no matter whether the divisor is constant one or not.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;-Niko&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It is worth noting that any optimizations in the pixel shader code are very important since the code runs potentially billions of times per second. For example:</p>
<p> &nbsp; &nbsp;result = result * (1.0+contrast)/1.0; </p>
<p>You don&#8217;t actually need to perform the division with one here; yet, it may get compiled to the shader anyway, and division is one of the most difficult calculations for the GPU to do, no matter whether the divisor is constant one or not.</p>
<p>Best regards,</p>
<p>-Niko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tamir Khason</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-1463</link>
		<dc:creator>Tamir Khason</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-1463</guid>
		<description>&lt;p&gt;Niko, you are right. This code used to received values -100 to 100 % this why we have devision here :) &lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Niko, you are right. This code used to received values -100 to 100 % this why we have devision here <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niko Suni</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-1462</link>
		<dc:creator>Niko Suni</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-1462</guid>
		<description>&lt;p&gt;Yea, I thought that was the case :)&lt;/p&gt;
&lt;p&gt;In all fairness, an optimizing compiler should turn a &quot;division by constant&quot; into a &quot;multiply by constant&quot; pattern, but still it is an unnecessary operation if the divisor is exactly 1.0f (which the compiler _could_ iron out too). &lt;/p&gt;
&lt;p&gt;However, if the shader is compiled in debug mode, Direct3D will preserve all operations unoptimized so as to enable breakpoints and source-level variable watching. In &quot;raw&quot; D3D this is very useful for checking that the compiled code actually does what you would expect it to do.&lt;/p&gt;
&lt;p&gt;I haven&#039;t tested yet whether or not the WPF effect framework actually facilitates live debugging of the shaders, though, as we don&#039;t seem to explicitly have neither access to the internal graphics device interface nor control of its creation parameters. &lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Yea, I thought that was the case <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In all fairness, an optimizing compiler should turn a &quot;division by constant&quot; into a &quot;multiply by constant&quot; pattern, but still it is an unnecessary operation if the divisor is exactly 1.0f (which the compiler _could_ iron out too). </p>
<p>However, if the shader is compiled in debug mode, Direct3D will preserve all operations unoptimized so as to enable breakpoints and source-level variable watching. In &quot;raw&quot; D3D this is very useful for checking that the compiled code actually does what you would expect it to do.</p>
<p>I haven&#8217;t tested yet whether or not the WPF effect framework actually facilitates live debugging of the shaders, though, as we don&#8217;t seem to explicitly have neither access to the internal graphics device interface nor control of its creation parameters. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop - May 24, 2008 &#124; Alvin Ashcraft's Morning Dew</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-1461</link>
		<dc:creator>Dew Drop - May 24, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-1461</guid>
		<description>&lt;p&gt;Pingback from &#160;Dew Drop - May 24, 2008 &#124; Alvin Ashcraft&#039;s Morning Dew&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Pingback from &nbsp;Dew Drop &#8211; May 24, 2008 | Alvin Ashcraft&#8217;s Morning Dew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon’s weblog  » Blog Archive   » Hightlights of WPF 3.5 SP1 (beta)</title>
		<link>http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/comment-page-1/#comment-1460</link>
		<dc:creator>Ramon’s weblog  » Blog Archive   » Hightlights of WPF 3.5 SP1 (beta)</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:49:54 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/brightness-and-contrast-manipulation-in-wpf-35-sp1/#comment-1460</guid>
		<description>&lt;p&gt;Pingback from &#160;Ramon&#8217;s weblog &#160;&raquo; Blog Archive &#160; &raquo; Hightlights of WPF 3.5 SP1 (beta)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Pingback from &nbsp;Ramon&amp;#8217;s weblog &nbsp;&amp;raquo; Blog Archive &nbsp; &amp;raquo; Hightlights of WPF 3.5 SP1 (beta)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
