ColorBuffer

expect abstract class ColorBuffer : AutoCloseable(source)
actual abstract class ColorBuffer : AutoCloseable(source)
actual abstract class ColorBuffer : AutoCloseable(source)

representation for simple images stored on GPU memory

ColorBuffer is an unmanaged GPU resource, the user is responsible for destroying a ColorBuffer once it is no longer used.

Constructors

Link copied to clipboard
constructor()
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
expect abstract fun bind(unit: Int)

bind the colorbuffer to a texture unit, internal API

actual abstract fun bind(unit: Int)

bind the colorbuffer to a texture unit, internal API

actual abstract fun bind(unit: Int)

bind the colorbuffer to a texture unit, internal API

Link copied to clipboard
fun bufferSize(level: Int = 0): Long

return the buffer size in bytes

close
Link copied to clipboard
expect abstract fun close()
abstract fun close()
abstract fun close()
Link copied to clipboard
expect abstract fun copyTo(target: ArrayTexture, layer: Int, fromLevel: Int = 0, toLevel: Int = 0)

copies contents to a target array texture

expect abstract fun copyTo(target: ColorBuffer, fromLevel: Int = 0, toLevel: Int = 0, filter: MagnifyingFilter = MagnifyingFilter.NEAREST)
expect abstract fun copyTo(target: ColorBuffer, fromLevel: Int = 0, toLevel: Int = 0, sourceRectangle: IntRectangle, targetRectangle: IntRectangle, filter: MagnifyingFilter = MagnifyingFilter.NEAREST)
actual abstract fun copyTo(target: ArrayTexture, layer: Int, fromLevel: Int, toLevel: Int)

copies contents to a target array texture

actual abstract fun copyTo(target: ColorBuffer, fromLevel: Int, toLevel: Int, filter: MagnifyingFilter)
actual abstract fun copyTo(target: ColorBuffer, fromLevel: Int, toLevel: Int, sourceRectangle: IntRectangle, targetRectangle: IntRectangle, filter: MagnifyingFilter)
actual abstract fun copyTo(target: ArrayTexture, layer: Int, fromLevel: Int, toLevel: Int)
actual abstract fun copyTo(target: ColorBuffer, fromLevel: Int, toLevel: Int, filter: MagnifyingFilter)
actual abstract fun copyTo(target: ColorBuffer, fromLevel: Int, toLevel: Int, sourceRectangle: IntRectangle, targetRectangle: IntRectangle, filter: MagnifyingFilter)

copies contents to a target color buffer

Link copied to clipboard
fun ColorBuffer.createEquivalent(width: Int = this.width, height: Int = this.height, contentScale: Double = this.contentScale, format: ColorFormat = this.format, type: ColorType = this.type, multisample: BufferMultisample = this.multisample, levels: Int = this.levels): ColorBuffer

create an equivalent ColorBuffer, with the option to override attributes

Link copied to clipboard
fun crop(sourceRectangle: IntRectangle): ColorBuffer

create a cropped copy of the ColorBuffer

Link copied to clipboard
expect abstract fun destroy()

permanently destroy the underlying ColorBuffer resources, ColorBuffer can not be used after it is destroyed

actual abstract fun destroy()

permanently destroy the underlying ColorBuffer resources, ColorBuffer can not be used after it is destroyed

actual abstract fun destroy()

permanently destroy the underlying ColorBuffer resources, ColorBuffer can not be used after it is destroyed

Link copied to clipboard
expect abstract fun fill(color: ColorRGBa, level: Int = 0)

sets all pixels in the color buffer to color

actual abstract fun fill(color: ColorRGBa, level: Int)

sets all pixels in the color buffer to color

actual abstract fun fill(color: ColorRGBa, level: Int)
Link copied to clipboard
expect abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)
actual abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)
actual abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)

sets the ColorBuffer filter for minifying and magnification

Link copied to clipboard
expect abstract fun generateMipmaps()

generates mipmaps from the top-level mipmap

actual abstract fun generateMipmaps()

generates mipmaps from the top-level mipmap

actual abstract fun generateMipmaps()

generates mipmaps from the top-level mipmap

Link copied to clipboard
Link copied to clipboard
fun ColorBuffer.isEquivalentTo(other: ColorBuffer, ignoreWidth: Boolean = false, ignoreHeight: Boolean = false, ignoreContentScale: Boolean = false, ignoreFormat: Boolean = false, ignoreType: Boolean = false, ignoreMultisample: Boolean = false, ignoreLevels: Boolean = false): Boolean

check if this ColorBuffer is equivalent to other

Link copied to clipboard
abstract fun read(target: ArrayBufferView, x: Int, y: Int, width: Int = this.effectiveWidth, height: Int = this.effectiveHeight, level: Int = 0)
abstract fun read(targetBuffer: ByteBuffer, targetFormat: ColorFormat = format, targetType: ColorType = type, level: Int = 0)

