ImageLoadHandler

TheArtOfDev.HtmlRenderer.Core.Handlers

Handler for all loading image logic. Loading by HtmlImageLoadEventArgs. Loading by file path. Loading by URI.

Implementiert: IDisposable

Konstruktoren

ImageLoadHandler(HtmlContainerInt, ActionInt<RImage, RRect, bool>)

Init.

htmlContainer
the container of the html to handle load image for
loadCompleteCallback
callback raised when image load process is complete with image or without

Eigenschaften

Image : RImage

the image instance of the loaded image

Rectangle : RRect

the image rectangle restriction as returned from image load event

Methoden

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetImageFromData(string) : RImage

Extract image object from inline base64 encoded data in the src of the html img element.

src
the source that has the base64 encoded image

Rückgabe: image from base64 data string or null if failed

ImageLoadComplete(bool)

Flag image load complete and request refresh for re-layout and invalidate.

LoadImage(string, Dictionary<string, string>)

Set image of this image box by analyzing the src attribute. Load the image from inline base64 encoded string. Or from calling property/method on the bridge object that returns image or URL to image. Or from file path Or from URI.

src
the source of the image to load
attributes
the collection of attributes on the element to use in event

Rückgabe: the image object (null if failed)

LoadImageFromFile(byte[])

Load the image file on thread-pool thread and calling Boolean) after. Calling Boolean) on the main thread and not thread-pool.

body
the file path to get the image from
OnDownloadImageCompleted(Uri, byte[], Exception, bool)

On download image complete to local file use Byte[]) to load the image file. If the download canceled do nothing, if failed report error.

OnHtmlImageLoadEventCallback(string, ImageSource, RRect)

Set the image using callback from load image event, use the given data.

path
the path to the image to load (file path or uri)
image
the image to load
imageRectangle
optional: limit to specific rectangle of the image and not all of it
ReleaseObjects()

Release the image and client objects.

SetFromInlineData(string)

Load the image from inline base64 encoded string data.

src
the source that has the base64 encoded image
SetImageFromFile(FileInfo)

Load the image file on thread-pool thread and calling Boolean) after.

source
the file path to get the image from
SetImageFromPath(string)

Load image from path of image file or URL.

path
the file path or uri to load image from
SetImageFromUrl(Uri)

Load image from the given URI by downloading it. Create local file name in temp folder from the URI, if the file already exists use it as it has already been downloaded. If not download the file.

Felder

_asyncCallback : bool

to know if image load event callback was sync or async raised

_disposed : bool

is the handler has been disposed

_htmlContainer : HtmlContainerInt

the container of the html to handle load image for

_image : RImage

the image instance of the loaded image

_imageRectangle : RRect

the image rectangle restriction as returned from image load event

_loadCompleteCallback : ActionInt<RImage, RRect, bool>

callback raised when image load process is complete with image or without

_releaseImageObject : bool

flag to indicate if to release the image object on box dispose (only if image was loaded by the box)