BitmapSource Class

CVB.Net Documentation
BitmapSource for Image objects.
Inheritance Hierarchy

SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.WindowsFreezable
        System.Windows.Media.AnimationAnimatable
          System.Windows.MediaImageSource
            System.Windows.Media.ImagingBitmapSource
              Stemmer.Cvb.Wpf.ImagingBitmapSource

Namespace:  Stemmer.Cvb.Wpf.Imaging
Assembly:  Stemmer.Cvb.Wpf (in Stemmer.Cvb.Wpf.dll) Version: 14.0.0.0
Syntax

public sealed class BitmapSource : BitmapSource, 
	IDisposable, ISupportInitialize

The BitmapSource type exposes the following members.

Constructors

  NameDescription
Public methodBitmapSource
Creates an empty BitmapSource.
Public methodBitmapSource(Image, Int32, Int32, HighBitScaleMode)
Creates a BitmapSource from the given source image.
Top
Properties

  NameDescription
Public propertyCanFreeze
Gets a value that indicates whether the object can be made unmodifiable.
(Inherited from Freezable.)
Public propertyDependencyObjectType
Gets the DependencyObjectType that wraps the CLR type of this instance. 
(Inherited from DependencyObject.)
Public propertyDispatcher
Gets the Dispatcher this DispatcherObject is associated with.
(Inherited from DispatcherObject.)
Public propertyDpiX
Horizontal DPI of the bitmap.
(Overrides BitmapSourceDpiX.)
Public propertyDpiY
Vertical DPI of the bitmap.
(Overrides BitmapSourceDpiY.)
Public propertyFormat
The pixel format of this BitmapSource.
(Overrides BitmapSourceFormat.)
Public propertyHasAnimatedProperties
Gets a value that indicates whether one or more AnimationClock objects is associated with any of this object's dependency properties.
(Inherited from Animatable.)
Public propertyHeight
Gets the height of the source bitmap in device-independent units (1/96th inch per unit). 
(Inherited from BitmapSource.)
Public propertyHighBitScaleMode
Sets the HighBitScaleMode for scaling non-8bpp images.
Public propertyIsDownloading
Gets whether this bitmap source is downloading (never).
(Overrides BitmapSourceIsDownloading.)
Public propertyIsFrozen
Gets a value that indicates whether the object is currently modifiable.
(Inherited from Freezable.)
Public propertyIsSealed
Gets a value that indicates whether this instance is currently sealed (read-only).
(Inherited from DependencyObject.)
Public propertyMaxDecodePixelHeight
Gets/sets maximal decode height.
Public propertyMaxDecodePixelWidth
Gets/sets maximal decode width.
Public propertyMetadata
Gets the metadata that is associated with this bitmap image.
(Inherited from BitmapSource.)
Public propertyPalette
Palette of the bitmap.
(Overrides BitmapSourcePalette.)
Public propertyPixelHeight
Gets the height of this BitmapSource in pixels.
(Overrides BitmapSourcePixelHeight.)
Public propertyPixelWidth
Gets the width of this BitmapSource in pixels.
(Overrides BitmapSourcePixelWidth.)
Public propertySource
Gets/sets the Image source for this BitmapSource.
Public propertyWidth
Gets the width of the bitmap in device-independent units (1/96th inch per unit). 
(Inherited from BitmapSource.)
Top
Methods

  NameDescription
