ColorBuffer

abstract class ColorBuffer
abstract class ColorBuffer

representation for simple images stored on GPU memory

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

Constructors

ColorBuffer
Link copied to clipboard
fun ColorBuffer()

Types

Companion
Link copied to clipboard
object Companion

Functions

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

bind the colorbuffer to a texture unit, internal API

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

return the buffer size in bytes

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

copies contents to a target array texture

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

copies contents to a target color buffer

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

create a cropped copy of the ColorBuffer

destroy
Link copied to clipboard
common
abstract fun destroy()

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

fill
Link copied to clipboard
common
abstract fun fill(color: ColorRGBa)

sets all pixels in the color buffer to color

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

sets the ColorBuffer filter for minifying and magnification

generateMipmaps
Link copied to clipboard
common
abstract fun generateMipmaps()

generates mipmaps from the top-level mipmap

read
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

js
abstract fun read(target: ArrayBufferView, x: Int, y: Int, width: Int = this.effectiveWidth, height: Int = this.effectiveHeight, level: Int = 0)
saveToFile
Link copied to clipboard
abstract fun saveToFile(file: File, imageFileFormat: ImageFileFormat = ImageFileFormat.guessFromExtension(file.extension), async: Boolean = true)

save the ColorBuffer to File

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

return a base64 data url representation

write
Link copied to clipboard
abstract fun write(sourceBuffer: ByteBuffer, sourceFormat: ColorFormat = format, sourceType: ColorType = type, level: Int = 0)
abstract fun write(sourceBuffer: MPPBuffer, sourceFormat: ColorFormat, sourceType: ColorType, x: Int = 0, y: Int = 0, width: Int, height: Int, level: Int = 0)
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)
abstract fun write(sourceBuffer: MPPBuffer, sourceFormat: ColorFormat, sourceType: ColorType, x: Int = 0, y: Int = 0, width: Int, height: Int, level: Int = 0)

Properties

anisotropy
Link copied to clipboard
abstract var anisotropy: Double

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

abstract var anisotropy: Double

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

abstract var anisotropy: Double

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

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

the content scale of the ColorBuffer

abstract val contentScale: Double

the content scale of the ColorBuffer

abstract val contentScale: Double

the content scale of the ColorBuffer

effectiveHeight
Link copied to clipboard
val effectiveHeight: Int

the height of the ColorBuffer in pixels

val effectiveHeight: Int

the height of the ColorBuffer in pixels

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

the width of the ColorBuffer in pixels

val effectiveWidth: Int

the width of the ColorBuffer in pixels

val effectiveWidth: Int
filterMag
Link copied to clipboard
abstract var filterMag: MagnifyingFilter

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

filterMin
Link copied to clipboard
abstract var filterMin: MinifyingFilter

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

flipV
Link copied to clipboard
abstract var flipV: Boolean

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

abstract var flipV: Boolean

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

abstract var flipV: Boolean

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

format
Link copied to clipboard
abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

abstract val format: ColorFormat

the ColorFormat of the image stored in the ColorBuffer

height
Link copied to clipboard
abstract val height: Int

the height of the ColorBuffer in device units

abstract val height: Int

the height of the ColorBuffer in device units

abstract val height: Int

the height of the ColorBuffer in device units

levels
Link copied to clipboard
abstract val levels: Int

the number of mipmap levels

abstract val levels: Int

the number of mipmap levels

abstract val levels: Int

the number of mipmap levels

multisample
Link copied to clipboard
abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

abstract val multisample: BufferMultisample

the multisampling method used for this ColorBuffer

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

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

abstract val session: Session?
shadow
Link copied to clipboard
abstract val shadow: ColorBufferShadow
type
Link copied to clipboard
abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

abstract val type: ColorType

the ColorType of the image stored in the ColorBuffer

width
Link copied to clipboard
abstract val width: Int

the width of the ColorBuffer in device units

abstract val width: Int

the width of the ColorBuffer in device units

abstract val width: Int

the width of the ColorBuffer in device units

wrapU
Link copied to clipboard
abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

abstract var wrapU: WrapMode

the wrapping mode to use in the horizontal direction

wrapV
Link copied to clipboard
abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

abstract var wrapV: WrapMode

the wrapping mode to use in the vertical direction

Extensions

createEquivalent
Link copied to clipboard
common
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

imageBinding
Link copied to clipboard
common
fun ColorBuffer.imageBinding(level: Int = 0, imageAccess: ImageAccess): ColorBufferImageBinding
isEquivalentTo
Link copied to clipboard
common
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