background() deprecated, replace with clear() (#101)
This commit is contained in:
@@ -34,7 +34,7 @@ class AxisHelper(var size: Int = 80) : Extension {
|
||||
drawer.defaults()
|
||||
drawer.ortho(fbo)
|
||||
|
||||
drawer.background(ColorRGBa.TRANSPARENT)
|
||||
drawer.clear(ColorRGBa.TRANSPARENT)
|
||||
drawer.stroke = null
|
||||
drawer.fill = ColorRGBa.PINK.opacify(0.7)
|
||||
drawer.circle(axisLength, axisLength, axisLength)
|
||||
|
||||
@@ -77,7 +77,7 @@ open class Layer internal constructor() {
|
||||
copyLayers.forEach {
|
||||
drawer.isolatedWithTarget(target) {
|
||||
clearColor?.let {
|
||||
drawer.background(it)
|
||||
drawer.clear(it)
|
||||
}
|
||||
|
||||
it.layerTarget?.let { copyTarget ->
|
||||
@@ -96,7 +96,7 @@ open class Layer internal constructor() {
|
||||
drawer.isolatedWithTarget(maskRt) {
|
||||
if (copyLayers.isEmpty()) {
|
||||
clearColor?.let { color ->
|
||||
drawer.background(color)
|
||||
drawer.clear(color)
|
||||
}
|
||||
}
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
@@ -109,7 +109,7 @@ open class Layer internal constructor() {
|
||||
drawer.isolatedWithTarget(target) {
|
||||
if (copyLayers.isEmpty()) {
|
||||
clearColor?.let {
|
||||
drawer.background(it)
|
||||
drawer.clear(it)
|
||||
}
|
||||
}
|
||||
drawFunc()
|
||||
@@ -182,7 +182,7 @@ open class Layer internal constructor() {
|
||||
}
|
||||
layerTarget?.let {
|
||||
drawer.withTarget(it) {
|
||||
drawer.background(ColorRGBa.TRANSPARENT)
|
||||
drawer.clear(ColorRGBa.TRANSPARENT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ fun <F : Filter> Program.extend(filter: F, configuration: F.() -> Unit = {}): Ex
|
||||
|
||||
renderTarget?.let {
|
||||
drawer.withTarget(it) {
|
||||
background(program.backgroundColor ?: ColorRGBa.TRANSPARENT)
|
||||
clear(program.backgroundColor ?: ColorRGBa.TRANSPARENT)
|
||||
}
|
||||
}
|
||||
}
|
||||
renderTarget?.bind()
|
||||
program.backgroundColor?.let {
|
||||
drawer.background(it)
|
||||
drawer.clear(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ fun main() = application {
|
||||
extend(gui)
|
||||
extend {
|
||||
when(settings.option) {
|
||||
BackgroundColors.Pink -> drawer.background(ColorRGBa.PINK)
|
||||
BackgroundColors.Black -> drawer.background(ColorRGBa.BLACK)
|
||||
BackgroundColors.Yellow -> drawer.background(ColorRGBa.YELLOW)
|
||||
BackgroundColors.Pink -> drawer.clear(ColorRGBa.PINK)
|
||||
BackgroundColors.Black -> drawer.clear(ColorRGBa.BLACK)
|
||||
BackgroundColors.Yellow -> drawer.clear(ColorRGBa.YELLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ fun main() {
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
sdf0.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
|
||||
@@ -39,7 +39,7 @@ fun main() {
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
fd.apply(emptyArray(), uvmap)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ fun main() {
|
||||
}
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
@@ -56,7 +56,7 @@ fun main() {
|
||||
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
perturb.offset = Vector2(cos(seconds*0.2), sin(seconds*0.2))
|
||||
perturb.outputUV = true
|
||||
|
||||
@@ -31,7 +31,7 @@ fun main() {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
|
||||
@@ -31,7 +31,7 @@ fun main() {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
|
||||
@@ -29,7 +29,7 @@ fun main() {
|
||||
eye = Vector3(1.0, 1.0, 1.0)
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
x_fill = texture(p_texture, va_texCoord0.xy);
|
||||
|
||||
@@ -33,7 +33,7 @@ class NoClear : Extension {
|
||||
|
||||
renderTarget?.let {
|
||||
drawer.withTarget(it) {
|
||||
background(program.backgroundColor ?: ColorRGBa.TRANSPARENT)
|
||||
clear(program.backgroundColor ?: ColorRGBa.TRANSPARENT)
|
||||
backdrop?.invoke() // draw custom backdrop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ fun main() {
|
||||
val circlePoints = points.map { Circle(Vector2(350.0, 100.0) + it, 3.0) }
|
||||
|
||||
extend {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
|
||||
drawer.stroke = null
|
||||
drawer.fill = ColorRGBa.PINK
|
||||
|
||||
@@ -73,7 +73,7 @@ fun main() = application {
|
||||
}
|
||||
extend(cm)
|
||||
extend {
|
||||
drawer.background(0.2, 0.18, 0.16, 1.0)
|
||||
drawer.clear(0.2, 0.18, 0.16, 1.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,7 @@ class ControlManager : Extension {
|
||||
}
|
||||
|
||||
renderTarget.bind()
|
||||
program.drawer.background(ColorRGBa.BLACK.opacify(0.0))
|
||||
program.drawer.clear(ColorRGBa.BLACK.opacify(0.0))
|
||||
renderTarget.unbind()
|
||||
|
||||
renderTargetCache.forEach { (_, u) -> u.destroy() }
|
||||
@@ -422,7 +422,7 @@ class ControlManager : Extension {
|
||||
}
|
||||
|
||||
rt.bind()
|
||||
drawer.background(ColorRGBa.BLACK.opacify(0.0))
|
||||
drawer.clear(ColorRGBa.BLACK.opacify(0.0))
|
||||
|
||||
drawer.pushProjection()
|
||||
drawer.ortho(rt)
|
||||
@@ -486,7 +486,7 @@ class ControlManager : Extension {
|
||||
}
|
||||
|
||||
renderTarget.bind()
|
||||
program.drawer.background(ColorRGBa.BLACK.opacify(0.0))
|
||||
program.drawer.clear(ColorRGBa.BLACK.opacify(0.0))
|
||||
renderTarget.unbind()
|
||||
}
|
||||
}
|
||||
@@ -507,7 +507,7 @@ class ControlManager : Extension {
|
||||
body?.style?.height = program.height.px
|
||||
|
||||
body?.let {
|
||||
program.drawer.background(ColorRGBa.BLACK.opacify(0.0))
|
||||
program.drawer.clear(ColorRGBa.BLACK.opacify(0.0))
|
||||
layouter.computeStyles(it)
|
||||
layouter.layout(it)
|
||||
drawElement(it, program.drawer, 0, 0)
|
||||
|
||||
@@ -32,7 +32,7 @@ class Canvas : Element(ElementType("canvas")) {
|
||||
drawer.isolatedWithTarget(rt) {
|
||||
model = Matrix44.IDENTITY
|
||||
view = Matrix44.IDENTITY
|
||||
background(ColorRGBa.TRANSPARENT)
|
||||
clear(ColorRGBa.TRANSPARENT)
|
||||
size(screenArea.width.toInt(), screenArea.height.toInt())
|
||||
ortho(rt)
|
||||
userDraw?.invoke(this)
|
||||
|
||||
@@ -56,7 +56,7 @@ fun main() = application {
|
||||
}
|
||||
extend(rabbit)
|
||||
extend {
|
||||
drawer.background(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK)
|
||||
drawer.clear(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK)
|
||||
drawer.fontMap = font
|
||||
drawer.fill = settings.fill
|
||||
drawer.stroke = settings.stroke
|
||||
|
||||
@@ -43,7 +43,7 @@ fun main() = application {
|
||||
}
|
||||
|
||||
extend {
|
||||
drawer.background(if (settings.whiteOnBlack) ColorRGBa.BLACK else ColorRGBa.WHITE)
|
||||
drawer.clear(if (settings.whiteOnBlack) ColorRGBa.BLACK else ColorRGBa.WHITE)
|
||||
drawer.fill = if (settings.whiteOnBlack) ColorRGBa.WHITE else ColorRGBa.BLACK
|
||||
drawer.circle(drawer.bounds.center, 250.0)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ fun main() = application {
|
||||
val alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
extend {
|
||||
drawer.isolatedWithTarget(rt) {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.ortho(rt)
|
||||
val it = seconds.toInt()
|
||||
val t = seconds-it
|
||||
|
||||
@@ -24,7 +24,7 @@ fun main() = application {
|
||||
|
||||
drawer.isolatedWithTarget(rt) {
|
||||
drawer.ortho(rt)
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.image(startImage, (rt.width - startImage.width)/2.0, (rt.height - startImage.height) / 2.0)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ fun main() = application {
|
||||
|
||||
program {
|
||||
val runwayHost = "http://localhost:8000/query"
|
||||
val dictionary = URL(resourceUrl("/data/dictionary/words.txt")).readText().split("\n")
|
||||
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 72.0)
|
||||
val dictionary = URL("demo-data/dictionary/words.txt").readText().split("\n")
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 72.0)
|
||||
extend {
|
||||
val text = dictionary.random()
|
||||
val result: AttnGANResult = runwayQuery(runwayHost, AttnGANRequest(text))
|
||||
|
||||
@@ -22,7 +22,7 @@ fun main() = application {
|
||||
|
||||
drawer.isolatedWithTarget(rt) {
|
||||
drawer.ortho(rt)
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.image(startImage, (rt.width - startImage.width)/2.0, (rt.height - startImage.height) / 2.0)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ fun main() = application {
|
||||
|
||||
extend(syphonClient)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.image(syphonClient.buffer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ fun main() = application {
|
||||
|
||||
extend(syphonClient)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.image(syphonClient.buffer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ fun main() = application {
|
||||
extend(SyphonServer("Test"))
|
||||
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5)
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ fun main() = application {
|
||||
* This is what will be sent to Syphon, and drawn in a small corner of the screen
|
||||
*/
|
||||
drawer.isolatedWithTarget(rt) {
|
||||
drawer.background(ColorRGBa(sin(seconds), cos(seconds / 2.0), 0.5, 1.0))
|
||||
drawer.clear(ColorRGBa(sin(seconds), cos(seconds / 2.0), 0.5, 1.0))
|
||||
}
|
||||
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5)
|
||||
drawer.image(rt.colorBuffer(0))
|
||||
|
||||
@@ -124,7 +124,7 @@ class TemporalBlur : Extension {
|
||||
|
||||
accumulator?.let {
|
||||
drawer.withTarget(it) {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
}
|
||||
}
|
||||
val oldClock = program.clock
|
||||
@@ -133,7 +133,7 @@ class TemporalBlur : Extension {
|
||||
for (i in samples - 1 downTo 1) {
|
||||
image?.bind()
|
||||
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
program.clock = { oldClockValue - (i * duration) / (fps * samples) }
|
||||
|
||||
// I guess we need something better here.
|
||||
@@ -169,7 +169,7 @@ class TemporalBlur : Extension {
|
||||
}
|
||||
image?.let {
|
||||
drawer.withTarget(it) {
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
}
|
||||
}
|
||||
image?.bind()
|
||||
@@ -191,7 +191,7 @@ class TemporalBlur : Extension {
|
||||
drawer.isolatedWithTarget(result!!) {
|
||||
drawer.drawStyle.blendMode = BlendMode.OVER
|
||||
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(1.0 / samples))
|
||||
drawer.image(accumulator!!.colorBuffer(0))
|
||||
}
|
||||
@@ -202,7 +202,7 @@ class TemporalBlur : Extension {
|
||||
drawer.drawStyle.colorMatrix = Matrix55.IDENTITY
|
||||
drawer.drawStyle.depthTestPass = DepthTestPass.ALWAYS
|
||||
|
||||
drawer.background(ColorRGBa.BLACK)
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.image(result!!.colorBuffer(0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ fun main() = application {
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
// -- by explicitly calling deliver we know that the drawing code in the listener will be
|
||||
// -- executed exactly here
|
||||
event.deliver()
|
||||
|
||||
Reference in New Issue
Block a user