DbImageSource Class |
Namespace: Atalasoft.Imaging.ImageSources
The DbImageSource type exposes the following members.
Name | Description | |
---|---|---|
DbImageSource(IDbImageAccessor) | Creates a DbImageSource from a IDbImageAccessor implementor. | |
DbImageSource(SerializationInfo, StreamingContext) | Deserialize this object from the info and context. | |
DbImageSource(IDbImageAccessor, Boolean) | Creates a DbImageSource from a IDbImageAccessor implementor. |
Name | Description | |
---|---|---|
ActiveImages |
Gets the active images.
(Inherited from ImageSource.) | |
Count | Returns the total number of images in the image source. (Inherited from RandomAccessImageSource.) | |
CulledImages |
Gets the culled images.
(Inherited from ImageSource.) | |
Current | Returns the index of the current image. (Inherited from ImageSource.) | |
DbAccessor | The accessor used to get to the database. This class supports changing the accessor, but if you change
anything about the connected accessor, you are responsible for calling Reset() on the image source. | |
DoAllFrames | Whether to include all of the frames as individual images in the source. | |
ImmediateUnload | Determines if an image should be unloaded from memory immediately. (Inherited from ImageSource.) | |
Item | Acquires the image at location i within the image source and returns it. (Inherited from RandomAccessImageSource.) | |
MemoryInUse | Returns an estimate of the number of bytes of memory currently in use by images in this
ImageSource. (Inherited from ImageSource.) | |
MemoryLimit | This sets the limit for memory usage for this ImageSource. If memory usage goes beyond
this, images will be dropped from memory until memory usage is below the limit. (Inherited from ImageSource.) | |
TotalImages | Returns the total number of available images in this ImageSource. (Inherited from ImageSource.) | |
TotalImagesKnown | Gets a value indicating whether or not the total number of images in this image source can be known. (Inherited from ImageSource.) |
Name | Description | |
---|---|---|
Acquire(Int32) | Obsolete. This method has been deprecated. Use ReAcquire(AtalaImage) instead. (Inherited from ImageSource.) | |
Acquire(AtalaImage) | Obsolete. This method has been deprecated. Use ReAcquire(AtalaImage) instead.
(Inherited from ImageSource.) | |
AcquireNext | Acquire the next available image from the ImageSource. (Inherited from ImageSource.) | |
AllImagesAreReleased |
Determines if all the images have been released.
(Inherited from ImageSource.) | |
CalculateNumPagesPerImage | Calculates and caches the number of frames per image and the image count. | |
ContainsImage |
Determines whether this ImageSource contains the specified image.
(Inherited from ImageSource.) | |
CullNode |
Culls the node from the ImageSource
(Inherited from ImageSource.) | |
CullReleasedImages |
Culls all released images.
(Inherited from ImageSource.) | |
Dispose | Free up resources used by this ImageSource (Inherited from ImageSource.) | |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources.
(Inherited from ImageSource.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Finalizes an instance of the ImageSource class.
(Inherited from ImageSource.) | |
Find |
Finds the specified image.
(Inherited from ImageSource.) | |
Flush | Flush all released images out of memory. (Inherited from ImageSource.) | |
GetFrameCountInImage | Returns the number of frames in the image that will be served by this image source. If
DoAllFrames is false, this function always returns 1. | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetImageNumAndFrame | Caclulates the image number and frame number given an image source index. | |
GetImageStream | Gets the stream and the frame within that stream that corresponds to the passed in index. The caller is
responsible for closing the returned stream. | |
GetObjectData | Get the data to serialize for this object. (Overrides RandomAccessImageSourceGetObjectData(SerializationInfo, StreamingContext).) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
HasMoreImages | Determines if there are more images to load. (Inherited from ImageSource.) | |
LowLevelAcquire | Acquires the image at the given image source index. (Overrides RandomAccessImageSourceLowLevelAcquire(Int32).) | |
LowLevelAcquireNextImage | Acquire the next image in the source. (Overrides ImageSourceLowLevelAcquireNextImage.) | |
LowLevelDispose | Disposes any non-GC objects used by this class. (Overrides ImageSourceLowLevelDispose.) | |
LowLevelFlushOnReset | Returns true to indicate that a Reset() should flush all images (Overrides ImageSourceLowLevelFlushOnReset.) | |
LowLevelHasMoreImages | Returns true if AcquireNext would return an image (Overrides ImageSourceLowLevelHasMoreImages.) | |
LowLevelReplaceImage | Not implemented for this image source. Will throw NotImplementedException. (Overrides ImageSourceLowLevelReplaceImage(ImageSourceNode, AtalaImage).) | |
LowLevelReset | Empties any cached data about the images (Overrides ImageSourceLowLevelReset.) | |
LowLevelSkipNextImage | Increments the internal index so that AcquireNext would skip an image (Overrides ImageSourceLowLevelSkipNextImage.) | |
LowLevelTotalImages | The total number of images in the image source (Overrides ImageSourceLowLevelTotalImages.) | |
LowLevelTotalImagesKnown |
Returns if the total images is known.
(Inherited from RandomAccessImageSource.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
NotifyChangedImage(AtalaImage) | This method is used to inform an ImageSource that one of its current acquired images has changed. (Inherited from ImageSource.) | |
NotifyChangedImage(AtalaImage, AtalaImage) | This method is used to inform an ImageSource that one of its current acquired images has changed.
(Inherited from ImageSource.) | |
OnChangedImage |
Raises the [E:ChangedImage] event.
(Inherited from ImageSource.) | |
OnNodeIndexSet | This method is called from the RandomAccessImageSource indexer after it has set the ImageSourceNode.Index value. (Inherited from RandomAccessImageSource.) | |
OnReleasing | Called when Release(AtalaImage) was performed on an ImageSourceNode. (Inherited from ImageSource.) | |
ReAcquire(Int32) | Acquire a previous image by index. (Inherited from ImageSource.) | |
ReAcquire(AtalaImage) | Acquire an AtalaImage that has been previously acquired. (Inherited from ImageSource.) | |
Release | Release a previously acquired image. (Inherited from ImageSource.) | |
ReleaseChangedImage(AtalaImage) | Release an image that has changed, notifying other clients that the image has changed. (Inherited from ImageSource.) | |
ReleaseChangedImage(AtalaImage, AtalaImage) | Release an image that has changed, notifying other clients that the image has changed. (Inherited from ImageSource.) | |
Reset | Resets the ImageSource to start over again. (Inherited from ImageSource.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
ChangedImage | This event is fired whenever an image has been replaced. (Inherited from ImageSource.) | |
Releasing | Raised when the Release(AtalaImage) method is called on an ImageSourceNode. (Inherited from ImageSource.) |
using System.Data; using System.Data.SqlClient; using System.Collections; using Atalasoft.Imaging; using Atalasoft.Imaging.ImageSources; using Atalasoft.Imaging.ImageSources.Data; public class DbImageSourceExample { // Gets a SQL Server specific connection to the image database public static IDbConnection GetConn() { return new SqlConnection("Data Source=DBServer;Integrated security=SSPI;Initial Catalog=ImageDatabase;"); } // create an accessor that uses SQL statements public DbCommandImageAccessor CreateSqlImageAccessor() { Hashtable sqlParams = new Hashtable(); sqlParams["@lower"] = 2; sqlParams["@upper"] = 4; return new DbSqlImageAccessor(new GetConnectionCallback(GetConn), false, "imageBlob", "id", "images", "id between 2 and 4", null, null, sqlParams ); } // get an image from the database public AtalaImage GetImageFromDb(int i) { DbImageSource imgSrc = new DbImageSource(CreateSqlImageAccessor()); return imgSrc[i]; } }
Imports System.Data Imports System.Data.SqlClient Imports System.Collections Imports Atalasoft.Imaging Imports Atalasoft.Imaging.ImageSources Imports Atalasoft.Imaging.ImageSources.Data Public Class DbImageSourceExample ' Gets a SQL Server specific connection to the image database Public Shared Function GetConn() As IDbConnection Return New SqlConnection("Data Source=DBServer;Integrated security=SSPI;Initial Catalog=ImageDatabase;") End Function ' create an accessor that uses SQL statements Public Function CreateSqlImageAccessor() As DbCommandImageAccessor Dim sqlParams As New Hashtable() sqlParams("@lower") = 2 sqlParams("@upper") = 4 Return New DbSqlImageAccessor(New GetConnectionCallback(AddressOf GetConn), False, "imageBlob", "id", "images", "id between 2 and 4", _ Nothing, Nothing, sqlParams) End Function ' get an image from the database Public Function GetImageFromDb(ByVal i As Integer) As AtalaImage Dim imgSrc As New DbImageSource(CreateSqlImageAccessor()) Return imgSrc(i) End Function End Class