openrndr / org.openrndr.draw / ColorBuffer

ColorBuffer

interface ColorBuffer (source)

Color Buffer, a GPU resource

Properties

anisotropy

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

abstract var anisotropy: Double

bounds

open val bounds: Rectangle

contentScale

the content scale of the ColorBuffer

abstract val contentScale: Double

effectiveHeight

the height of the ColorBuffer in pixels

open val effectiveHeight: Int

effectiveWidth

the width of the ColorBuffer in pixels

open val effectiveWidth: Int

filterMag

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

abstract var filterMag: MagnifyingFilter

filterMin

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

abstract var filterMin: MinifyingFilter

flipV

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

abstract var flipV: Boolean

format

abstract val format: ColorFormat

height

the height of the ColorBuffer in device units

abstract val height: Int

levels

the number of mipmap levels

abstract val levels: Int

multisample

the multisampling method used for this ColorBuffer

abstract val multisample: BufferMultisample

session

abstract val session: Session?

shadow

abstract val shadow: ColorBufferShadow

type

abstract val type: ColorType

width

the width of the ColorBuffer in device units

abstract val width: Int

wrapU

the wrapping mode to use in the horizontal direction

abstract var wrapU: WrapMode

wrapV

the wrapping mode to use in the vertical direction

abstract var wrapV: WrapMode

Functions

bind

binds the colorbuffer to a texture unit, internal API

abstract fun bind(unit: Int): Unit

copyTo

copies contents to a target color buffer

abstract fun copyTo(target: ColorBuffer, fromLevel: Int = 0, toLevel: Int = 0): Unit

copies contents to a target array texture

abstract fun copyTo(target: ArrayTexture, layer: Int, fromLevel: Int = 0, toLevel: Int = 0): Unit

createEquivalent

Create an equivalent ColorBuffer, with the option to override attributes

open fun 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

destroy

destroys the underlying ColorBuffer resources

abstract fun destroy(): Unit

fill

sets every pixel in the color buffer to color

abstract fun fill(color: ColorRGBa): Unit

filter

sets the ColorBuffer filter for minifying and magnification

open fun filter(filterMin: MinifyingFilter, filterMag: MagnifyingFilter): Unit

generateMipmaps

generates mipmaps from the top-level mipmap

abstract fun generateMipmaps(): Unit

isEquivalentTo

Checks if this ColorBuffer is equivalent to other

open fun 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

read

abstract fun read(buffer: ByteBuffer, targetFormat: ColorFormat = format, targetType: ColorType = type, level: Int = 0): Unit

resolveTo

resolves contents to a non-multisampled color buffer

abstract fun resolveTo(target: ColorBuffer, fromLevel: Int = 0, toLevel: Int = 0): Unit

saveToFile

save the ColorBuffer to File

abstract fun saveToFile(file: File, imageFileFormat: ImageFileFormat = ImageFileFormat.guessFromExtension(file), async: Boolean = true): Unit

toDataUrl

returns a base64 data url representation

abstract fun toDataUrl(imageFileFormat: ImageFileFormat = ImageFileFormat.JPG): String

write

abstract fun write(buffer: ByteBuffer, sourceFormat: ColorFormat = format, sourceType: ColorType = type, level: Int = 0): Unit

Companion Object Functions

fromArray

fun fromArray(bytes: ByteArray, offset: Int = 0, length: Int = bytes.size, session: Session? = Session.active): ColorBuffer

fromBuffer

fun fromBuffer(bytes: ByteBuffer, session: Session? = Session.active): ColorBuffer

fromFile

fun fromFile(file: File, session: Session? = Session.active): ColorBuffer
fun fromFile(filename: String, session: Session? = Session.active): ColorBuffer

fromStream

fun fromStream(stream: InputStream, formatHint: String? = null, session: Session? = Session.active): ColorBuffer

fromUrl

fun fromUrl(url: String, session: Session? = Session.active): ColorBuffer

Extension Functions

imageBinding

fun ColorBuffer.imageBinding(level: Int = 0, imageAccess: ImageAccess): ColorBufferImageBinding