Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Do not expose rasterization related constants (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Jul 8, 2020
1 parent 54e3c4c commit 108f3ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ import com.soywiz.korma.geom.*
import com.soywiz.korma.geom.shape.*
import com.soywiz.korma.segment.*

//const val RAST_FIXED_SCALE = 32 // Important NOTE: Power of two so divisions are >> and remaining &
const val RAST_FIXED_SCALE = 20
//const val RAST_FIXED_SCALE_HALF = (RAST_FIXED_SCALE / 2) - 1
//const val RAST_FIXED_SCALE_HALF = (RAST_FIXED_SCALE / 2)
const val RAST_FIXED_SCALE_HALF = 0

const val RAST_SMALL_BUCKET_SIZE = 4 * RAST_FIXED_SCALE
const val RAST_MEDIUM_BUCKET_SIZE = 16 * RAST_FIXED_SCALE
const val RAST_BIG_BUCKET_SIZE = 64 * RAST_FIXED_SCALE

@KormaExperimental
open class RastScale {
companion object {
//internal const val RAST_FIXED_SCALE = 32 // Important NOTE: Power of two so divisions are >> and remaining &
internal const val RAST_FIXED_SCALE = 20
//internal const val RAST_FIXED_SCALE_HALF = (RAST_FIXED_SCALE / 2) - 1
//internal const val RAST_FIXED_SCALE_HALF = (RAST_FIXED_SCALE / 2)
internal const val RAST_FIXED_SCALE_HALF = 0

internal const val RAST_SMALL_BUCKET_SIZE = 4 * RAST_FIXED_SCALE
internal const val RAST_MEDIUM_BUCKET_SIZE = 16 * RAST_FIXED_SCALE
internal const val RAST_BIG_BUCKET_SIZE = 64 * RAST_FIXED_SCALE
}

val sscale get() = RAST_FIXED_SCALE
val hscale get() = RAST_FIXED_SCALE_HALF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ class StrokeToFill {
stroke: VectorPath,
lineWidth: Double, joins: LineJoin, startCap: LineCap, endCap: LineCap, miterLimit: Double, outFill: VectorPath
) {
val scale = RAST_FIXED_SCALE
val iscale = 1.0 / RAST_FIXED_SCALE
val scale = RastScale.RAST_FIXED_SCALE
val iscale = 1.0 / RastScale.RAST_FIXED_SCALE
set(outFill, (lineWidth * scale).toInt(), startCap, endCap, joins, miterLimit)
stroke.emitPoints2(
flush = { close ->
Expand Down

0 comments on commit 108f3ff

Please sign in to comment.