Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jzbrooks/vat
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.3
Choose a base ref
...
head repository: jzbrooks/vat
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 17 commits
  • 10 files changed
  • 3 contributors

Commits on Jan 14, 2025

  1. Changelog update - 0.0.3

    github-actions authored and jzbrooks committed Jan 14, 2025
    Copy the full SHA
    032e9bc View commit details

Commits on Jan 20, 2025

  1. Copy the full SHA
    b35d7ed View commit details
  2. Copy the full SHA
    606d636 View commit details
  3. Prepare the next version

    jzbrooks committed Jan 20, 2025
    Copy the full SHA
    406f6b2 View commit details
  4. Changelog update - 0.0.4

    github-actions authored and jzbrooks committed Jan 20, 2025
    Copy the full SHA
    eee2b72 View commit details

Commits on Jan 25, 2025

  1. Spell renovate correctly

    jzbrooks committed Jan 25, 2025
    Copy the full SHA
    04cfed6 View commit details
  2. Add a version catalog

    jzbrooks committed Jan 25, 2025
    Copy the full SHA
    72b3814 View commit details
  3. Upgrade gradle

    jzbrooks committed Jan 25, 2025
    Copy the full SHA
    76f1ea5 View commit details
  4. Update skiko to v0.8.19

    renovate[bot] authored and jzbrooks committed Jan 25, 2025
    Copy the full SHA
    06004aa View commit details

Commits on Jan 26, 2025

  1. Copy the full SHA
    101362d View commit details
  2. Track the path fill mode

    jzbrooks committed Jan 26, 2025
    Copy the full SHA
    b04c280 View commit details
  3. Copy the full SHA
    3faa563 View commit details
  4. Copy the full SHA
    c613ed0 View commit details
  5. Copy the full SHA
    de56958 View commit details
  6. Bump the version

    jzbrooks committed Jan 26, 2025
    Copy the full SHA
    d09c0b9 View commit details
  7. Update CHANGELOG.md

    jzbrooks authored Jan 26, 2025
    Copy the full SHA
    bfe1ec6 View commit details
  8. Changelog update - 0.0.5

    github-actions authored and jzbrooks committed Jan 26, 2025
    Copy the full SHA
    260c0fd View commit details
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,16 +3,48 @@
## Unreleased

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## 0.0.5 - 2025-01-26

### Fixed

- Avoid translating coodinates for smooth bézier curves
- Track path fill rules when drawing
- Correctly parse floating point dimensions

## 0.0.4 - 2025-01-20

### Fixed

- Images appear blank or partially drawn if the viewport coordinate system differs from its specified height and width
- `--background-color` arguments can be prefixed with '#' or '0x'

## 0.0.3 - 2025-01-14

### Added

- Build targets for windows and linux systems
- Handle very simple SVGs supported by vgo
- style tags aren't handled
- nested clip paths aren't handled
- `--background-color` option (hexadecimal RGBA format)

### Fixed

- Handle group transformations

### Changed

- Default to transparent background

## 0.0.2
30 changes: 15 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@ import java.nio.file.Files
import java.nio.file.Paths

plugins {
id("org.jetbrains.kotlin.jvm") version "2.1.0"
id("org.jetbrains.changelog") version "2.2.1"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.changelog)
alias(libs.plugins.ktlint)
}

group = "com.jzbrooks"
version = "0.0.3"
version = "0.0.5"

