C# Class Microsoft.DwayneNeed.Media.Imaging.CustomBitmap

Inheritance: System.Windows.Media.Imaging.BitmapSource, IDisposable
Exibir arquivo Open project: cplotts/WPFSLBlendModeFx Class Usage Examples

Public Methods

Method Description
CopyPixels ( Array pixels, int stride, int offset ) : void

Requests pixels from this BitmapSource.

Derived classes must override CopyPixelsCommon to implement custom logic.

CopyPixels ( System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset ) : void

Requests pixels from this BitmapSource.

Derived classes must override CopyPixelsCommon to implement custom logic.

CopyPixels ( System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride ) : void

Requests pixels from this BitmapSource.

Derived classes must override CopyPixelsCommon to implement custom logic.

Protected Methods

Method Description
CloneCore ( System.Windows.Freezable source ) : void

Copies data into a cloned instance.

When Freezable is cloned, WPF will make deep clones of all writable, locally-set properties including expressions. The property's base value is copied -- not the current value. WPF skips read only DPs. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.

CloneCurrentValueCore ( System.Windows.Freezable source ) : void

Copies data into a cloned instance.

When a Freezable's "current value" is cloned, WPF will make deep clones of the "current values" of all writable, locally-set properties. This has the effect of resolving expressions to their values. WPF skips read only DPs. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.

CopyCore ( CustomBitmap original, bool useCurrentValue, bool willBeFrozen ) : void

Copies data into a cloned instance.

Override this method if you have additional non-DP state that should be transfered to clones.

CopyPixelsCore ( System.Windows.Int32Rect sourceRect, int stride, int bufferSize, IntPtr buffer ) : void

Requests pixels from this BitmapSource.

This is the main image processing routine. It instructs the BitmapSource instance to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent on the implementation. Implementation of this method must only write to the first (rc.Width*PixelFormat.BitsPerPixel+7)/8 bytes of each line of the output buffer (in this case, a line is a consecutive string of "stride" bytes).

CreateInstanceCore ( ) : System.Windows.Freezable

Creates an instance of a CustomBitmap.

The default implementation uses reflection to create a new instance of this type. Derived classes may override this method if they wish to provide a more performant implementation, or if their type does not have a public default constructor.

GetAsFrozenCore ( System.Windows.Freezable source ) : void

Copies data into a cloned instance.

Freezable.GetAsFrozen is semantically equivalent to Freezable.Clone().Freeze(), except that you can avoid copying any portions of the Freezable graph which are already frozen. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.

GetCurrentValueAsFrozenCore ( System.Windows.Freezable source ) : void

Copies data into a cloned instance.

Freezable.GetCurrentValueAsFrozen is semantically equivalent to Freezable.CloneCurrentValue().Freeze(), except that WPF will avoid copying any portions of the Freezable graph which are already frozen. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.

RaiseDecodeFailed ( ExceptionEventArgs e ) : void

Raises the decode failed event.

RaiseDownloadCompleted ( ) : void

Raises the dowload completed event.

RaiseDownloadFailed ( ExceptionEventArgs e ) : void

Raises the dowload failed event.

RaiseDownloadProgress ( System.Windows.Media.Imaging.DownloadProgressEventArgs e ) : void

Raises the dowload progress event.

Private Methods

Method Description
ValidateArrayAndGetInfo ( Array pixels, int &elementSize, int &sourceBufferSize, Type &elementType ) : void

Get the size of the specified array and of the elements in it.

Method Details

CloneCore() protected final method

Copies data into a cloned instance.
When Freezable is cloned, WPF will make deep clones of all writable, locally-set properties including expressions. The property's base value is copied -- not the current value. WPF skips read only DPs. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.
protected final CloneCore ( System.Windows.Freezable source ) : void
source System.Windows.Freezable /// The original instance to copy data from. ///
return void

CloneCurrentValueCore() protected final method

Copies data into a cloned instance.
When a Freezable's "current value" is cloned, WPF will make deep clones of the "current values" of all writable, locally-set properties. This has the effect of resolving expressions to their values. WPF skips read only DPs. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.
protected final CloneCurrentValueCore ( System.Windows.Freezable source ) : void
source System.Windows.Freezable /// The original instance to copy data from. ///
return void

CopyCore() protected method