Public methodApplyAnimationClock(DependencyProperty, AnimationClock)
Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the SnapshotAndReplace handoff behavior is used.
(Inherited from Animatable.)
Public methodApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the specified HandoffBehavior is used.
(Inherited from Animatable.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline)
Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the SnapshotAndReplace handoff behavior is used.
(Inherited from Animatable.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)
Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the specified HandoffBehavior is used.
(Inherited from Animatable.)
Public methodBeginInit
Begin the initialization phase.
Public methodCheckAccess
Determines whether the calling thread has access to this DispatcherObject.
(Inherited from DispatcherObject.)
Public methodClearValue(DependencyProperty)
Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.
(Inherited from DependencyObject.)
Public methodClearValue(DependencyPropertyKey)
Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.
(Inherited from DependencyObject.)
Public methodClone
Creates a modifiable clone of this BitmapSource, making deep copies of this object's values. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.
(Inherited from BitmapSource.)
Public methodCloneCurrentValue
Creates a modifiable clone of this BitmapSource object, making deep copies of this object's current values. Resource references, data bindings, and animations are not copied, but their current values are.
(Inherited from BitmapSource.)
Public methodCoerceValue
Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.
(Inherited from DependencyObject.)
Public methodCopyPixels(Array, Int32, Int32)
Requests pixels from this BitmapSource.
(Overrides BitmapSourceCopyPixels(Array, Int32, Int32).)
Public methodCopyPixels(Int32Rect, Array, Int32, Int32)
Requests pixels from this BitmapSource.
(Overrides BitmapSourceCopyPixels(Int32Rect, Array, Int32, Int32).)
Public methodCopyPixels(Int32Rect, IntPtr, Int32, Int32)
Requests pixels from this BitmapSource.
(Overrides BitmapSourceCopyPixels(Int32Rect, IntPtr, Int32, Int32).)
Public methodDispose
Dispose this BitmapSource.
Public methodEndInit
End the initialization phase and setup the object.
Public methodEquals
Determines whether a provided DependencyObject is equivalent to the current DependencyObject.
(Inherited from DependencyObject.)
Protected methodFinalize
Finalizer.
(Overrides ObjectFinalize.)
Public methodFreeze
Makes the current object unmodifiable and sets its IsFrozen property to true.
(Inherited from Freezable.)
Public methodGetAnimationBaseValue
Returns the non-animated value of the specified DependencyProperty.
(Inherited from Animatable.)
Public methodGetAsFrozen
Creates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference.
(Inherited from Freezable.)
Public methodGetCurrentValueAsFrozen
Creates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference.
(Inherited from Freezable.)
Public methodGetHashCode
Gets a hash code for this DependencyObject.
(Inherited from DependencyObject.)
Public methodGetLocalValueEnumerator
Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.
(Inherited from DependencyObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Returns the current effective value of a dependency property on this instance of a DependencyObject.
(Inherited from DependencyObject.)
Public methodInvalidateProperty
Re-evaluates the effective value for the specified dependency property
(Inherited from DependencyObject.)
Public methodReadLocalValue
Returns the local value of a dependency property, if it exists.
(Inherited from DependencyObject.)
Public methodSetCurrentValue
Sets the value of a dependency property without changing its value source.
(Inherited from DependencyObject.)
Public methodSetValue(DependencyProperty, Object)
Sets the local value of a dependency property, specified by its dependency property identifier.
(Inherited from DependencyObject.)
Public methodSetValue(DependencyPropertyKey, Object)
Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.
(Inherited from DependencyObject.)
Public methodToString
Creates a string representation of this object based on the current culture.
(Inherited from ImageSource.)
Public methodToString(IFormatProvider)
Creates a string representation of this object based on the IFormatProvider passed in. If the provider is null, the CurrentCulture is used.
(Inherited from ImageSource.)
Public methodVerifyAccess
Enforces that the calling thread has access to this DispatcherObject.
(Inherited from DispatcherObject.)
Top
Events

  NameDescription
Public eventChanged
Occurs when the Freezable or an object it contains is modified.
(Inherited from Freezable.)
Public eventDecodeFailed
Raised if the Source could not be decoded.
(Overrides BitmapSourceDecodeFailed.)
Public eventDownloadCompleted
Raised if the download is completed.
(Overrides BitmapSourceDownloadCompleted.)
Public eventDownloadFailed
Occurs when the bitmap content failed to download.
(Inherited from BitmapSource.)
Public eventDownloadProgress
Occurs when the download progress of the bitmap content has changed.
(Inherited from BitmapSource.)
Top
Fields

  NameDescription
Public fieldStatic memberHighBitScaleModeProperty
Dependency property backing store of HighBitScaleMode.
Public fieldStatic memberMaxDecodePixelHeightProperty
Dependency property backing store for MaxDecodePixelHeight property.
Public fieldStatic memberMaxDecodePixelWidthProperty
Dependency property backing store for MaxDecodePixelWidth property.
Public fieldStatic memberSourceProperty
Dependency property backing store for Source property.
Top
Extension Methods

  NameDescription
Public Extension MethodFindVisualParentT
Finds a parent of a certain type of a this item in the visual tree.
(Defined by VisualTreeHelperExtensions.)
Top
Explicit Interface Implementations

  NameDescription
Explicit interface implementationPrivate methodIFormattableToString
Formats the value of the current instance using the specified format.
(Inherited from ImageSource.)
Top
Remarks

Attention: do not use this class directly in any control displaying an image source. There is a bug in the WPF BitmapSource implementation throwing a NotImplemented exception in out of memory conditions in the render thread.

Makes CVB images accessible for WPF imaging. Resulting PixelFormats are either Gray8 for single plane unsigned 8bpp image or Bgr24 for all other formats (three plane 8bpp per plane images are also copied directly; all other formats are processed via the Image.ToBitmap method.

As the WPF imaging model is only designed for still image support, you need to create a new BitmapSource each time you want to display an update. Update behavior is sadly hard-coded in WPF for just three BitmapSources: WriteableBitmap, InteropBitmap and RenderTargetBitmap. Creating new BitmapSource is designed to be cheap.

BitmapSource implementation based on the articles of Dwayne Need (http://social.msdn.microsoft.com/profile/dwayne%20need%20%5Bmsft%5D).

See Also

Reference