Static variables

staticread onlymaxSize:Int

staticread onlynonPow2Supported:Bool

Static methods

@:value({ usage : null, format : null })staticcreate(width:Int, height:Int, ?format:TextureFormat, ?usage:Usage):Image

@:value({ usage : null, format : null })staticcreate3D(width:Int, height:Int, depth:Int, ?format:TextureFormat, ?usage:Usage):Image

@:value({ antiAliasingSamples : 1, depthStencil : DepthStencilFormat.NoDepthAndStencil, format : null })staticcreateRenderTarget(width:Int, height:Int, ?format:TextureFormat, depthStencil:DepthStencilFormat = DepthStencilFormat.NoDepthAndStencil, antiAliasingSamples:Int = 1):Image

@:value({ usage : null, format : null })staticfromBytes(bytes:Bytes, width:Int, height:Int, ?format:TextureFormat, ?usage:Usage):Image

@:value({ usage : null, format : null })staticfromBytes3D(bytes:Bytes, width:Int, height:Int, depth:Int, ?format:TextureFormat, ?usage:Usage):Image

Variables

read onlydepth:Int

read onlyg1:Graphics

read onlyg2:Graphics

read onlyg4:Graphics

read onlyheight:Int

Returns the original height of the image.

read onlyrealHeight:Int

Very old GPUs only supported power of two texture-heights. When an Image is created on such a GPU, Kha automatically increases its size to a power of two and realHeight returns this new, internal size. Knowing the real size is important for calculating texture-coordinates correctly but all of this is irrelevant unless you really want to support very very old GPUs.

read onlyrealWidth:Int

Very old GPUs only supported power of two texture-widths. When an Image is created on such a GPU, Kha automatically increases its size to a power of two and realWidth returns this new, internal size. Knowing the real size is important for calculating texture-coordinates correctly but all of this is irrelevant unless you really want to support very very old GPUs.

read onlystride:Int

read onlywidth:Int

Returns the original width of the image.

Methods

at(x:Int, y:Int):Color

Returns the color of a pixel identified by its x/y-coordinates. This only works for images for which the readable flag is set to true because by default images only exist in video-memory. To load images which are readable use a line ala project.addAssets('Assets/image.png', { readable: true }); in your khafile. For reading the content of render-targets use getPixels() instead.

clear(x:Int, y:Int, z:Int, width:Int, height:Int, depth:Int, color:Color):Void

generateMipmaps(levels:Int):Void

getPixels():Bytes

Returns the content of an image. This only works if the image is a render-target and it is very slow because data will be copied from video-memory to main-memory. This is useful for making screenshots but please avoid using it for regular rendering. For reading the content of images which are not render-targets use at() instead.

isOpaque(x:Int, y:Int):Bool

@:value({ level : 0 })lock(level:Int = 0):Bytes

Returns a writable Bytes object. Once unlock() is called the content of the Bytes object is written into the image. This can not be used to read the current content of an image - for this use at() or getPixels() instead.

setMipmaps(mipmaps:Array<Image>):Void

unload():Void

unlock():Void