Copies data into a cloned instance.
Override this method if you have additional non-DP state that should be transfered to clones.
protected CopyCore ( CustomBitmap original, bool useCurrentValue, bool willBeFrozen ) : void
original CustomBitmap /// The original instance to copy data from. ///
useCurrentValue bool /// Whether or not to copy the current value of expressions, or the /// expressions themselves. ///
willBeFrozen bool /// Indicates whether or not the clone will be frozen. If the /// clone will be immediately frozen, there is no need to clone /// data that is already frozen, you can just share the instance. ///
return void

CopyPixels() public final method

Requests pixels from this BitmapSource.
Derived classes must override CopyPixelsCommon to implement custom logic.
public final CopyPixels ( Array pixels, int stride, int offset ) : void
pixels System.Array /// The destination array of pixels. ///
stride int /// The stride of the destination array. ///
offset int /// The starting index within the destination array to copy to. ///
return void

CopyPixels() public final method

Requests pixels from this BitmapSource.
Derived classes must override CopyPixelsCommon to implement custom logic.
public final CopyPixels ( System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset ) : void
sourceRect System.Windows.Int32Rect /// The rectangle of pixels to copy. ///
pixels System.Array /// The destination array of pixels. ///
stride int /// The stride of the destination array. ///
offset int /// The starting index within the destination array to copy to. ///
return void

CopyPixels() public final method

Requests pixels from this BitmapSource.
Derived classes must override CopyPixelsCommon to implement custom logic.
public final CopyPixels ( System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride ) : void
sourceRect System.Windows.Int32Rect /// The rectangle of pixels to copy. ///
buffer System.IntPtr /// The destination buffer of pixels. ///
bufferSize int /// The size of the buffer, in bytes. ///
stride int /// The stride of the destination buffer. ///
return void

CopyPixelsCore() protected method

Requests pixels from this BitmapSource.
This is the main image processing routine. It instructs the BitmapSource instance to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent on the implementation. Implementation of this method must only write to the first (rc.Width*PixelFormat.BitsPerPixel+7)/8 bytes of each line of the output buffer (in this case, a line is a consecutive string of "stride" bytes).
protected CopyPixelsCore ( System.Windows.Int32Rect sourceRect, int stride, int bufferSize, IntPtr buffer ) : void
sourceRect System.Windows.Int32Rect
stride int /// Defines the count of bytes between two vertically adjacent /// pixels in the output buffer. ///
bufferSize int /// The size ///
buffer System.IntPtr /// The caller controls the memory management and must provide an /// output buffer of sufficient size to complete the call based on /// the width, height and pixel format of the bitmap and the /// sub-rectangle provided to the copy method. ///
return void

CreateInstanceCore() protected method

Creates an instance of a CustomBitmap.
The default implementation uses reflection to create a new instance of this type. Derived classes may override this method if they wish to provide a more performant implementation, or if their type does not have a public default constructor.
protected CreateInstanceCore ( ) : System.Windows.Freezable
return System.Windows.Freezable

GetAsFrozenCore() protected final method

Copies data into a cloned instance.
Freezable.GetAsFrozen is semantically equivalent to Freezable.Clone().Freeze(), except that you can avoid copying any portions of the Freezable graph which are already frozen. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.
protected final GetAsFrozenCore ( System.Windows.Freezable source ) : void
source System.Windows.Freezable /// The original instance to copy data from. ///
return void

GetCurrentValueAsFrozenCore() protected final method

Copies data into a cloned instance.
Freezable.GetCurrentValueAsFrozen is semantically equivalent to Freezable.CloneCurrentValue().Freeze(), except that WPF will avoid copying any portions of the Freezable graph which are already frozen. If you derive from this class and have additional non-DP state that should be transfered to copies, you should override the CopyCommon method.
protected final GetCurrentValueAsFrozenCore ( System.Windows.Freezable source ) : void
source System.Windows.Freezable /// The original instance to copy data from. ///
return void

RaiseDecodeFailed() protected method

Raises the decode failed event.
protected RaiseDecodeFailed ( ExceptionEventArgs e ) : void
e ExceptionEventArgs
return void

RaiseDownloadCompleted() protected method

Raises the dowload completed event.
protected RaiseDownloadCompleted ( ) : void
return void

RaiseDownloadFailed() protected method

Raises the dowload failed event.
protected RaiseDownloadFailed ( ExceptionEventArgs e ) : void
e ExceptionEventArgs
return void

RaiseDownloadProgress() protected method

Raises the dowload progress event.
protected RaiseDownloadProgress ( System.Windows.Media.Imaging.DownloadProgressEventArgs e ) : void
e System.Windows.Media.Imaging.DownloadProgressEventArgs
return void