Workspace Class |
The workspace object is the container that is used to manage changes to images and provide an interface to open, save, and manipulate images either synchronously or asynchronously.
Namespace: Atalasoft.Imaging
The Workspace type exposes the following members.
Name | Description | |
---|---|---|
Asynchronous | Gets or sets a value indicating if method calls through this Workspace object are
processed asynchronously in a background thread. | |
AutoDispose | Gets or sets a value indicating if the Workspace should dispose all images it contains
when finalized. | |
Image | Gets or sets the current AtalaImage that is active in this Workspace. | |
Images | Gets the ImageCollection of this Workspace object. | |
Queue | Gets the ProcessQueue containing queued items that this Workspace object is
currently processing. | |
Undos | Gets the UndoCollection object containing the undo history of this Workspace. |
Name | Description | |
---|---|---|
ApplyCommand(ImageCommand) | Applies an ImageCommand to the current image in order to process it. | |
ApplyCommand(ImageCommand, String) | Creates an undo level, then applies an ImageCommand to the current image in order to process
it. | |
CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) | |
Dispose() | Cleans up all resources held by this Workspace including all images in the ImageCollection and undos
in the UndoCollection. | |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Finalizes an instance of the Workspace class.
(Overrides Object.Finalize().) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) | |
OnDisposeImage | Invoked when pixel data in the current image changes without setting a new image. Fires the DisposeImage event. | |
OnImageChanged |
Raises the [E:ImageChanged] event.
| |
OnImageStreamCompleted | Invoked after an image has been read or saved signifying that the Stream which was passed
in can be closed. Fires the ImageStreamCompleted event. | |
OnNewImage | ||
OnProcessCompleted | Invoked when an asynchronous process has completed. Fires the ProcessCompleted
event. | |
OnProcessError | Invoked when an error occurs in a separate thread when being processed asynchronously. Fires the ProcessError event. | |
Open(Stream) | Decodes an image from a stream and sets it to the current image. | |
Open(String) | Decodes an image from a file and sets it to the current image. | |
Open(Stream, Int32) | Decodes an image from a stream specifying the frame index of a multipaged file, and sets it to the current
image. | |
Open(String, Int32) | Decodes an image from a file specifying the frame index of a multipaged file, and sets it to the current
image. | |
Save(Stream, ImageEncoder) | Writes the current AtalaImage or ImageCollection to a stream specifying the ImageEncoder
to use to encode the image. | |
Save(String, ImageEncoder) | Writes the current AtalaImage or ImageCollection to a file specifying the ImageEncoder
to use to encode the image. | |
Save(String, ImageType) | Obsolete. Writes the current AtalaImage or ImageCollection to a file specifying the ImageType to
use to encode the image. | |
Save(Stream, ImageEncoder, Int32) | Writes the current AtalaImage or ImageCollection to a stream specifying the ImageEncoder
to use to encode the image and the image index in the collection to save. | |
Save(String, ImageEncoder, Int32) | Writes the current %AtalaImage% or %ImageCollection% to a file specifying the ImageEncoder
to use to encode the image and the image index in the collection to save. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
DisposeImage | Fired when an image in the ImageCollection or UndoCollection is disposed. | |
ImageChanged | Occurs when the current image in the ImageCollection changes. | |
ImageStreamCompleted | Fires after an image has been read or saved signifying that the Stream which was passed
in can be closed. | |
ProcessCompleted | Fires when an asynchronous process has completed. | |
ProcessError | Fires when an error occurs in a separate thread when being processed asynchronously. | |
Progress | Fires while an image is being processed. |
The Workspace object, part of the Atalasoft.Imaging namespace, provides a container that allows for intuitive image processing and management of AtalaImage and ImageCollection objects. The Workspace can be used to manage changes to AtalaImage objects and access methods to open, save, and manipulate images.
Many image processing functions may create new AtalaImage objects. The Workspace manages the creation of these objects by keeping a single current image and providing events when the image changes. The Workspace also disposes of old images when they are no longer needed. You can access the current AtalaImage with the Image property of the Workspace object.
The Workspace is designed to operate either synchronously or asynchronously for multi-threading operations. This behavior is set by the Asynchronous property.
See the WinForm's WorkspaceViewer for a Workspace object with a user interface for displaying images.
This example demonstrates how to create a new workspace, open an image, resample it, then save it to a file.
Workspace myWorkspace = new Workspace(); myWorkspace.Open("image.png"); myWorkspace.ApplyCommand(new ResampleCommand((int)(myWorkspace.Width / 2), (int)(myWorkspace.Height / 2))); myWorkspace.Save("newImage.png", new PngEncoder()); myWorkspace.Dispose();
Dim myWorkspace As Workspace = New Workspace() myWorkspace.Open("image.png") myWorkspace.ApplyCommand(New ResampleCommand(myWorkspace.Width / 2, myWorkspace.Height / 2)) myWorkspace.Save("newImage.png", New PngEncoder()) myWorkspace.Dispose()