Mr GRiM
August 24th, 2016, 06:36 PM
When your doing recolors you have to be very careful with some images, if you are extracting the images with a resource hacker like Restorator then a lot of the recolors will come out wrong.
With some images it is important that you edit them in WSB and then export the image checking the box "don't undo alpha premultiplication"
If you notice any colored image with transparency when exported and not checking that box will be brighter and more vibrant, this is because it represents the image as it was before it was added to WSB or as it looks when you use Edit Image in WSB, if you check that box though it will export the image as it saved in the msstyles.
This means if you are recoloring the images extracted using Restorator the images will end up dull when imported back in again, this can also lead to other sorts of problems if you have to edit one of the images again in WSB as when you save it back to WSB again it can become a different shade to the rest of your images in a start menu for instance.
Here is one such example:
Edited using Edit image in WSB
75086
Edited using images extracted from the msstyles
75087
As you can see the glow on the text has almost been removed in the one extracted from the msstyles, now this is not something you will have to do for all images, batch recolors are a great idea but even then those images have to be imported again within WSB or the alpha premultiplication will not take place and this can cause problems with the images and sometimes it will display a white square instead.
I hope these tips were helpful for you all and that you can continue to do great recolors in all of their glory.
Some info on Premultiplied alpha
Premultiplied alpha In computer graphics there are two different ways to represent the opacity of a color value. Win2D uses both methods. This article explains the difference, and which is used where.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngStraight alpha
When using straight, also known as linear, alpha:
RGB values specify the color of the thing being drawn
The alpha value specifies how solid it is
In this world, RGB and alpha are independent. You can change one without affecting the other. To make an object fade out, you would gradually reduce its alpha value while leaving RGB unchanged.
To perform a source-over blend between two colors that use straight alpha format:
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
result = (source.RGB * source.A) + (dest.RGB * (1 - source.A))
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngPremultiplied alpha
When using premultiplied alpha:
RGB specifies how much color the thing being drawn contributes to the output
The alpha value specifies how much it obscures whatever is behind it
In this world, RGB and alpha are linked. To make an object transparent you must reduce both its RGB (to contribute less color) and also its alpha (to obscure less of whatever is behind it). Fully transparent objects no longer have any color at all, so there is only one value that represents 100% transparency: RGB and alpha all zero.
To perform a source-over blend between two colors that use premultiplied alpha format:
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
result = source.RGB + (dest.RGB * (1 - source.A))
Premultiplied alpha is used in graphics rendering because it gives better results than straight alpha when filtering images or composing different layers. For more information see the articles:
http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx
http://blogs.msdn.com/b/shawnhar/archive/2009/11/07/premultiplied-alpha-and-image-composition.aspx
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngAlpha in Win2D
Win2D uses straight alpha in its API surface, but premultiplied alpha for internal rendering operations.
Windows.UI.Color values use straight alpha. Whenever you pass a color to a Draw* or Fill* method, set the color of a brush, or clear to a color value, this color is specified using straight alpha.
The pixel values stored in a bitmap or rendertarget, and the drawing or blending operations that operate on these surfaces, use premultiplied alpha. When bitmaps are loaded from a file their contents are automatically converted into premultiplied format. When you call a Win2D drawing method, its color parameter is converted from straight to premultiplied before the actual drawing takes place.
Win2D image effects use a mixture of straight and premultiplied alpha. Some effects operate on one format, some on the other, and some provide a property to choose. The documentation for each effect type describes which alpha mode it uses. Effect input data is always assumed to be premultiplied, so when an effect needs to work with straight alpha it will first apply an unpremultiply transform, compute the effect, and then re-premultiply the output.
The bitmap APIs GetPixelBytes, SetPixelBytes, GetPixelColors, and SetPixelColors, do NOT perform any alpha format conversions. They just directly transfer bit values to or from the underlying GPU texture. This allows you to observe what alpha format Win2D is using internally:
Create a drawing session on a rendertarget
Call drawingSession.Clear(Colors.Tranparent)
Colors.Tranparent is defined as R=255, G=255, B=255, A=0
Win2D will convert this value to premultiplied format, yielding R=0, G=0, B=0, A=0
Use GetPixelColors to read back the contents of the rendertarget
Observe that it contains premultiplied format RGB=0, not RGB=255 like the original straight alpha Colors.Tranparent value
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngConverting between alpha formats
To convert a straight alpha color value to premultiplied format, multiply its R, G, and B values by A. To convert premultiplied to straight, divide R, G, and B by A.
Note that color information is often represented as byte values ranging from 0 to 255 (for example the Windows.UI.Color structure consists of 4 bytes). This representation is scaled up by a factor of 255, so a byte value of 255 actually means 1, while 128 is half intensity. That scaling factor must be taken into account during format conversions, so to convert a Windows.UI.Color from straight to premultiplied:
C#
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
premultiplied.R = (byte)(straight.R * straight.A / 255);
premultiplied.G = (byte)(straight.G * straight.A / 255);
premultiplied.B = (byte)(straight.B * straight.A / 255);
premultiplied.A = straight.A;
If you have image data that is using the wrong alpha format, PremultiplyEffect (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm) or UnPremultiplyEffect (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm) can be used to convert it.
PremultiplyEffect Class[NoComposition] Converts an image from unpremultiplied to premultiplied alpha format.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngInheritance Hierarchy
System.Object (http://msdn2.microsoft.com/en-us/library/e5kfa45b)
Microsoft.Graphics.Canvas.Effects.PremultiplyEffect
Namespace: Microsoft.Graphics.Canvas.Effects (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
Assembly: Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSyntax
C#
Copy (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#)
public sealed class PremultiplyEffect : ICanvasEffect,
IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable
The PremultiplyEffect type exposes the following members.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngConstructors
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
PremultiplyEffect (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect__ctor.htm)
Initializes a new instance of the PremultiplyEffect class.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngProperties
Name
Description
http://microsoft.github.io/Win2D/icons/pubproperty.gif
BufferPrecision (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_BufferPrecision.htm)
Specifies what precision to use for intermediate buffers when drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
CacheOutput (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_CacheOutput.htm)
Enables caching the output from drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Name (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Name.htm)
Attaches a user-defined name string to the effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Source (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Source.htm)
Gets or sets the input source for Premultiply effect.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngMethods
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
Dispose (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Dispose.htm)
Releases all resources used by the effect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetBounds.htm)
Retrieves the bounds of this PremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator, Matrix3x2) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetBounds_1.htm)
Retrieves the bounds of this PremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetInvalidRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetInvalidRectangles.htm)
Queries what regions of the effect output have changed since it was last drawn.
http://microsoft.github.io/Win2D/icons/pubmethod.gifhttp://microsoft.github.io/Win2D/icons/CodeExample.png
GetRequiredSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetRequiredSourceRectangle.htm)
Queries what part of an effect source image is needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetRequiredSourceRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetRequiredSourceRectangles.htm)
Queries what parts of the effect source images are needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
InvalidateSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_InvalidateSourceRectangle.htm)
Notifies the effect that one of its source images has changed.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngRemarks
Supported by Win2D but not Windows.UI.Composition.
This Windows Runtime type corresponds to the D2D Premultiply effect (http://msdn.microsoft.com/en-us/library/windows/desktop/hh780395.aspx).
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSee Also
Reference
Microsoft.Graphics.Canvas.Effects Namespace (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
UnPremultiplyEffect Class[NoComposition] Converts an image from premultiplied to unpremultiplied alpha format.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngInheritance Hierarchy
System.Object (http://msdn2.microsoft.com/en-us/library/e5kfa45b)
Microsoft.Graphics.Canvas.Effects.UnPremultiplyEffect
Namespace: Microsoft.Graphics.Canvas.Effects (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
Assembly: Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSyntax
C#
Copy (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#)
public sealed class UnPremultiplyEffect : ICanvasEffect,
IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable
The UnPremultiplyEffect type exposes the following members.
Constructors
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
UnPremultiplyEffect (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect__ctor.htm)
Initializes a new instance of the UnPremultiplyEffect class.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
Properties
Name
Description
http://microsoft.github.io/Win2D/icons/pubproperty.gif
BufferPrecision (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_BufferPrecision.htm)
Specifies what precision to use for intermediate buffers when drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
CacheOutput (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_CacheOutput.htm)
Enables caching the output from drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Name (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Name.htm)
Attaches a user-defined name string to the effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Source (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Source.htm)
Gets or sets the input source for UnPremultiply effect.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngMethods
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
Dispose (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Dispose.htm)
Releases all resources used by the effect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetBounds.htm)
Retrieves the bounds of this UnPremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator, Matrix3x2) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetBounds_1.htm)
Retrieves the bounds of this UnPremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetInvalidRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetInvalidRectangles.htm)
Queries what regions of the effect output have changed since it was last drawn.
http://microsoft.github.io/Win2D/icons/pubmethod.gifhttp://microsoft.github.io/Win2D/icons/CodeExample.png
GetRequiredSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetRequiredSourceRectangle.htm)
Queries what part of an effect source image is needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetRequiredSourceRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetRequiredSourceRectangles.htm)
Queries what parts of the effect source images are needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
InvalidateSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_InvalidateSourceRectangle.htm)
Notifies the effect that one of its source images has changed.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
Remarks
Supported by Win2D but not Windows.UI.Composition.
This Windows Runtime type corresponds to the D2D Unpremultiply effect (http://msdn.microsoft.com/en-us/library/windows/desktop/hh780397.aspx).
See Also
Reference
Microsoft.Graphics.Canvas.Effects Namespace (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
With some images it is important that you edit them in WSB and then export the image checking the box "don't undo alpha premultiplication"
If you notice any colored image with transparency when exported and not checking that box will be brighter and more vibrant, this is because it represents the image as it was before it was added to WSB or as it looks when you use Edit Image in WSB, if you check that box though it will export the image as it saved in the msstyles.
This means if you are recoloring the images extracted using Restorator the images will end up dull when imported back in again, this can also lead to other sorts of problems if you have to edit one of the images again in WSB as when you save it back to WSB again it can become a different shade to the rest of your images in a start menu for instance.
Here is one such example:
Edited using Edit image in WSB
75086
Edited using images extracted from the msstyles
75087
As you can see the glow on the text has almost been removed in the one extracted from the msstyles, now this is not something you will have to do for all images, batch recolors are a great idea but even then those images have to be imported again within WSB or the alpha premultiplication will not take place and this can cause problems with the images and sometimes it will display a white square instead.
I hope these tips were helpful for you all and that you can continue to do great recolors in all of their glory.
Some info on Premultiplied alpha
Premultiplied alpha In computer graphics there are two different ways to represent the opacity of a color value. Win2D uses both methods. This article explains the difference, and which is used where.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngStraight alpha
When using straight, also known as linear, alpha:
RGB values specify the color of the thing being drawn
The alpha value specifies how solid it is
In this world, RGB and alpha are independent. You can change one without affecting the other. To make an object fade out, you would gradually reduce its alpha value while leaving RGB unchanged.
To perform a source-over blend between two colors that use straight alpha format:
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
result = (source.RGB * source.A) + (dest.RGB * (1 - source.A))
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngPremultiplied alpha
When using premultiplied alpha:
RGB specifies how much color the thing being drawn contributes to the output
The alpha value specifies how much it obscures whatever is behind it
In this world, RGB and alpha are linked. To make an object transparent you must reduce both its RGB (to contribute less color) and also its alpha (to obscure less of whatever is behind it). Fully transparent objects no longer have any color at all, so there is only one value that represents 100% transparency: RGB and alpha all zero.
To perform a source-over blend between two colors that use premultiplied alpha format:
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
result = source.RGB + (dest.RGB * (1 - source.A))
Premultiplied alpha is used in graphics rendering because it gives better results than straight alpha when filtering images or composing different layers. For more information see the articles:
http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx
http://blogs.msdn.com/b/shawnhar/archive/2009/11/07/premultiplied-alpha-and-image-composition.aspx
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngAlpha in Win2D
Win2D uses straight alpha in its API surface, but premultiplied alpha for internal rendering operations.
Windows.UI.Color values use straight alpha. Whenever you pass a color to a Draw* or Fill* method, set the color of a brush, or clear to a color value, this color is specified using straight alpha.
The pixel values stored in a bitmap or rendertarget, and the drawing or blending operations that operate on these surfaces, use premultiplied alpha. When bitmaps are loaded from a file their contents are automatically converted into premultiplied format. When you call a Win2D drawing method, its color parameter is converted from straight to premultiplied before the actual drawing takes place.
Win2D image effects use a mixture of straight and premultiplied alpha. Some effects operate on one format, some on the other, and some provide a property to choose. The documentation for each effect type describes which alpha mode it uses. Effect input data is always assumed to be premultiplied, so when an effect needs to work with straight alpha it will first apply an unpremultiply transform, compute the effect, and then re-premultiply the output.
The bitmap APIs GetPixelBytes, SetPixelBytes, GetPixelColors, and SetPixelColors, do NOT perform any alpha format conversions. They just directly transfer bit values to or from the underlying GPU texture. This allows you to observe what alpha format Win2D is using internally:
Create a drawing session on a rendertarget
Call drawingSession.Clear(Colors.Tranparent)
Colors.Tranparent is defined as R=255, G=255, B=255, A=0
Win2D will convert this value to premultiplied format, yielding R=0, G=0, B=0, A=0
Use GetPixelColors to read back the contents of the rendertarget
Observe that it contains premultiplied format RGB=0, not RGB=255 like the original straight alpha Colors.Tranparent value
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngConverting between alpha formats
To convert a straight alpha color value to premultiplied format, multiply its R, G, and B values by A. To convert premultiplied to straight, divide R, G, and B by A.
Note that color information is often represented as byte values ranging from 0 to 255 (for example the Windows.UI.Color structure consists of 4 bytes). This representation is scaled up by a factor of 255, so a byte value of 255 actually means 1, while 128 is half intensity. That scaling factor must be taken into account during format conversions, so to convert a Windows.UI.Color from straight to premultiplied:
C#
Copy (http://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm#)
premultiplied.R = (byte)(straight.R * straight.A / 255);
premultiplied.G = (byte)(straight.G * straight.A / 255);
premultiplied.B = (byte)(straight.B * straight.A / 255);
premultiplied.A = straight.A;
If you have image data that is using the wrong alpha format, PremultiplyEffect (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm) or UnPremultiplyEffect (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm) can be used to convert it.
PremultiplyEffect Class[NoComposition] Converts an image from unpremultiplied to premultiplied alpha format.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngInheritance Hierarchy
System.Object (http://msdn2.microsoft.com/en-us/library/e5kfa45b)
Microsoft.Graphics.Canvas.Effects.PremultiplyEffect
Namespace: Microsoft.Graphics.Canvas.Effects (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
Assembly: Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSyntax
C#
Copy (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#)
public sealed class PremultiplyEffect : ICanvasEffect,
IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable
The PremultiplyEffect type exposes the following members.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngConstructors
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
PremultiplyEffect (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect__ctor.htm)
Initializes a new instance of the PremultiplyEffect class.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngProperties
Name
Description
http://microsoft.github.io/Win2D/icons/pubproperty.gif
BufferPrecision (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_BufferPrecision.htm)
Specifies what precision to use for intermediate buffers when drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
CacheOutput (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_CacheOutput.htm)
Enables caching the output from drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Name (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Name.htm)
Attaches a user-defined name string to the effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Source (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Source.htm)
Gets or sets the input source for Premultiply effect.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngMethods
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
Dispose (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_Dispose.htm)
Releases all resources used by the effect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetBounds.htm)
Retrieves the bounds of this PremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator, Matrix3x2) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetBounds_1.htm)
Retrieves the bounds of this PremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetInvalidRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetInvalidRectangles.htm)
Queries what regions of the effect output have changed since it was last drawn.
http://microsoft.github.io/Win2D/icons/pubmethod.gifhttp://microsoft.github.io/Win2D/icons/CodeExample.png
GetRequiredSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetRequiredSourceRectangle.htm)
Queries what part of an effect source image is needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetRequiredSourceRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_GetRequiredSourceRectangles.htm)
Queries what parts of the effect source images are needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
InvalidateSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect_InvalidateSourceRectangle.htm)
Notifies the effect that one of its source images has changed.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_PremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngRemarks
Supported by Win2D but not Windows.UI.Composition.
This Windows Runtime type corresponds to the D2D Premultiply effect (http://msdn.microsoft.com/en-us/library/windows/desktop/hh780395.aspx).
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSee Also
Reference
Microsoft.Graphics.Canvas.Effects Namespace (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
UnPremultiplyEffect Class[NoComposition] Converts an image from premultiplied to unpremultiplied alpha format.
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngInheritance Hierarchy
System.Object (http://msdn2.microsoft.com/en-us/library/e5kfa45b)
Microsoft.Graphics.Canvas.Effects.UnPremultiplyEffect
Namespace: Microsoft.Graphics.Canvas.Effects (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)
Assembly: Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0http://microsoft.github.io/Win2D/icons/SectionExpanded.pngSyntax
C#
Copy (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#)
public sealed class UnPremultiplyEffect : ICanvasEffect,
IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable
The UnPremultiplyEffect type exposes the following members.
Constructors
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
UnPremultiplyEffect (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect__ctor.htm)
Initializes a new instance of the UnPremultiplyEffect class.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
Properties
Name
Description
http://microsoft.github.io/Win2D/icons/pubproperty.gif
BufferPrecision (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_BufferPrecision.htm)
Specifies what precision to use for intermediate buffers when drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
CacheOutput (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_CacheOutput.htm)
Enables caching the output from drawing this effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Name (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Name.htm)
Attaches a user-defined name string to the effect.
http://microsoft.github.io/Win2D/icons/pubproperty.gif
Source (http://microsoft.github.io/Win2D/html/P_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Source.htm)
Gets or sets the input source for UnPremultiply effect.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
http://microsoft.github.io/Win2D/icons/SectionExpanded.pngMethods
Name
Description
http://microsoft.github.io/Win2D/icons/pubmethod.gif
Dispose (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_Dispose.htm)
Releases all resources used by the effect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetBounds.htm)
Retrieves the bounds of this UnPremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetBounds(ICanvasResourceCreator, Matrix3x2) (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetBounds_1.htm)
Retrieves the bounds of this UnPremultiplyEffect.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetInvalidRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetInvalidRectangles.htm)
Queries what regions of the effect output have changed since it was last drawn.
http://microsoft.github.io/Win2D/icons/pubmethod.gifhttp://microsoft.github.io/Win2D/icons/CodeExample.png
GetRequiredSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetRequiredSourceRectangle.htm)
Queries what part of an effect source image is needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
GetRequiredSourceRectangles (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_GetRequiredSourceRectangles.htm)
Queries what parts of the effect source images are needed to draw an output region.
http://microsoft.github.io/Win2D/icons/pubmethod.gif
InvalidateSourceRectangle (http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect_InvalidateSourceRectangle.htm)
Notifies the effect that one of its source images has changed.
Top (http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_UnPremultiplyEffect.htm#PageHeader)
Remarks
Supported by Win2D but not Windows.UI.Composition.
This Windows Runtime type corresponds to the D2D Unpremultiply effect (http://msdn.microsoft.com/en-us/library/windows/desktop/hh780397.aspx).
See Also
Reference
Microsoft.Graphics.Canvas.Effects Namespace (http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm)