Skip to content

GeoImage

Namespace: ThinkGeo.Core

public class GeoImage : System.IDisposable

Inheritance objectGeoImage
Implements IDisposable

Properties

PathFilename

Gets the path filename.

public string PathFilename { get; }

Property Value

string

        The path filename.

Opacity

Gets or sets the opacity.

public float Opacity { get; set; }

Property Value

float

        The opacity.

Width

Gets the width.

public int Width { get; }

Property Value

int

        The width.

Height

Gets the height.

public int Height { get; }

Property Value

int

        The height.

NativeImage

Gets or sets the NativeImage.

public SKBitmap NativeImage { get; }

Property Value

SKBitmap

Constructors

GeoImage()

Initializes a new instance of the GeoImage class.

public GeoImage()

GeoImage(int, int)

Initializes a new instance of the GeoImage class.

public GeoImage(int width, int height)

Parameters

width int
The width.

height int
The height.

GeoImage(Stream)

Initializes a new instance of the GeoImage class.

public GeoImage(Stream stream)

Parameters

stream Stream
The stream.

GeoImage(string)

Initializes a new instance of the GeoImage class.

public GeoImage(string pathFilename)

Parameters

pathFilename string
The path filename.

GeoImage(Byte[])

Initializes a new instance of the GeoImage class.

public GeoImage(Byte[] bytes)

Parameters

bytes Byte[]
The bytes.

GeoImage(SKBitmap)

Initializes a new instance of the GeoImage class.

public GeoImage(SKBitmap skBitmap)

Parameters

skBitmap SKBitmap
A SKBitmap object, it's an cross-platform bitmap object from SKIA-Sharp

Methods

CreateCustomizedImage(int, int, GeoColorType, GeoAlphaType)

Creates the customized image.

public static GeoImage CreateCustomizedImage(int width, int height, GeoColorType colorType, GeoAlphaType alphaType)

Parameters

width int
The width.

height int
The height.

colorType GeoColorType
Type of the color.

alphaType GeoAlphaType
Type of the alpha.

Returns

GeoImage

GetImageBytes(GeoImageFormat, int)

Gets the image bytes.

public Byte[] GetImageBytes(GeoImageFormat imageFormat, int imageQuality)

Parameters

imageFormat GeoImageFormat
The image format.

imageQuality int
The image quality.

Returns

Byte[]

ToBytesArray()

Converts this instance to a byte array.

public Byte[] ToBytesArray()

Returns

Byte[]
A byte array containing the requested data.

GetImageStream(GeoImageFormat, int)

Gets the image stream.

public Stream GetImageStream(GeoImageFormat imageFormat, int imageQuality)

Parameters

imageFormat GeoImageFormat
The image format.

imageQuality int
The image quality.

Returns

Stream

Save(Stream, GeoImageFormat, int)

Saves the specified stream.

public void Save(Stream stream, GeoImageFormat imageFormat, int quality)

Parameters

stream Stream
The stream.

imageFormat GeoImageFormat
The image format.

quality int
The quality.

Returns

void

Save(string, GeoImageFormat, int)

Saves the specified file path.

public void Save(string filePath, GeoImageFormat imageFormat, int quality)

Parameters

filePath string
The file path.

imageFormat GeoImageFormat
The image format.

quality int
The quality.

Returns

void

Dispose()

This method implements the IDispose method. This method is the concrete wrapper for the abstract method DisposeCore.

public void Dispose()

Returns

void

Finalize()

Finalizer of this tile object.

protected void Finalize()

Returns

void

Dispose(bool)

This method disposes all the unmanaged resource in the tile.

protected void Dispose(bool disposing)

Parameters

disposing bool

Returns

void

Remarks:

When implementing this method, consider the stop the background threading when drawing asynchronously.

Clear(GeoColor)

Clears the specified color.

public void Clear(GeoColor color)

Parameters

color GeoColor
The color.

Returns

void

SetPixels(GeoColor[])

Sets the pixels.

public void SetPixels(GeoColor[] pixels)

Parameters

pixels GeoColor[]
The pixels.

Returns

void

GetIntPtr()

Gets the pixels.

