Click or drag to resize

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.

Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    Atalasoft.ImagingWorkspace

Namespace:  Atalasoft.Imaging
Assembly:  Atalasoft.dotImage (in Atalasoft.dotImage.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public class Workspace : MarshalByRefObject, IDisposable

The Workspace type exposes the following members.

Constructors
  NameDescription
Public methodWorkspace
Creates a new instance of dotImage
Top
Properties
  NameDescription
Public propertyAsynchronous
Gets or sets a value indicating if method calls through this Workspace object are processed asynchronously in a background thread.
Public propertyAutoDispose
Gets or sets a value indicating if the Workspace should dispose all images it contains when finalized.
Public propertyImage
Gets or sets the current AtalaImage that is active in this Workspace.
Public propertyImages
Gets the ImageCollection of this Workspace object.
Public propertyQueue
Gets the ProcessQueue containing queued items that this Workspace object is currently processing.
Public propertyUndos
Gets the UndoCollection object containing the undo history of this Workspace.
Top
Methods
  NameDescription
Public methodCode exampleApplyCommand(ImageCommand)
Applies an ImageCommand to the current image in order to process it.
Public methodApplyCommand(ImageCommand, String)
Creates an undo level, then applies an ImageCommand to the current image in order to process it.
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Cleans up all resources held by this Workspace including all images in the ImageCollection and undos in the UndoCollection.
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Finalizes an instance of the Workspace class.
(Overrides ObjectFinalize.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Protected methodOnDisposeImage
Invoked when pixel data in the current image changes without setting a new image. Fires the DisposeImage event.
Protected methodOnImageChanged
Raises the [E:ImageChanged] event.
Protected methodOnImageStreamCompleted
Invoked after an image has been read or saved signifying that the Stream which was passed in can be closed. Fires the ImageStreamCompleted event.
Protected methodOnNewImage
Protected methodOnProcessCompleted
Invoked when an asynchronous process has completed. Fires the ProcessCompleted event.
Protected methodOnProcessError
Invoked when an error occurs in a separate thread when being processed asynchronously. Fires the ProcessError event.
Public methodOpen(Stream)
Decodes an image from a stream and sets it to the current image.
Public methodOpen(String)
Decodes an image from a file and sets it to the current image.
Public methodOpen(Stream, Int32)
Decodes an image from a stream specifying the frame index of a multipaged file, and sets it to the current image.
Public methodOpen(String, Int32)
Decodes an image from a file specifying the frame index of a multipaged file, and sets it to the current image.
Public methodSave(Stream, ImageEncoder)
Writes the current AtalaImage or ImageCollection to a stream specifying the ImageEncoder to use to encode the image.
Public methodSave(String, ImageEncoder)
Writes the current AtalaImage or ImageCollection to a file specifying the ImageEncoder to use to encode the image.
Public methodSave(String, ImageType) Obsolete.
Writes the current AtalaImage or ImageCollection to a file specifying the ImageType to use to encode the image.
Public methodSave(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.
Public methodSave(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.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventDisposeImage
Fired when an image in the ImageCollection or UndoCollection is disposed.
Public eventImageChanged
Occurs when the current image in the ImageCollection changes.
Public eventImageStreamCompleted
Fires after an image has been read or saved signifying that the Stream which was passed in can be closed.
Public eventProcessCompleted
Fires when an asynchronous process has completed.
Public eventProcessError
Fires when an error occurs in a separate thread when being processed asynchronously.
Public eventProgress
Fires while an image is being processed.
Top
Remarks

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.

Examples

This example demonstrates how to create a new workspace, open an image, resample it, then save it to a file.

Simple Example (C#)
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();
Simple Example (Visual Basic)
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()
See Also