Add screenshot generation
This commit is contained in:
42
orx-jumpflood/src/demo/kotlin/DemoShapeSDF01.kt
Normal file
42
orx-jumpflood/src/demo/kotlin/DemoShapeSDF01.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.transforms.transform
|
||||
import org.openrndr.shape.Circle
|
||||
import org.openrndr.svg.loadSVG
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf = ShapeSDF()
|
||||
val df = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape }
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
sdf.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280/2.0, 720.0/2)
|
||||
|
||||
translate(-1280/2.0, -720.0/2.0)
|
||||
})
|
||||
})
|
||||
sdf.apply(emptyArray(), df)
|
||||
drawer.image(df)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
orx-jumpflood/src/demo/kotlin/DemoShapeSDF02.kt
Normal file
70
orx-jumpflood/src/demo/kotlin/DemoShapeSDF02.kt
Normal file
@@ -0,0 +1,70 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
|
||||
import org.openrndr.extra.jumpfill.ops.*
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.transforms.transform
|
||||
import org.openrndr.svg.loadSVG
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val sdf1 = ShapeSDF()
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape }
|
||||
|
||||
val union = SDFSmoothIntersection()
|
||||
val onion = SDFOnion()
|
||||
|
||||
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
|
||||
sdf0.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
|
||||
sdf1.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
rotate(Vector3.Companion.UNIT_Z, seconds * 45.0)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
|
||||
sdf0.apply(emptyArray(), df0)
|
||||
sdf1.apply(emptyArray(), df1)
|
||||
union.radius = mouse.position.y
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
onion.radius = 20.0
|
||||
onion.apply(df0, df0)
|
||||
strokeFill.strokeWeight = 2.0
|
||||
strokeFill.apply(df0, df0);
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
orx-jumpflood/src/demo/kotlin/DemoShapeSDF03.kt
Normal file
74
orx-jumpflood/src/demo/kotlin/DemoShapeSDF03.kt
Normal file
@@ -0,0 +1,74 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.distort.FluidDistort
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
|
||||
import org.openrndr.extra.jumpfill.ops.*
|
||||
import org.openrndr.ffmpeg.ScreenRecorder
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.transforms.transform
|
||||
import org.openrndr.svg.loadSVG
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val fd = FluidDistort()
|
||||
fd.outputUV = true
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape }
|
||||
val union = SDFSmoothDifference()
|
||||
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
|
||||
fd.apply(emptyArray(), uvmap)
|
||||
|
||||
sdf0.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
sdf1.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
union.radius = 10.0
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0);
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
80
orx-jumpflood/src/demo/kotlin/DemoShapeSDF04.kt
Normal file
80
orx-jumpflood/src/demo/kotlin/DemoShapeSDF04.kt
Normal file
@@ -0,0 +1,80 @@
|
||||
package sketches
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.distort.Perturb
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
|
||||
import org.openrndr.extra.jumpfill.ops.*
|
||||
import org.openrndr.math.transforms.transform
|
||||
import org.openrndr.shape.Circle
|
||||
import org.openrndr.svg.loadSVG
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val perturb = Perturb()
|
||||
perturb.outputUV = true
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape }
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
gui.add(perturb)
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
sdf0.setShapes(circleShapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
sdf1.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
difference.radius = 10.0
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0);
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
98
orx-jumpflood/src/demo/kotlin/DemoShapeSDF05.kt
Normal file
98
orx-jumpflood/src/demo/kotlin/DemoShapeSDF05.kt
Normal file
@@ -0,0 +1,98 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.distort.Perturb
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
|
||||
import org.openrndr.extra.jumpfill.ops.*
|
||||
import org.openrndr.ffmpeg.ScreenRecorder
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.transforms.transform
|
||||
import org.openrndr.shape.Circle
|
||||
import org.openrndr.svg.loadSVG
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val perturb = Perturb()
|
||||
|
||||
perturb.outputUV = true
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
val uvmap2 = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape }
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
sdf0.useUV = true
|
||||
gui.add(sdf0)
|
||||
gui.add(perturb)
|
||||
gui.add(strokeFill)
|
||||
gui.add(difference)
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
extend(ScreenRecorder()) {
|
||||
frameRate = 60
|
||||
}
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
|
||||
perturb.offset = Vector2(cos(seconds*0.2), sin(seconds*0.2))
|
||||
perturb.outputUV = true
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
perturb.offset = Vector2.ZERO
|
||||
perturb.outputUV = false
|
||||
perturb.phase = seconds * 0.05
|
||||
perturb.apply(uvmap, uvmap2)
|
||||
|
||||
sdf0.setShapes(circleShapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
sdf1.setShapes(shapes.mapIndexed { index, it ->
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
sdf0.apply(uvmap2, df0)
|
||||
sdf1.apply(uvmap2, df1)
|
||||
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.apply(df0, df0);
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package sketches
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorType
|
||||
|
||||
import org.openrndr.draw.isolatedWithTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.jumpfill.fx.Skeleton
|
||||
import org.openrndr.extra.jumpfill.fx.StraightSkeleton
|
||||
import org.openrndr.extra.noise.simplex
|
||||
@@ -23,6 +22,11 @@ fun main() {
|
||||
colorBuffer()
|
||||
}
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.openrndr.draw.ColorType
|
||||
|
||||
import org.openrndr.draw.isolatedWithTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.jumpfill.fx.StraightSkeleton
|
||||
import org.openrndr.extra.noise.simplex
|
||||
|
||||
@@ -22,6 +23,12 @@ fun main() {
|
||||
colorBuffer()
|
||||
}
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
|
||||
12
orx-jumpflood/src/demo/resources/name.svg
Normal file
12
orx-jumpflood/src/demo/resources/name.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<svg version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1280 720" xml:space="preserve">
|
||||
<polygon fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" points="1013.8,424.3 1013.8,238 957.1,238 957.1,238
|
||||
794.7,238 794.7,294.7 957.1,294.7 957.1,318.9 794.7,318.9 794.7,375.6 957.1,375.6 957.1,424.3 794.7,424.3 794.7,481 957.1,481
|
||||
1013.8,481 1037.8,481 1037.8,424.3 "/>
|
||||
<path fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" d="M705.7,263.3H576V239h-56.7v119.2l0,0V401h93.2v24.3h-93.2V482
|
||||
h243.1v-56.7h-93.2V401h93.2V239h-56.7V263.3L705.7,263.3z M705.7,344.3H576V320h129.7V344.3z"/>
|
||||
<path fill="#FF00FF" d="M356.6,279L356.6,279L356.6,279z"/>
|
||||
<path fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" d="M356.6,279c-9.2-3.3-19-5-28.8-5c-47.2,0-85.5,38.3-85.5,85.5
|
||||
s38.3,85.5,85.5,85.5s85.5-38.3,85.5-85.5c0-0.1,0-0.3,0-0.4C413.3,323.1,390.5,291,356.6,279z M327.8,387.4
|
||||
c-15.7,0-28.4-12.7-28.4-28.4c0-15.7,12.7-28.4,28.4-28.4c15.6,0,28.4,12.7,28.4,28.4C356.1,374.7,343.4,387.4,327.8,387.4z"/>
|
||||
<rect x="430.1" y="238" fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" width="56.7" height="243"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user