read the contents of the ColorBuffer and write to targetBuffer, potentially with format and type conversions

Link copied to clipboard
abstract fun saveToFile(file: File, imageFileFormat: ImageFileFormat = ImageFileFormat.guessFromExtension(file.extension) ?: ImageFileFormat.PNG, async: Boolean = true)

save the ColorBuffer to File

Link copied to clipboard
abstract fun toDataUrl(imageFileFormat: ImageFileFormat = ImageFileFormat.JPG): String

return a base64 data url representation

Link copied to clipboard
expect abstract fun write(sourceBuffer: MPPBuffer, sourceFormat: ColorFormat = format, sourceType: ColorType = type, x: Int = 0, y: Int = 0, width: Int = effectiveWidth, height: Int = effectiveHeight, level: Int = 0)

write the contents from sourceBuffer to the ColorBuffer, potentially with format and type conversions

abstract fun write(source: TexImageSource, x: Int = 0, y: Int = 0, width: Int = this.effectiveWidth, height: Int = this.effectiveHeight, level: Int = 0)
abstract fun write(source: ArrayBufferView, sourceFormat: ColorFormat, sourceType: ColorType, x: Int = 0, y: Int = 0, width: Int = this.effectiveWidth, height: Int = this.effectiveHeight, level: Int = 0)
actual abstract fun write(sourceBuffer: MPPBuffer, sourceFormat: ColorFormat, sourceType: ColorType, x: Int, y: Int, width: Int, height: Int, level: Int)
abstract fun write(sourceBuffer: ByteBuffer, sourceFormat: ColorFormat = format, sourceType: ColorType = type, level: Int = 0)
actual abstract fun write(sourceBuffer: MPPBuffer, sourceFormat: ColorFormat, sourceType: ColorType, x: Int, y: Int, width: Int, height: Int, level: Int)

Properties

Link copied to clipboard
expect abstract var anisotropy: Double

the (unitless?) degree of anisotropy to be used in filtering

actual abstract var anisotropy: Double

the (unitless?) degree of anisotropy to be used in filtering

actual abstract var anisotropy: Double

the (unitless?) degree of anisotropy to be used in filtering

Link copied to clipboard
expect val bounds: Rectangle
actual val bounds: Rectangle
actual val bounds: Rectangle
Link copied to clipboard
expect abstract val contentScale: Double

the content scale of the ColorBuffer

actual abstract val contentScale: Double

the content scale of the ColorBuffer

actual abstract val contentScale: Double

the content scale of the ColorBuffer

Link copied to clipboard
expect val effectiveHeight: Int

the height of the ColorBuffer in pixels

actual val effectiveHeight: Int

the height of the ColorBuffer in pixels

actual val effectiveHeight: Int
Link copied to clipboard
expect val effectiveWidth: Int

the width of the ColorBuffer in pixels

actual val effectiveWidth: Int

the width of the ColorBuffer in pixels

actual val effectiveWidth: Int
Link copied to clipboard

the filter to use when display at sizes larger than the original

Link copied to clipboard

the filter to use when displaying at sizes smaller than the original

Link copied to clipboard
expect abstract var flipV: Boolean

should the v coordinate be flipped because the ColorBuffer contents are stored upside-down?

actual abstract var flipV: Boolean

should the v coordinate be flipped because the ColorBuffer contents are stored upside-down?

actual abstract var flipV: Boolean

should the v coordinate be flipped because the ColorBuffer contents are stored upside-down?

Link copied to clipboard
expect abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

actual abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

actual abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

Link copied to clipboard
expect abstract val height: Int

the height of the ColorBuffer in device units

actual abstract val height: Int

the height of the ColorBuffer in device units

actual abstract val height: Int

the height of the ColorBuffer in device units

Link copied to clipboard
expect abstract val levels: Int

the number of mipmap levels

actual abstract val levels: Int

the number of mipmap levels

actual abstract val levels: Int

the number of mipmap levels

Link copied to clipboard
expect abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

actual abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

actual abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

Link copied to clipboard
expect abstract val session: Session?
actual abstract val session: Session?

write the contents from sourceBuffer to the ColorBuffer, potentially with format and type conversions

actual abstract val session: Session?
Link copied to clipboard
Link copied to clipboard
expect abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

actual abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

actual abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

Link copied to clipboard
expect abstract val width: Int

the width of the ColorBuffer in device units

actual abstract val width: Int

the width of the ColorBuffer in device units

actual abstract val width: Int

the width of the ColorBuffer in device units

Link copied to clipboard
expect abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

actual abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

actual abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

Link copied to clipboard
expect abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

actual abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

actual abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction