mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 21:41:32 +00:00
Gjallarhorn: Use 3-byte RGB for images, and improve timelapse text.
This commit is contained in:
@ -59,6 +59,7 @@ class BlockChangeTimelapseCommand : CliktCommand("Block Change Timelapse", name
|
||||
logger.info("Timelapse Slices: ${slices.size} slices")
|
||||
|
||||
val imagePadCount = slices.size.toString().length
|
||||
|
||||
val pool = BlockMapRenderPool(
|
||||
changelog = changelog,
|
||||
blockTrackMode = if (considerAirBlocks) BlockTrackMode.AirOnDelete else BlockTrackMode.RemoveOnDelete,
|
||||
@ -68,12 +69,13 @@ class BlockChangeTimelapseCommand : CliktCommand("Block Change Timelapse", name
|
||||
) { slice, result ->
|
||||
val speed = slice.relative.toSeconds().toDouble() / timelapseMode.interval.toSeconds().toDouble()
|
||||
val graphics = result.createGraphics()
|
||||
val font = Font.decode("Arial Black").deriveFont(36.0f)
|
||||
val font = Font.decode("Arial Black").deriveFont(24.0f)
|
||||
graphics.color = Color.black
|
||||
graphics.font = font
|
||||
val context = graphics.fontRenderContext
|
||||
val text = String.format("%s @ %.4f speed (1 frame = %s sec)", slice.to, speed, slice.relative.toSeconds())
|
||||
val layout =
|
||||
TextLayout("${slice.to} @ ${speed}x (1 frame = ${slice.relative.toSeconds()} seconds)", font, context)
|
||||
TextLayout(text, font, context)
|
||||
layout.draw(graphics, 60f, 60f)
|
||||
graphics.dispose()
|
||||
val index = slices.indexOf(slice) + 1
|
||||
|
@ -25,7 +25,7 @@ abstract class BlockGridRenderer(val quadPixelSize: Int = defaultQuadPixelSize)
|
||||
val widthInPixels = widthInBlocks.toInt() * quadPixelSize
|
||||
val heightInPixels = heightInBlocks.toInt() * quadPixelSize
|
||||
val bufferedImage =
|
||||
BufferedImage(widthInPixels, heightInPixels, BufferedImage.TYPE_4BYTE_ABGR)
|
||||
BufferedImage(widthInPixels, heightInPixels, BufferedImage.TYPE_3BYTE_BGR)
|
||||
|
||||
val graphics = bufferedImage.createGraphics()
|
||||
for (x in 0 until widthInBlocks) {
|
||||
|
@ -66,7 +66,7 @@ class BlockMapRenderPool<T>(
|
||||
}
|
||||
val end = System.currentTimeMillis()
|
||||
val timeInMilliseconds = end - start
|
||||
logger.info("Playback Completed for Slice $id in ${timeInMilliseconds}ms")
|
||||
logger.debug("Playback Completed for Slice $id in ${timeInMilliseconds}ms")
|
||||
}
|
||||
|
||||
interface RenderPoolDelegate<T> {
|
||||
|
Reference in New Issue
Block a user