Image Class Reference

Represents an raster image of particular format which may be added to the map. More...

Collaboration diagram for Image:
Collaboration graph

Public Member Functions

bool _pushSchemetkRaster (GridColorScheme cScheme)
 Sets color scheme to use in process of generation of the image representation of the grid. More...
 
void BufferToProjection (int BufferX, int BufferY, out double projX, out double projY)
 Converts the position of pixel in image buffer to the map coordinates. More...
 
bool BuildOverviews (tkGDALResamplingMethod ResamplingMethod, int NumOverviews, Array OverviewList)
 Builds overviews for GDAL image. More...
 
bool Clear (uint CanvasColor, ICallback cBack)
 Clears the image using the specified canvas color as the new color for every pixel in the image. More...
 
bool ClearOverviews ()
 Clears the overviews for the datasource. More...
 
bool Close ()
 Closes the image. More...
 
bool CreateNew (int NewWidth, int NewHeight)
 Creates a new image with specified width and height. More...
 
void Deserialize (string NewVal)
 Restores the properties of the image object from the serialized string. More...
 
GdalRasterBand get_Band (int bandIndex)
 Gets the band with the specified index. More...
 
double get_BandMaximum (int bandIndex)
 Gets the maximum value for the specified band. More...
 
double get_BandMinimum (int bandIndex)
 Gets the minimum value for the specified band. More...
 
string get_ErrorMsg (int ErrorCode)
 Retrieves the error message associated with the specified error code. More...
 
int get_Value (int Row, int Column)
 Gets the value of a pixel in the image. More...
 
uint get_ValueWithAlpha (int Row, int Column)
 Gets the value of the specified pixel including the alpha component. More...
 
bool GetImageBitsDC (int hdc)
 Gets the data from the image and puts it into the selected bitmap in the specified device context. More...
 
string GetProjection ()
 Retrieves projection string from the associated .prj file. More...
 
bool GetRow (int Row, ref int Vals)
 Gets a row of pixels from the image. More...
 
int GetUniqueColors (double MaxBufferSizeMB, out object Colors, out object Frequencies)
 Returns the arrays with the unique colors of the image and their frequencies. More...
 
void ImageToProjection (int Column, int Row, out double ProjX, out double ProjY)
 Converts coordinates of image's pixel to the screen coordinates. More...
 
bool LoadBuffer (double maxBufferSize)
 Loads the whole image in the memory buffer of specified size. Applicable for GDAL images only. More...
 
bool Open (string ImageFileName, ImageType fileType, bool InRam, ICallback cBack)
 Opens an image from file. More...
 
Grid OpenAsGrid ()
 Opens the datasource of the image as grid. More...
 
void ProjectionToBuffer (double ProjX, double ProjY, out int BufferX, out int BufferY)
 Returns the coordinates of pixel in image buffer which correspond to the given point on the map. More...
 
void ProjectionToImage (double ProjX, double ProjY, out int Column, out int Row)
 Returns the coordinates of image pixel which correspond to the given point on the map. More...
 
bool Resource (string NewImgPath)
 Changes the data source of the image object without the its closing. More...
 
bool Save (string ImageFileName, bool WriteWorldFile, ImageType FileType, ICallback cBack)
 Saves the image to file. More...
 
string Serialize (bool SerializePixels)
 Serializes the image properties to the string. More...
 
void set_Value (int Row, int Column, int pVal)
 Sets the value of a pixel in the image. More...
 
void set_ValueWithAlpha (int Row, int Column, uint pVal)
 Sets the value of the specified pixel including the alpha component. More...
 
bool SetBandMinMax (int bandIndex, double min, double max)
 Sets the band minimum maximum values for the band. Values outside of this range will not be rendered. More...
 
bool SetDefaultMinMax (int bandIndex)
 Calculates the minimum and maximum values for the specified band and caches them for further use. More...
 
bool SetImageBitsDC (int hdc)
 This function uses a bitmap selected in the specified device context handle as the data to copy into the image for which the function is called. More...
 
void SetNoDataValue (double Value, ref bool Result)
 Sets no-data value for the image. Applicable for GDAL images only. More...
 
bool SetProjection (string Proj4)
 Sets projection string for the image. More...
 
void SetTransparentColor (uint Color)
 Sets transparent color for image. More...
 
void SetVisibleExtents (double newMinX, double newMinY, double newMaxX, double newMaxY, int newPixelsInView, float transPercent)
 Reloads the image buffer to represent the specified map extents. Applicable for GDAL images only. More...
 

Properties

GdalRasterBand ActiveBand [get]
 Gets the active band (the one used for rendering when grid rendering is on). More...
 
GridColorScheme ActiveColorScheme [get]
 Gets the active color scheme used for the rendering, it may be either default or custom one. More...
 
