Comments (12)
Of course, I will fix that problem soon.
FYI I recommend using Marlin double precision (default in jdk10):
Dsun.java2d.renderer=org.marlin.pisces.DMarlinRenderingEngine
Hope it is a workaround for now
from marlin-renderer.
Double vs Float ~ 1% perf difference, but higher quality on x86 64bits processors.
I never made any benchmark on 32bits or embedded systems (pi, arm, powerpc...)
Anyway this numerical issue is still possible but for larger numbers with double values.
I will test with increasing line length to establish the limit.
from marlin-renderer.
Thanks for the information.
Marlin 0.9.3 performs path clipping in dasher so it should only emit dashes for the visible portion, already.
Your timings make me think that the long clipped line is not properly ignored due to the numerical precision issue, we talked about.
I will definitely study this interesting case,
Thanks
from marlin-renderer.
I took few minutes to check your problem and your test does not use Marlin renderer as RenderingHints.VALUE_ANTIALIAS_ON is missing !
I fixed the test to use larger length (up to 7e15) and Marlin renderer rocks (both Float/Double variants) on JDK8:
- noAA ie not Marlin renderer (native C renderer ?)
drawLine(1.0E8) [AA=false]: 3631.4947909999996 ms. - AA org.marlin.pisces.DMarlinRenderingEngine:
drawLine(1.0E8) [AA=true]: 42.381105 ms.
drawLine(1.0E8) [AA=true]: 1.86741 ms. - AA org.marlin.pisces.MarlinRenderingEngine:
drawLine(1.0E8) [AA=true]: 50.357248999999996 ms.
drawLine(1.0E8) [AA=true]: 1.935198 ms.
drawLine(7.0E15) [AA=true]: 48.779185999999996 ms.
drawLine(7.0E15) [AA=true]: 1.946686 ms.
Marlin path clipper is working like a charm !
from marlin-renderer.
Could you give your command line to let me know which Marlin renderer and settings you use ?
It is surely related to a numerical precision issue when clipping the segment to the clip rectangle: I will see how to ensure clipped parts are outside the clip...
Thanks for your feedback,
Laurent
from marlin-renderer.
Here you are. Since I am in the office now this time using Windows and AdoptOpenJDK
C:\Program Files\Java\jdk8u192-b12\jre\bin>.\java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)
The command line I used is
"C:\Program Files\Java\jdk8u192-b12\bin\java.exe" -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine -Xbootclasspath/a:C:\Users\matze\Downloads\marlin-0.9.3-Unsafe.jar -classpath C:\Users\matze\eclipse-workspace\simple\target\classes matze.EndlessLoop
Side note that you understand from where we came:
Initially we had the problem that JFreeChart was calling Dasher.lineTo(NaN, NaN) which also blocked with Pisces. This was the reason why we are trying Marlin now.
Of course nobody would draw a line of this size by intention but having a thread cycling with 100% CPU when triggering this scenario can be critical for the whole host when you think about web applications.
Thanks for your efforts!
from marlin-renderer.
Thanks, Laurent!
I already wondered why not using DMarlinRenderingEngine. Are there any drawbacks, e.g. performance-wise?
from marlin-renderer.
Do you confirm that your problem do not happen with Marlin Double precision ?
It gives me more time to fix the precision issue...
from marlin-renderer.
Yes it works with DMarlinRenderingEngine for these values but of course takes some time.
Here some numbers:
Drawing a line to y=4.0E7
1541670292910: If you don't see 'Not hanging.' then you hang :)
1541670295111: Not hanging.
Around 2 seconds for 4.0E7.
Drawing a line to y=1.0E8
1541670374510: If you don't see 'Not hanging.' then you hang :)
1541670379637: Not hanging.
Around 5 seconds for 1.0E8.
Drawing a line to y=1.0E9
1541670807124: If you don't see 'Not hanging.' then you hang :)
1541670855332: Not hanging.
Around 48 seconds for 1.0E9.
So even if it is not hanging infinitely it can take arbitrarily long on erratic values. Therefore it would be best to only draw the portion that is "visible". Not sure if something like this is possible.
After some discussion with my colleagues we will use DMarlinRenderingEngine anyway. So this constructed case is not an issue for us, i.e. not urgent.
from marlin-renderer.
Confirmed. Sorry, I was not aware that I have to give also the "antialiasing" hint on top of of boot classpath and system property.
I could not find a place where this is documented that only the hint "really" enables the renderer.
Maybe this should be added to the "How to use" page.
In our case we just need to find a why how to enable antialiasing in all cases since in our scenario we do not access Graphics2D directly but behind libraries like JFreeChart in our case.
But issue itself is of course solved and can be closed. Thank you very much for your help!
from marlin-renderer.
See Marlin renderer description:
"Marlin is the FAST Java2D antialiasing rasterizer derived from OpenJDK Pisces (shape) "
For JFreechart, it is easy (since 2005):
Map hints = new HashMap();
hints.put(RenderingHints.KEY_ANTIALIASING,
...
chart.setRenderingHints(new RenderingHints(hints));
PS: what is your application ? (public ?)
from marlin-renderer.
No not public.
This is currently a research about the general strategy what we will do with Java 8 in 2019.
from marlin-renderer.
Related Issues (20)
- java.lang.NoSuchFieldError: refList when using 0.9.2 with Intelllij - Java 8 HOT 11
- Canvas support? HOT 1
- Marlin causes VisualVM to hang HOT 2
- Will there be a v0.9.4 for JDK 9+? HOT 1
- Backport non-AA renderers from MarlinFX HOT 1
- Support Mantle and, on macOS support Metal HOT 1
- Enhance curve's cusp handling to fix self intersections in large stroked curves
- Thin lines in PDF not rendered HOT 13
- Update DPQS to latest OpenJDK 14 patch HOT 1
- Improve cubic curve offset computation HOT 2
- Skip draw joins if line/curve was splitted by dasher or strokerclipper HOT 1
- Using JFreeChart to draw chart but overlay occurs HOT 20
- Improve curve offsetting HOT 1
- https://bugs.openjdk.java.net/browse/JDK-8277574 HOT 1
- NoSuchMethodError: sun.java2d.marlin.MarlinProperties.isDoClip()Z HOT 3
- Help with installing Marlin-renderer HOT 9
- Detect constant shapes (slope = 0) to optimize scanline processing & tile generation HOT 2
- make Marlin renderer releases 0.9.4.6 HOT 3
- improve graphics2d impl to dump stats & record drawing commands
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marlin-renderer.