- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Vertical Blur in Microsoft Word
Vertical Blur Data Matrix Creator In None Using Barcode creator for Microsoft Word Control to generate, create DataMatrix image in Word applications. www.OnBarcode.comCreating USS Code 39 In None Using Barcode encoder for Word Control to generate, create Code-39 image in Microsoft Word applications. www.OnBarcode.comNow that you have the horizontal blur, it s quite easy to create the vertical blur. Instead of adding the value from the positions array to the horizontal texture coordinate, you should add it to the vertical texture coordinate, selecting the pixels on the same column as the pixel of interest: GS1 - 12 Generator In None Using Barcode generation for Office Word Control to generate, create GTIN - 12 image in Office Word applications. www.OnBarcode.comECC200 Creation In None Using Barcode creation for Microsoft Word Control to generate, create DataMatrix image in Word applications. www.OnBarcode.comCHAPTER 2 SE TTIN G UP DIFFER ENT CA MERA MODE S IN YOUR 3 D WORLD
QR Code Printer In None Using Barcode drawer for Word Control to generate, create QR image in Word applications. www.OnBarcode.comEncoding UCC-128 In None Using Barcode drawer for Word Control to generate, create EAN / UCC - 13 image in Office Word applications. www.OnBarcode.com//------- PP Technique: VerBlur -------PPPixelToFrame VerBlurPS(PPVertexToPixel PSIn) : COLOR0 { PPPixelToFrame Output = (PPPixelToFrame)0; for (int i = 0; i < 8; i++) { float4 samplePos = tex2D(textureSampler, PSIn.TexCoord + float2(0, positions[i])*xBlurSize); samplePos *= weights[i]; float4 sampleNeg = tex2D(textureSampler, PSIn.TexCoord - float2(0, positions[i])*xBlurSize); sampleNeg *= weights[i]; Output.Color += samplePos + sampleNeg; } return Output; } technique VerBlur { pass Pass0 { VertexShader = compile vs_1_1 PassThroughVertexShader(); PixelShader = compile ps_2_0 VerBlurPS(); } } You will get a nicely blurred image by combining the horizontal and vertical blurs: List<string> ppEffectsList = new List<string>(); ppEffectsList.Add("HorBlur"); ppEffectsList.Add("VerBlur"); postProcessor.Parameters["xBlurSize"].SetValue(0.5f); postProcessor.PostProcess(ppEffectsList); Making Barcode In None Using Barcode drawer for Microsoft Word Control to generate, create Barcode image in Microsoft Word applications. www.OnBarcode.comEncode USD - 8 In None Using Barcode creator for Word Control to generate, create USD8 image in Microsoft Word applications. www.OnBarcode.comThe Glow Effect
DataMatrix Decoder In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comDataMatrix Encoder In C#.NET Using Barcode encoder for VS .NET Control to generate, create DataMatrix image in Visual Studio .NET applications. www.OnBarcode.comAs explained in the introduction of this recipe, you can obtain a glow effect by starting from the blended image and blending in the original image a bit. This way, the original contours will be sharpened. This requires you to have the blurred image present in the back buffer, so during a second pass, you can blend in the original image. Therefore, you will define a new technique, a glow, that has as a first pass the vertical blur and as a second pass a blend-in pass: DataMatrix Scanner In Visual C# Using Barcode reader for VS .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comBarcode Drawer In .NET Using Barcode creation for ASP.NET Control to generate, create Barcode image in ASP.NET applications. www.OnBarcode.comCHAPTER 2 SE TTIN G UP DIFFE RENT CA MERA MODE S IN YOUR 3 D WORLD
Code 39 Extended Drawer In None Using Barcode generation for Font Control to generate, create Code-39 image in Font applications. www.OnBarcode.comMake European Article Number 13 In .NET Framework Using Barcode generator for Reporting Service Control to generate, create GTIN - 13 image in Reporting Service applications. www.OnBarcode.comtechnique VerBlurAndGlow { pass Pass0 { VertexShader = compile vs_1_1 PassThroughVertexShader(); PixelShader = compile ps_2_0 VerBlurPS(); } pass Pass1 { AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; PixelShader = compile ps_2_0 BlendInPS(); } } The second pass is new. You can see three render states are changed at the beginning of the pass: you enable alpha blending and set the alpha function. You ll learn more about this alpha function in a few minutes. The effect will start with the first pass, so the blurred image will be present in the back buffer. Next, the second pass will be started, allowing you to blend in the original image over the image in the back buffer. This is the pixel shader for the second pass: //------- PP Technique: VerBlurAndGlow -------PPPixelToFrame BlendInPS(PPVertexToPixel PSIn) : COLOR0 { PPPixelToFrame Output = (PPPixelToFrame)0; float4 finalColor = tex2D(originalSampler, PSIn.TexCoord); finalColor.a = 0.3f; Output.Color = finalColor; return Output; } Here, you sample the color of the pixel of the original image and adjust its alpha (transparency) value. When blending in XNA, the final color is found using this rule: finalColor=sourceBlend*sourceColor+destBlend*destColor In the technique definition, you ve set sourceBlend to SourceAlpha. This means sourceBlend equals the alpha value of the color you want to blend in, which is 0.3f, as you ve defined in the previous code. Furthermore, you ve set destBlend to InvSourceAlpha, meaning 1 SourceAlpha. So, destBlend will be 1 0.3f = 0.7f. In summary, 70 percent of the final color will be taken from the color already present in the back buffer (in which the blurred image of the first pass is stored). The remaining 30 percent will be taken from the new color you want to write to the back buffer, which, in this case, is sampled from the original image. You haven t yet defined the originalSampler. Add it to the top of your effect file: PDF 417 Encoder In None Using Barcode creation for Software Control to generate, create PDF417 image in Software applications. www.OnBarcode.comPrint GS1 - 13 In Visual C# Using Barcode encoder for VS .NET Control to generate, create EAN-13 image in .NET applications. www.OnBarcode.comCHAPTER 2 SE TTIN G UP DIFFER ENT CA MERA MODE S IN YOUR 3 D WORLD
EAN 128 Creator In None Using Barcode creator for Font Control to generate, create EAN 128 image in Font applications. www.OnBarcode.comDataMatrix Encoder In VS .NET Using Barcode printer for VS .NET Control to generate, create Data Matrix ECC200 image in VS .NET applications. www.OnBarcode.comtexture originalImage; sampler originalSampler = sampler_state { texture = <originalImage>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; }; In your XNA project, you should store the original image that you hijacked from the back buffer into this originalImage variable. Luckily, using the framework created in the previous chapter, you can do this easily during the first effect: if (currentTechnique == 0) { device.ResolveBackBuffer(resolveTexture, 0); textureRenderedTo = resolveTexture; ppEffect.Parameters["originalImage"].SetValue(textureRenderedTo); } The last line sends the original image to your HLSL effect. Now that all your effects are ready, this code will first blur your image vertically. Afterward, this result will first be horizontally blurred by the first pass of the VerBlurAndGlow effect. After the first pass, the blurred image will remain inside the frame buffer, allowing you to blend in the original image! List<string> ppEffectsList = new List<string>(); ppEffectsList.Add("HorBlur"); ppEffectsList.Add("VerBlurAndGlow"); postProcessor.Parameters["xBlurSize"].SetValue(0.5f); postProcessor.PostProcess(ppEffectsList); Data Matrix ECC200 Maker In Java Using Barcode encoder for Android Control to generate, create DataMatrix image in Android applications. www.OnBarcode.comANSI/AIM Code 39 Generation In Objective-C Using Barcode printer for iPad Control to generate, create USS Code 39 image in iPad applications. www.OnBarcode.com |
|