repositories {
mavenCentral()
@@ -42,21 +42,21 @@ val linuxArm64RuntimeOnly: Configuration by configurations.creating {
}

dependencies {
implementation("org.jetbrains.skiko:skiko:0.8.18")
implementation(libs.skiko)

implementation("com.jzbrooks:vgo:3.0.0")
implementation("com.jzbrooks:vgo-core:3.0.0")
implementation(libs.vgo)
implementation(libs.vgoCore)

macosArm64RuntimeOnly("org.jetbrains.skiko:skiko-awt-runtime-macos-arm64:0.8.18")
linuxArm64RuntimeOnly("org.jetbrains.skiko:skiko-awt-runtime-linux-arm64:0.8.18")
linuxX64RuntimeOnly("org.jetbrains.skiko:skiko-awt-runtime-linux-x64:0.8.18")
windowsArm64RuntimeOnly("org.jetbrains.skiko:skiko-awt-runtime-windows-arm64:0.8.18")
windowsX64RuntimeOnly("org.jetbrains.skiko:skiko-awt-runtime-windows-x64:0.8.18")
macosArm64RuntimeOnly(libs.skikoMacArm)
linuxArm64RuntimeOnly(libs.skikoLinuxArm)
linuxX64RuntimeOnly(libs.skikoLinuxIntel)
windowsArm64RuntimeOnly(libs.skikoWindowsArm)
windowsX64RuntimeOnly(libs.skikoWindowsIntel)

r8("com.android.tools:r8:8.5.35")
r8(libs.r8)

testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(platform(libs.junitBom))
testImplementation(libs.junitJupiter)
}

sourceSets {
26 changes: 26 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[versions]
changelog = "2.2.1"
junit = "5.11.4"
kotlin = "2.1.0"
ktlintGradle = "12.1.2"
r8 = "8.7.18"
skiko = "0.8.19"
vgo = "3.0.0"

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintGradle" }

[libraries]
junitBom = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
junitJupiter = { module = "org.junit.jupiter:junit-jupiter" }
r8 = { group = "com.android.tools", name = "r8", version.ref = "r8" }
skiko = { group = "org.jetbrains.skiko", name = "skiko", version.ref = "skiko" }
skikoMacArm = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-macos-arm64", version.ref = "skiko" }
skikoWindowsArm = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-windows-arm64", version.ref = "skiko" }
skikoWindowsIntel = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-windows-x64", version.ref = "skiko" }
skikoLinuxArm = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-linux-arm64", version.ref = "skiko" }
skikoLinuxIntel = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-linux-x64", version.ref = "skiko" }
vgo = { group = "com.jzbrooks", name = "vgo", version.ref = "vgo" }
vgoCore = { group = "com.jzbrooks", name = "vgo-core", version.ref = "vgo" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Mon Dec 30 19:26:24 EST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 31 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,12 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,22 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,18 +201,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
37 changes: 21 additions & 16 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

@@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

@@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
File renamed without changes.
14 changes: 11 additions & 3 deletions src/main/kotlin/com/jzbrooks/vat/DrawingVisitor.kt
Original file line number Diff line number Diff line change
@@ -25,10 +25,12 @@ import org.jetbrains.skia.Canvas
import org.jetbrains.skia.Color4f
import org.jetbrains.skia.Matrix33
import org.jetbrains.skia.Paint
import org.jetbrains.skia.PaintMode
import org.jetbrains.skia.PaintStrokeCap
import org.jetbrains.skia.PaintStrokeJoin
import org.jetbrains.skia.PathDirection
import org.jetbrains.skia.PathEllipseArc
import org.jetbrains.skia.PathFillMode
import org.jetbrains.skia.Path as SkiaPath

class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY: Float?) : ElementVisitor {
@@ -49,8 +51,8 @@ class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY:
override fun visit(path: Path) {
val strokePaint =
Paint().apply {
mode = PaintMode.STROKE
isAntiAlias = true
setStroke(true)
strokeWidth = path.strokeWidth
strokeMiter = path.strokeMiterLimit
strokeJoin = when (path.strokeLineJoin) {
@@ -78,6 +80,7 @@ class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY:

val fillPaint =
Paint().apply {
mode = PaintMode.FILL
isAntiAlias = true
color4f =
Color4f(
@@ -100,6 +103,11 @@ class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY:

var previousControlPoint = Point.ZERO
val path = SkiaPath().apply {
fillMode = when (fillRule) {
Path.FillRule.NON_ZERO -> PathFillMode.WINDING
Path.FillRule.EVEN_ODD -> PathFillMode.EVEN_ODD
}

for (command in commands) {
if (command.shouldResetPreviousControlPoint) {
previousControlPoint = Point.ZERO
@@ -136,7 +144,7 @@ class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY:
}
is SmoothCubicBezierCurve -> {
val params = command.parameters.first()
val reflected = checkNotNull(previousControlPoint) * -1f
val reflected = checkNotNull(previousControlPoint)
rCubicTo(reflected.x, reflected.y, params.endControl.x, params.endControl.y, params.end.x, params.end.y)
previousControlPoint = params.endControl
}
@@ -147,7 +155,7 @@ class DrawingVisitor(val canvas: Canvas, private val sX: Float?, private val sY:
}
is SmoothQuadraticBezierCurve -> {
val params = command.parameters.first()
val reflected = checkNotNull(previousControlPoint) * -1f
val reflected = checkNotNull(previousControlPoint)
rQuadTo(reflected.x, reflected.y, params.x, params.y)
previousControlPoint = reflected
}
Loading