public IntPtr GetIntPtr()

Returns

IntPtr

TryGetBgra32Pixels(Byte[]&, Int32&, Int32&, Int32&)

Attempts to copy the current image pixels into a BGRA32 byte snapshot.

public bool TryGetBgra32Pixels(Byte[]& pixels, Int32& width, Int32& height, Int32& stride)

Parameters

pixels Byte[]&
When this method returns true, contains a BGRA32 pixel snapshot.

width Int32&
The bitmap width.

height Int32&
The bitmap height.

stride Int32&
The destination stride (bytes per row).

Returns

bool
True if pixel data could be copied; otherwise, false.

Scale(int, int)

Scales the specified width.

public GeoImage Scale(int targetWidth, int targetHeight)

Parameters

targetWidth int
The width.

targetHeight int
The height.

Returns

GeoImage

TxU=(int, int, SKSamplingOptions)

internal GeoImage TxU=(int targetWidth, int targetHeight, SKSamplingOptions samplingOptions)

Parameters

targetWidth int

targetHeight int

samplingOptions SKSamplingOptions

Returns

GeoImage

Crop(DrawingRectangle)

Cuts the specified source rect.

public GeoImage Crop(DrawingRectangle srcRect)

Parameters

srcRect DrawingRectangle
The source rect.

Returns

GeoImage

Clip(DrawingRectangle, int, int)

Performs clip.

public GeoImage Clip(DrawingRectangle clippingRectangle, int clippingWidth, int clippingHeight)

Parameters

clippingRectangle DrawingRectangle
The rectangle that defines the area of interest.

clippingWidth int
The clipping width.

clippingHeight int
The clipping height.

Returns

GeoImage
The result of the operation.

DrawImage(GeoImage, float, float)

Combines the images.

public void DrawImage(GeoImage geoImage, float pointX, float pointY)

Parameters

geoImage GeoImage

pointX float

pointY float

Returns

void

DrawText(string, GeoFont, GeoBrush, ScreenPointF[], float)

Appends the text.

public void DrawText(string text, GeoFont font, GeoBrush fillBrush, ScreenPointF[] points, float scaleFactor)

Parameters

text string
The text.

font GeoFont
The font.

fillBrush GeoBrush
The fill brush.

points ScreenPointF[]
The points.

scaleFactor float
Specifies the scaleFactor.

Returns

void

HasCpuPixelData()

Determines whether the underlying SKBitmap has its pixel data laid out in a contiguous CPU‐accessible buffer in RGBA or BGRA format.

public bool HasCpuPixelData()

Returns

bool

UBU=(bool, bool, float, float, float, float)

internal GeoImage UBU=(bool isGrayscale, bool isNegative, float transparency, float redTranslation, float greenTranslation, float blueTranslation)

Parameters

isGrayscale bool

isNegative bool

transparency float

redTranslation float

greenTranslation float

blueTranslation float

Returns

GeoImage

URU=(Dictionary<GeoColor, GeoColor>)

internal GeoImage URU=(Dictionary<GeoColor, GeoColor> colorMappings)

Parameters

colorMappings Dictionary<GeoColor, GeoColor>

Returns

GeoImage

VRU=(SKBitmap&)

internal bool VRU=(SKBitmap& leasedBitmap)

Parameters

leasedBitmap SKBitmap&

Returns

bool

VhU=()

internal void VhU=()

Returns

void

UseNativeBitmap(Action<SKBitmap>)

Executes while safely leasing the underlying bitmap within the callback scope.

public void UseNativeBitmap(Action<SKBitmap> action)

Parameters

action Action<SKBitmap>
The callback that receives the leased . The callback must not cache or dispose the bitmap.

Returns

void

UseNativeBitmap<T>(Func<SKBitmap, T>)

Executes while safely leasing the underlying bitmap within the callback scope.

public T UseNativeBitmap<T>(Func<SKBitmap, T> func)

Type Parameters

T
The result type returned by .

Parameters

func Func<SKBitmap, T>
The callback that receives the leased and returns a value. The callback must not cache or dispose the bitmap.

Returns

T
The value returned by , or default when the bitmap is unavailable.