tkGridRendering AllowGridRendering [get, set]
 Gets or sets the value which indicates whether the image will be rendered as grid, i.e. with a color scheme applied to a band set by Image.SourceGridBandIndex. More...
 
bool AllowHillshade [get, set]
 Indicate whether hillshade algorithm will be used for generation of image representation of the grid. More...
 
int AlphaBandIndex [get, set]
 Gets or sets the index of the alpha band. More...
 
int BlueBandIndex [get, set]
 Gets or sets the index of the blue band (used when RGB rendering is chosen). More...
 
float Brightness [get, set]
 Gets or sets the brightness of the image. More...
 
int BufferOffsetX [get]
 Gets the index of the left most pixel of the original image that was included in the current buffer. More...
 
int BufferOffsetY [get]
 Gets the index of the top most pixel of the original image that was included in the current buffer. More...
 
int BufferSize [get, set]
 Gets or sets the size of image buffer in percentage. More...
 
bool CanUseGrouping [get, set]
 Gets or sets a boolean value which indicates how images with identical size and position on the map will be drawn. More...
 
string CdlgFilter [get]
 Returns the common dialog filter containing all supported file extensions in string format. More...
 
bool ClearGDALCache [get, set]
 Clears the cache of GDAL library which can be used for faster display. More...
 
uint ColorizeColor [get, set]
 Gets or sets the color of the colorize. More...
 
float ColorizeIntensity [get, set]
 Gets or sets the colorize intensity. More...
 
float Contrast [get, set]
 Gets or sets the contrast of the image. More...
 
GridColorScheme CustomColorScheme [get, set]
 Gets or sets the color scheme to render image with. More...
 
tkInterpolationMode DownsamplingMode [get, set]
 The interpolation mode for images which are displayed with the resolution higher than original, i.e. after zoom in (down). More...
 
int DrawingMethod [get, set]
 Gets or sets the drawing method of image. More...
 
double dX [get, set]
 Gets or sets the number of map units per pixel of image buffer for x axis. More...
 
double dY [get, set]
 Gets or sets the number of map units per pixel of image buffer for y axis. More...
 
Extents Extents [get]
 Returns the extents of the image. More...
 
int FileHandle [get]
 Returns file handle for BMP image. For inner use only. More...
 
string Filename [get]
 The filename associated with the object. More...
 
bool ForceSingleBandRendering [get, set]
 Gets or sets a value indicating whether the band set by Image.ActiveBandIndex will be used rather then RGB rendering. More...
 
float Gamma [get, set]
 Gets or sets the gamma correction value for the image. More...
 
GdalDriver GdalDriver [get]
 Gets the GDAL driver which manages the current datasource. More...
 
GeoProjection GeoProjection [get, set]
 Get or sets an instance of GeoProjection class associated with the image. More...
 
ICallback GlobalCallback [get, set]
 The global callback is the interface used by MapWinGIS to pass progress and error events to interested applications. More...
 
int GreenBandIndex [get, set]
 Gets or sets the index of the green band (used when RGB rendering is chosen). More...
 
GridColorScheme GridProxyColorScheme [get]
 Gets grid color scheme this proxy image was generated with. The method should be called for proxy images only: Image.IsGridProxy = true. More...
 
bool GridRendering [get]
 Returns true if the image is rendered as grid. More...
 
bool HasColorTable [get]
 Returns a boolean value which indicates whether an image has a color table. Applicable for GDAL images only. More...
 
int Height [get]
 Gets the height of the image in pixels. More...
 
float Hue [get, set]
 Gets or sets the hue of the image. More...
 
bool IgnoreColorTable [get, set]
 Gets or sets a value indicating whether built-in color table of the image will be ignored. More...
 
PredefinedColorScheme ImageColorScheme [get, set]
 Gets or sets the predefined color scheme for the image. Applicable for GDAL images only. More...
 
ImageType ImageType [get]
 Gets the image object's image type. More...
 
bool IsEmpty [get]
 Returns true if image object is empty, i.e. not bound to some disk-based datasource and doesn't hold any in-memory data. This property is the same as checking Image.SourceType = istUninitialized. More...
 
bool IsGridProxy [get]
 Gets the value which indicates whether an image object represents a visualization proxy for another datasource. More...
 
bool IsInRam [get]
 Returns true when the image is loaded in RAM memory, and returns false when the image is not loaded in RAM memory. More...
 
bool IsRgb [get]
 Returns true if the datasource represents RGB image. More...
 
string Key [get, set]
 The key may be used by the programmer to store any string data associated with the object. More...
 
Labels Labels [get, set]
 Gets or sets instance of the labels class associated with the image. More...
 
int LastErrorCode [get]
 Retrieves the last error generated in the object. More...
 
