ColorBuffer

actual abstract class ColorBuffer : Texture, 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.

expect abstract class ColorBuffer : Texture, AutoCloseable(source)

Represents a color buffer, which is an abstract resource used for storing image data and managing operations like mipmapping, filtering, and copying of image data. A ColorBuffer can be used in various scenarios such as rendering to textures or managing image storage in graphics applications.

actual abstract class ColorBuffer : Texture, AutoCloseable(source)

Constructors

Link copied to clipboard
constructor()
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
actual abstract var anisotropy: Double

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

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

Link copied to clipboard
actual val bounds: Rectangle
expect val bounds: Rectangle

Defines the rectangular bounds of this ColorBuffer. The bounds typically represent the width and height.

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

the content scale of the ColorBuffer

expect 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
actual val effectiveHeight: Int
expect val effectiveHeight: Int

the height of the ColorBuffer in pixels

actual val effectiveHeight: Int

the height of the ColorBuffer in pixels

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

the width of the ColorBuffer in pixels

actual val effectiveWidth: Int

the width of the ColorBuffer in pixels

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
actual abstract var flipV: Boolean

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

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?

Link copied to clipboard
actual abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

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

Link copied to clipboard
actual abstract val height: Int

the height of the ColorBuffer in device units

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

Link copied to clipboard
actual abstract val levels: Int

the number of mipmap levels

expect abstract val levels: Int

the number of mipmap levels

actual abstract val levels: Int

the number of mipmap levels

Link copied to clipboard
actual abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

expect 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
actual abstract val session: Session?
expect abstract val session: Session?
actual abstract val session: Session?

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

Link copied to clipboard
Link copied to clipboard
actual abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

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

Link copied to clipboard
actual abstract val width: Int

the width of the ColorBuffer in device units

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

Link copied to clipboard
actual abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

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

Link copied to clipboard
actual abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

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

Functions

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

return the buffer size in bytes

close
Link copied to clipboard
abstract fun close()
expect abstract fun close()
expect abstract fun close()
Link copied to clipboard
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: ERROR CLASS: Symbol not found for IntRectangle, targetRectangle: ERROR CLASS: Symbol not found for IntRectangle, filter: MagnifyingFilter)

copies contents to a target color buffer

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)
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: ERROR CLASS: Symbol not found for IntRectangle): ColorBuffer

create a cropped copy of the ColorBuffer

Link copied to clipboard
actual abstract fun destroy()

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

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

Link copied to clipboard
Link copied to clipboard
actual abstract fun fill(color: ERROR CLASS: Symbol not found for ColorRGBa, level: Int)
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

Link copied to clipboard
actual abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)

sets the ColorBuffer filter for minifying and magnification

expect abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)
actual abstract fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter)
Link copied to clipboard
actual abstract fun generateMipmaps()

generates mipmaps from the top-level mipmap

expect 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(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

abstract fun read(target: ArrayBufferView<ArrayBufferLike>, x: Int, y: Int, width: Int = this.effectiveWidth, height: Int = this.effectiveHeight, level: Int = 0)
Link copied to clipboard
fun saveToFile(file: File, async: Boolean = true, configurator: ImageSaveContext.() -> ImageSaveConfiguration)
abstract fun saveToFile(file: File, async: Boolean = true, configuration: ImageSaveConfiguration)
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
abstract fun write(sourceBuffer: ByteBuffer, sourceFormat: ColorFormat = format, sourceType: ColorType = type, level: Int = 0)
actual abstract fun write(sourceBuffer: ERROR CLASS: Symbol not found for MPPBuffer, sourceFormat: ColorFormat, sourceType: ColorType, x: Int, y: Int, width: Int, height: Int, level: Int)
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<ArrayBufferLike>, 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)