Image

Description

abstract class Tinman.Terrain.Imaging.Image

Derived from

IImage

Extended by

CompositeImage abstract
FileBasedImage abstract

Abstract base class for IImage implementations.

Public / Constructors

Combine


[Pure]
public static method Combine → (7)

source in : IImage

The source channel image or null.

intensity in : IImage

The grayscale intensity channel image or null (see PixelChannel.Intensity).

red in : IImage

The red channel image or null (see PixelChannel.Red).

green in : IImage

The green channel image or null (see PixelChannel.Green).

blue in : IImage

The blue channel image or null (see PixelChannel.Blue).

alpha in : IImage

The alpha channel image or null (see PixelChannel.Alpha).

voidMask in : IImage

The void channel image or null (see PixelChannel.Void).

returns → IImage

The combined image or null if all given images are null.

Combines the given pixel channels into a new image.

The grayscale intensities of each channel image will be used as the channel value. The channels are filled in the parameter order, so truecolor channels will overwrite the grayscale intensities. The given source image will be used to fill in the missing channels.

Constant


[Pure]
public static method Constant → (3)

width in : int32

[>0]
The image width, in pixels.

height in : int32

[>0]
The image height, in pixels.

color in : int64

The uniform image color (see Colors).

returns → IImage

The constant image.

Creates an image that has an uniform color.

Encode​Normals


[Pure]
public static method EncodeNormals → (2)

normal in : IImage

[not-null]
The normal map image.

map opt : IImage = null

Optional grayscale map to encode.

returns → IImage

The normal map image.

Encodes a normal map image, assuming that all tangent-space normal vectors point upwards (i.e. the minimum blue channel value is 0.5).

The pixels of the given normal in map are interpreted as follows:

red  :[0..1] => X:[-1 .. +1]
green:[0..1] => Y:[-1 .. +1]
blue :[0..1] => Z:[-1 .. +1]

The vector (X,Y,Z) is then normalized to unit-length. The grayscale intensity I is computed from the pixel in map opt (if not null). The pixel P of the resulting image is then computed like this:

map == null :
  P.red   = X * 0.5 - 0.5
  P.green = Y * 0.5 - 0.5

map != null :
  P.red   = X * 0.5 - 0.5
  P.green = I
  P.blue  = Y * 0.5 - 0.5

File

4 overloads


[Pure]
public static method File1 → (3)

file in : string

[not-null]
The file path.

format opt : ImageFormat = null

The file format or null if not known.

canonical opt : bool = true

Use canonical form of file in (see Path.Canonical)? Defaults to true.

returns → IImage

The file image.

Reads the given image file.

IOException

If file in is not a valid path name.


[Pure]
public static method File2 → (3)

file in : Path

[not-null]
The file path.

format opt : ImageFormat = null

The file format or null if not known.

canonical opt : bool = true

Use canonical form of file in (see Path.Canonical)? Defaults to true.

returns → IImage

The file image.

Reads the given image file.


[Pure]
public static method File3 → (2)

file in : IFileData

[not-null]
The file data.

format opt : ImageFormat = null

The file format or null if not known.

returns → IImage

The file image.

Reads the given image file.


public static method File4 → (1)

data in : ColorBuffer

[not-null]
The pixel data.

returns → IImage

The file image.

Reads the given pixel data as an embedded PXB image file.

Grid


[Pure]
public static method Grid → (3)

columns in : int32

[>0]
The number of grid columns.

overlap in : int32

[>=0]
The overlap between adjacent grid cells, in pixels.

images in : IImage [ ]

[not-null]
The tile images.

returns → IImage

The grid image.

Creates an image that arranges a sequence of tile images in a grid.

A grid image defines a virtual canvas which is divided into a regular grid. An input tile image is placed into each cell of that grid. The resulting image contains the image data of the entire virtual canvas.

         col     col     col     col     col
          0       1       2       3       4
      +-------+-------+-------+-------+-------+
      |       |       |       |       |       |
row 0 |   0   |   1   |   2   |   3   |   4   |
      |       |       |       |       |       |
      +-------+-------+-------+-------+-------+
      |       |       |       |       |       |
row 1 |   5   |   6   |   7   |   8   |   9   |
      |       |       |       |       |       |
      +-------+-------+-------+-------+-------+
      |       |       |       |       |       |
row 2 |  10   |  11   |  12   |  13   |  14   |
      |       |       |       |       |       |
      +-------+-------+-------+-------+-------+

rows    := 3
columns := 5
# tiles := 15

The sequence in which the tile image have been added to the grid determines the grid cell in which each of them will be placed. Given the zero-based index i of a tile image in the sequence, the coordinates of its grid cell then are:

x := i % columns
y := i / columns

An optional overlap in value can be specified. This value depicts by how many pixels adjacent grid cells shall overlap. Overlap is usually required for tiled datasets where the first and last rows resp. columns of adjacent tiles contain the same pixels.

Procedural


[Pure]
public static method Procedural → (6)

function in : INoiseFunctionBase

[not-null]
The procedural function to use. Image pixels are generated differently, depending on the type of the function. See remarks for details.

width in : int32

[>0]
The image width, in pixels.

height opt : int32 = 0

[>=0]
The image height, in pixels. If 0, width in will be used.

transform opt : Mat3D = default(Mat3D)

The transformation matrix to use for obtaining input coordinates for function in based on the pixel coordinates, which are passed to Mat3D.Mul22 with w = 1. If equal to Mat3D.Zero, the following transformation will be used: C' = (C + 0.5) / S, where C is the input pixel X/Y coordinate, S is the image width/height and C' is the output coordinate for the noise function.

format opt : PixelFormat = PixelFormat.Default

The pixel format, see IImageInfo.PixelFormat.

layer opt : HeightmapLayer = HeightmapLayer.None

The heightmap layer, see IImageInfo.Layer.

returns → IImage

The procedural image.

Creates an image that is generated by a procedural function.

If function in is a IColorFunction, the image pixels will be set to the noise output value of the color function. If it is a IScalarFunction, the noise output value range [0..1] is mapped to normalized scanline values in the range [0..16777215], producing opaque grayscale intensities. If it is a IVectorFunction, the noise output vector is normalized and the resulting XYZ coordinate values in the range [-1..+1] are mapped to normalized scanline RGB values in the range [0..16777215], producing opaque colors.

Random


[Pure]
public static method Random → (4)

width in : int32

[>0]
The image width, in pixels.

height in : int32

[>0]
The image height, in pixels.

voidPercent opt : int32 = 0

[0..100]
The amount of void pixels, in percent.

seed opt : int32 = 0

Random seed value. Same seeds will produce same images.

returns → IImage

The random image.

Creates an image with random pixels.

Raw


[Pure]
public static method Raw → (6)

file in : IFileData

[not-null]
The file data provider.

width in : int32

[>0]
The image width, in pixels.

height in : int32

[>0]
The image height, in pixels.

layout in : SampleLayout

Data format of the pixel samples.

offset opt : int64 = 0

[>=0]
File offset to the first byte of the raw image data.

stride opt : int32 = 0

[>=0]
Distance between pixels in same column of adjacent scanlines, in bytes. If 0, the distance will be computed from width in and layout in.

returns → IImage

The raw image.

Reads image pixels from raw binary data.

Public / Methods

Streaming​Source

2 overloads


public static method StreamingSource1 → (1)

images in : IImage [ ]

[not-null]
The images to use as data frames.

returns → IStreamingSource<ColorBuffer>

The streaming source.

Creates a IStreamingSource for ColorBuffer data, using the given images.

See also

Streaming


public static method StreamingSource2 → (2)

count in : int32

[>0]
The number of data frames.

images in : ImageStreamingDelegate

[not-null]
The image provider.

returns → IStreamingSource<ColorBuffer>

The streaming source.

Creates a IStreamingSource for ColorBuffer data, using the given image provider.

See also

Streaming

Protected / Constructors

Image


protected constructor Image → ()

Creates a new instance of Image.

Protected / Methods

Do​Equals


protected abstract method DoEquals → (1)

other in : Image

The other image. Will never be null or the same as this.

returns → bool

true if this image and the given other in one are equal, false if they are different.

Compares this image with the given other in one.

Do​Read​Image


[OwnerReturn]
protected abstract method DoReadImage → (1)

flags in : ReadImageFlags

The flags to use.

returns → IImageReader

The IImageReader object.

Reads the image data.

IOException

If an I/O error has occurred.

ValidatingException

If validation of the resulting IImageReader has failed, for example because of an unsupported file format feature.

GeorefException

If the image contains unsupported geo-referencing metadata.

Do​To​Config


protected abstract method DoToConfig → ()

returns → ConfigValue

The config value.

Returns the config value for this image.

ConfigException

If an unexpected error has occurred while building the config value.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IImage>

[not-null]
The configurator object.

The configurator object for IImage values.