int NoBands [get]
 Returns the number of bands of GDAL image. More...
 
int NumOverviews [get]
 Returns the number of overviews for GDAL image. More...
 
double OriginalDX [get, set]
 Gets or sets the number of map units per image pixel for x axis. More...
 
double OriginalDY [get, set]
 Gets or sets the number of map units per image pixel for y axis. More...
 
int OriginalHeight [get]
 Gets the height of the image. More...
 
int OriginalWidth [get]
 Gets the width of the image. More...
 
double OriginalXllCenter [get, set]
 Gets or sets the x coordinate of the center of lower left pixel of the image in map units. More...
 
double OriginalYllCenter [get, set]
 Gets or sets the y coordinate of the center of lower left pixel of the image in map units. More...
 
string PaletteInterpretation [get]
 Gets the type of palette interpretation. Applicable for GDAL images only. More...
 
tkPaletteInterpretation PaletteInterpretation2 [get]
 Gets the palette interpretation for the image. More...
 
stdole.IPictureDisp Picture [get, set]
 Gets or sets the picture object. More...
 
int RedBandIndex [get, set]
 Gets or sets the index of the red band (used when RGB rendering is chosen). More...
 
tkRasterRendering RenderingMode [get]
 Gets the current rendering mode for the image (depends on the values of other properties). More...
 
bool ReverseGreyscale [get, set]
 Gets or sets a value indicating whether colors should be reversed during gray scale rendering (i.e. the smallest values are white). More...
 
float Saturation [get, set]
 Gets or sets the saturation of the image. More...
 
bool SetToGrey [get, set]
 A boolean value which indicates whether an image will be displayed using a gray palette. More...
 
string SourceFilename [get]
 Returns the filename of the datasource for an image. More...
 
int SourceGridBandIndex [get, set]
 Gets or sets index of band within datasource whose values should be used to apply color scheme. More...
 
string SourceGridName [get]
 Gets the name of the source grid in case the image represent a visualization proxy for a grid. More...
 
tkImageSourceType SourceType [get]
 The source type of the image. More...
 
uint TransparencyColor [get, set]
 Gets or sets a color which is used as the transparency color for the image. More...
 
uint TransparencyColor2 [get, set]
 Gets or sets a second color which is used as the transparency color for the image. More...
 
double TransparencyPercent [get, set]
 Gets or sets the value which define alpha component of image colors (0.0-1.0). More...
 
tkInterpolationMode UpsamplingMode [get, set]
 The interpolation mode for images which are displayed with the resolution lower than original, i.e. after zooming out (up). More...
 
bool UseActiveBandAsAlpha [get, set]
 Gets or sets a value indicating whether to use active band as an alpha band as well. More...
 
bool UseHistogram [get, set]
 Gets or sets a boolean value which indicates whether a histogram will be used. Applicable for GDAL images only. More...
 
bool UseRgbBandMapping [get, set]
 Gets or sets a value indicating whether RGB band mapping will be used. More...
 
bool UseTransparencyColor [get, set]
 Gets or sets whether or not the transparency color is being used when the image is displayed. More...
 
bool Warped [get]
 Returns true if the image is warped, i.e. there are rotation parameters in world file. More...
 
int Width [get]
 Gets the width of the image in pixels. More...
 
double XllCenter [get, set]
 Gets or sets the x coordinate of the center of the lower-left pixel in the image. More...
 
double YllCenter [get, set]
 Gets or sets the y coordinate of the center of the lower-left pixel in the image. More...
 

Detailed Description

Represents an raster image of particular format which may be added to the map.

dot_inline_dotgraph_43.png

Graph description

Here is a diagram with groups of API members for Image class.

dot_imagegroups.png
Graph description

Types of image handling.

The class is a wrapper for several representation of images used internally:

  1. In-RAM images created with Image.CreateNew method and not bound to any file;
  • data for each pixel is stored in the memory as R, G, B bytes; no semitransparency is stored;
  • can be edited and saved in several formats with Image.Save() method.
  1. Disk-based images handled by MapWinGIS own driver;
  • available for BMP format only;
  • support editing with immediate saving to the source file.
  1. GDAL-based images:
  • data is accessed by GDAL drivers;
  • suitable for rendering very large images especially when overviews are preliminary created (Image.BuildOverviews);
  • before each redraw the requested part of image is read into memory buffer;
  • doesn't support editing of data (values in memory buffer can be changed with Image.set_Value but these changes can't be saved to disk).

Inner representation of image can be determined via Image.SourceType property. Some properties and methods are applicable to the GDAL images only.

Examples
AddLayers.cs, ImageLabels.cs, MarkPoints.cs, PointIcons.cs, SortLayers.cs, and TrackCars.cs.