Skip to content

Commit

Permalink
Release/0.4.0 (#37)
Browse files Browse the repository at this point in the history
* Feature/dft refactor (#36)

* Initial refactoring

* Removed used PaintTool class

* Layer rendering

* Improvements

* Fixed imagelayer render algorithm

* Bug fixes

* Improvements

* Added GraphicsContext

* Checkpoint

* Improved tool builder; package refactoring

* Reverted introduction of delegate pattern

* Added configurable properties to ants

* Improvements to filltransform

* Refactored builder inner classes

* Eliminated surfaceInteractionObserver template method

* Added AirbrushToolTest

* Added FillToolTest

* Airbrush tool behavior improvements

* Enabling JUnit5 tests

* Fix for headless test failure

* Fixing Optional issues

* Enabled Jacoco

* README and transfer handler improvements

* Readme fixes

* More README updates

* Added tests

* ImageLayerTest

* Completed test for ImageLayer

* Improved test method names

* Refactored structure of tools

* Added BasicToolTest

* Added BoundsToolTest

* Improving BoundsTool test coverage

* Improved parameter name in SurfaceInteractionObserver

* Added LinearTool test

* Fixing Sonar bugs

* Enabling Sonar branches

* Added PathToolTest

* #35: Fixed polyline issue

* Readme updates and refactoring

* Deleted tester

* Javadoc fixes
  • Loading branch information
defano authored Feb 9, 2019
1 parent 5e96938 commit 82ea313
Show file tree
Hide file tree
Showing 167 changed files with 8,118 additions and 2,479 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
*.iml
target/*
*.bin
.gradle/*
.gradle/*
/src/main/java/com/defano/jmonet/Tester.java
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
language: java

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

jdk:
- oraclejdk8

Expand All @@ -13,4 +18,4 @@ script: mvn test javadoc:javadoc
after_success:
- chmod +x .travis/push-javadocs.sh
- .travis/push-javadocs.sh
- mvn sonar:sonar -Dsonar.organization=defano-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_KEY
- mvn sonar:sonar -Dsonar.organization=defano-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=$TRAVIS_BRANCH
170 changes: 104 additions & 66 deletions README.md

Large diffs are not rendered by default.

71 changes: 67 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<name>JMonet</name>
<description>A rudimentary toolkit for incorporating MacPaint-like tools into a Java Swing or JavaFX application.
</description>
<description>A toolkit for incorporating MacPaint-like tools into a Java Swing or JavaFX application.</description>
<url>https://github.com/defano/jmonet</url>

<licenses>
Expand Down Expand Up @@ -35,7 +33,7 @@
<packaging>jar</packaging>
<groupId>com.defano.jmonet</groupId>
<artifactId>jmonet</artifactId>
<version>0.3.3</version>
<version>0.4.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -56,6 +54,32 @@
<version>2.1.16</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
</dependencies>

<distributionManagement>
Expand All @@ -71,6 +95,45 @@

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/com/defano/jmonet/algo/fill/DefaultFillFunction.java

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/com/defano/jmonet/algo/fill/FillFunction.java

This file was deleted.

26 changes: 16 additions & 10 deletions src/main/java/com/defano/jmonet/canvas/AbstractPaintCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.defano.jmonet.canvas.layer.ImageLayerSet;
import com.defano.jmonet.canvas.observable.CanvasCommitObserver;
import com.defano.jmonet.canvas.surface.AbstractPaintSurface;
import com.defano.jmonet.tools.util.Geometry;
import io.reactivex.Observable;
import com.defano.jmonet.context.GraphicsContext;
import com.defano.jmonet.tools.util.MathUtils;
import io.reactivex.subjects.BehaviorSubject;

import java.awt.*;
Expand Down Expand Up @@ -50,6 +50,14 @@ public Dimension getCanvasSize() {
return getSurfaceDimension();
}

/**
* {@inheritDoc}
*/
@Override
public Component getComponent() {
return this;
}

/**
* Marks this component safe for garbage collection; removes registered listeners and components.
*/
Expand Down Expand Up @@ -78,7 +86,7 @@ public ImageLayer[] getImageLayers() {
@Override
public void clearCanvas() {
Rectangle clear = new Rectangle(new Point(), getCanvasSize());
Graphics2D g2 = scratch.getRemoveScratchGraphics(null, clear);
GraphicsContext g2 = scratch.getRemoveScratchGraphics(null, clear);
g2.setColor(Color.WHITE);
g2.fill(clear);

Expand Down Expand Up @@ -107,15 +115,15 @@ public void setCanvasBackground(Paint paint) {
@Override
public Point convertViewPointToModel(Point p) {
Point error = getScrollError();
int gridSpacing = getGridSpacingObservable().blockingFirst();
int gridSpacing = getGridSpacing();
double scale = getScaleObservable().blockingFirst();

int x = p.x - error.x;
x = Geometry.round(x, (int) (gridSpacing * scale));
x = MathUtils.nearestFloor(x, (int) (gridSpacing * scale));
x = (int) (x / scale);

int y = p.y - error.y;
y = Geometry.round(y, (int) (gridSpacing * scale));
y = MathUtils.nearestFloor(y, (int) (gridSpacing * scale));
y = (int) (y / scale);

return new Point(x, y);
Expand Down Expand Up @@ -164,8 +172,8 @@ public void setGridSpacing(int grid) {
* {@inheritDoc}
*/
@Override
public Observable<Integer> getGridSpacingObservable() {
return gridSpacingSubject;
public int getGridSpacing() {
return gridSpacingSubject.blockingFirst();
}

/**
Expand Down Expand Up @@ -204,8 +212,6 @@ public Point getScrollError() {
return new Point((int) (viewRect.x % scale), (int) (viewRect.y % scale));
}



protected void fireCanvasCommitObservers(PaintCanvas canvas, ImageLayerSet imageLayerSet, BufferedImage canvasImage) {
for (CanvasCommitObserver thisObserver : observers) {
thisObserver.onCommit(canvas, imageLayerSet, canvasImage);
Expand Down
Loading

0 comments on commit 82ea313

Please sign in to comment.