Re: Learning Prism

2016-03-10 Thread Jeffrey Guenther
Thanks for the tips Johan and Morris! Very helpful!

> On Mar 8, 2016, at 3:22 AM, Johan Vos <johan@gluonhq.com> wrote:
> 
> Hi,
> 
> I think the best way to get started really depends on your personal 
> preferences (e.g. do you like to read code, docs, diagrams,...).
> I can only comment on how I do it, but others may have other approaches:
> 
> First of all, you can run a simple JavaFX apps with lots of verbose info. See 
> com.sun.prism.impl.PrismSettings for a list, and have at least prism.verbose 
> set to true. This already gives you lots of insight in what is happening.
> 
> Second, you want to know what happens on a pulse. Although many complex 
> things are happening, this is not very hard to detect from the code: start 
> from QuantumToolkit.pulse() and follow it from there. There are basically two 
> main parts: 
> * do the calculations (on the FX Thread) (e.g. look at 
> Scene.ScenePulseListener.pulse())
> * do the rendering (PaintCollector.renderAll() which will ultimately call 
> QuantumRenderer.submitRenderJob() which runs on the Prism thread).
> 
> - Johan
> 
> 
> On Tue, Mar 8, 2016 at 5:34 AM, Felix Bembrick <felix.bembr...@gmail.com 
> <mailto:felix.bembr...@gmail.com>> wrote:
> +1
> 
> I too would love to dive as deep as possible and improve anything that
> needs improving so some guidance would help greatly!
> 
> Felix
> 
> On 8 March 2016 at 14:45, Jeffrey Guenther <guenther.jeff...@gmail.com 
> <mailto:guenther.jeff...@gmail.com>>
> wrote:
> 
> > Hi Devs,
> >
> > I’m interested in learning more about JavaFX’s low level graphics
> > implementation. I’ve spent a couple afternoons source diving in the
> > modules/graphics folder to get the lay of the land and now I think I need
> > some help. Can anyone point me to documentation describing the system’s
> > high level design? Let’s say one or two levels deeper than
> > http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm 
> > <http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm>? <
> > http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm 
> > <http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm>?>
> >
> > Ultimately, I’d like to gain a better understanding on how JavaFX lays out
> > and renders text for the purposes of understanding how I might be able to
> > contribute to a more advanced text API with support for things like kerning.
> >
> > Secondly, can anyone explain to me how shaders are compiled and passed
> > down to the graphics layer? I’d like to gain a better understanding of how
> > a JavaFX programmer could leverage/add to Prism such that we can write
> > custom shaders/GPU kernels for Effects nodes.
> >
> > I realize the graphics system in JavaFX is not for the faint of heart.
> > There’s much going on beneath the surface. I’m willing to dive deep and do
> > the learning to understand the design. Can anyone point me to docs where I
> > can get started? Or maybe which class to start with and work out from when
> > I’m source diving?
> >
> > Jeff
> 



Learning Prism

2016-03-07 Thread Jeffrey Guenther
Hi Devs,

I’m interested in learning more about JavaFX’s low level graphics 
implementation. I’ve spent a couple afternoons source diving in the 
modules/graphics folder to get the lay of the land and now I think I need some 
help. Can anyone point me to documentation describing the system’s high level 
design? Let’s say one or two levels deeper than 
http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm? 


Ultimately, I’d like to gain a better understanding on how JavaFX lays out and 
renders text for the purposes of understanding how I might be able to 
contribute to a more advanced text API with support for things like kerning.

Secondly, can anyone explain to me how shaders are compiled and passed down to 
the graphics layer? I’d like to gain a better understanding of how a JavaFX 
programmer could leverage/add to Prism such that we can write custom 
shaders/GPU kernels for Effects nodes.

I realize the graphics system in JavaFX is not for the faint of heart. There’s 
much going on beneath the surface. I’m willing to dive deep and do the learning 
to understand the design. Can anyone point me to docs where I can get started? 
Or maybe which class to start with and work out from when I’m source diving?

Jeff

Building Creative Graphics Applications in JavaFX

2014-11-10 Thread Jeffrey Guenther
Hello, 

I have been using JavaFX for the last couple years to build a prototype for my 
PhD research. I’ve really enjoyed myself as I’ve used it. For the most part, I 
can implement a UI as fast as I can understand what it needs to do. The scene 
graph is wonderful.

JavaFX is great if you want to build a more traditional application that uses 
buttons, list views, tables views, etc. What I’m still trying to understand is 
how well JavaFX can help me build more complex interactive graphics 
applications. The majority of my work is in data visualization and image 
creation. I’ve been working some something like NodeBox or Grasshopper for 
Rhino. I’ll finish the prototype with JavaFX. What I’m pondering is if I 
can/should keep using JavaFX should I take the project commercial or will it be 
coding myself into a corner.

My question to you is: has any one tried to build, even as a sample project, a 
small image editor or vector drawing application with JavaFX?
What worked well? What kinds of problems did you run into?

What has been the experience of the SceneBuilder team? SceneBuilder is probably 
the most advanced creative tool I’ve seen built with JavaFX so far.

I read a post about there being a OpenGL view added to JavaFX one day. What’s 
the latest on this?

I’m very convinced by the work done by Netflix with RxJava and their other 
projects that Java/JVM applications work great in the enterprise on the server. 
What I’m wondering is if Java and JavaFX can compete with tools like Apple’s 
Cocoa or Qt for building creative applications like say the next generations of 
Photoshop and Illustrator, or some other new innovative way of creating content.

Thank you for your time!

Jeff




Re: Extending a Region to create a JUNG Layout

2014-06-01 Thread Jeffrey Guenther
BSD - 3 Clause - http://jung.sourceforge.net/license.txt


On Sat, May 31, 2014 at 6:17 PM, Danno Ferrin danno.fer...@shemnon.com
wrote:

 The new matrix classes exposed in JavaFX 8 help a lot.

 I'll re-license it BSD.  2 clause, 3 clause, new?  Can you point me to a
 preferred header?


 On Fri, May 30, 2014 at 6:11 PM, Jeffrey Guenther 
 guenther.jeff...@gmail.com wrote:

 Danno, thanks! It works super well and has so little code!

 If I use the class in my JUNG work, I need a BSD license. The rest of
 that codebase is BSD already. I’ll contact you off list if I go that
 direction. Right now, I’m trying to get my head wrapped around what it
 would take to modernize JUNG.


 On May 30, 2014, at 4:20 PM, Danno Ferrin danno.fer...@oracle.com
 wrote:

  You may find this class valuable, it is a pane that listens to zoom and
 mouse scroll events in a group, essential for large graphs:
 
 
 https://github.com/shemnon/FollowTheBitcoin/blob/master/src/main/groovy/com/shemnon/btc/view/ZoomPane.java
 
  I haven't had time to harden it and componentize it into a standalone
 release.  If you don't like the license let me know what license you would
 like.
 
  --Danno
 
  - Original Message -
  From: sven.reim...@gmail.com
  To: guenther.jeff...@gmail.com
  Cc: openjfx-dev@openjdk.java.net
  Sent: Friday, May 30, 2014 1:27:48 AM GMT -07:00 US/Canada Mountain
  Subject: Re: Extending a Region to create a JUNG Layout
 
  Hi Jeffrey,
 
  I did some prototyping with Jung JavaFX and Java 8, the results are here
 
  https://bitbucket.org/sreimers/jung8
 
  It uses gradle to build and contains an additional library for jungfx.
 
  Enjoy
 
  -Sven
 
 
  On Fri, May 30, 2014 at 8:44 AM, Jeffrey Guenther 
  guenther.jeff...@gmail.com wrote:
 
  Hi,
 
  I'm in the midst of exploring how I might port JUNG(
  http://jung.sourceforge.net/index.html) to JavaFX. JUNG is a
 graph/layout
  tool my lab uses for some of their data visualizations. With the
 release of
  JavaFX 2, we've started building our prototypes in JavaFX.
 
  Rather than use the JFXSwingPanel, I want to try modifying the JUNG to
 work
  natively in JavaFX. In the long term, I'd like to see JUNG ported
  completely to JavaFX using properties, CSS and the like.
 
  I've built a quick demo (
  https://gist.github.com/jrguenther/9d0c37329f9928a2b56e) and need help
  going forward. I've been reading the docs and hitting google, but I
 think I
  need more info.
 
  Can someone point me to a detailed explanation of how to extend Region
 to
  create my own layout?
  In particular, how can I get a region to relayout it's children when
 it's
  being resized?
  When does a the region's parent call layoutChildren()?
  If the height and width of the region are set to Double.MAX_VALUE
  indicating the area can grow infinitely, how does the region know what
 size
  to set itself to?
 
  Thanks,
  Jeff
 
 
 
 
  --
  Sven Reimers
 
  * Senior Expert Software Architect
  * NetBeans Dream Team Member: http://dreamteam.netbeans.org
  * Community Leader  NetBeans: http://community.java.net/netbeans
   Desktop Java:
  http://community.java.net/javadesktop
  * JUG Leader JUG Bodensee: http://www.jug-bodensee.de
  * Duke's Choice Award Winner 2009
  * Blog: https://www.java.net//blog/sven
 
  * XING: https://www.xing.com/profile/Sven_Reimers8
  * LinkedIn: http://www.linkedin.com/in/svenreimers
 
  Join the NetBeans Groups:
  * XING: http://www.xing.com/group-20148.82db20
  * NUGM: http://haug-server.dyndns.org/display/NUGM/Home
  * LinkedIn: http://www.linkedin.com/groups?gid=1860468
http://www.linkedin.com/groups?gid=107402
http://www.linkedin.com/groups?gid=1684717
  * Oracle: https://mix.oracle.com/groups/18497





Extending a Region to create a JUNG Layout

2014-05-30 Thread Jeffrey Guenther
Hi,

I'm in the midst of exploring how I might port JUNG(
http://jung.sourceforge.net/index.html) to JavaFX. JUNG is a graph/layout
tool my lab uses for some of their data visualizations. With the release of
JavaFX 2, we've started building our prototypes in JavaFX.

Rather than use the JFXSwingPanel, I want to try modifying the JUNG to work
natively in JavaFX. In the long term, I'd like to see JUNG ported
completely to JavaFX using properties, CSS and the like.

I've built a quick demo (
https://gist.github.com/jrguenther/9d0c37329f9928a2b56e) and need help
going forward. I've been reading the docs and hitting google, but I think I
need more info.

Can someone point me to a detailed explanation of how to extend Region to
create my own layout?
In particular, how can I get a region to relayout it's children when it's
being resized?
When does a the region's parent call layoutChildren()?
If the height and width of the region are set to Double.MAX_VALUE
indicating the area can grow infinitely, how does the region know what size
to set itself to?

Thanks,
Jeff


Re: Extending a Region to create a JUNG Layout

2014-05-30 Thread Jeffrey Guenther

On May 30, 2014, at 10:55 AM, John Smith john_sm...@symantec.com wrote:

 Much of the internal JavaFX implementation is performed subclassing Region 
 (or Control which is just a Region subclass itself) and overriding 
 layoutChildren, but I'm not aware of any official documentation on the 
 subject other than the sparse stuff in the Javadoc - so no real tutorials.
 
 Maybe try studying some of the JavaFX source which extends Region.
 
 For example, take a look at Axis:
  
 https://bitbucket.org/openjfxmirrors/openjfx-8-master-rt/src/tip/modules/controls/src/main/java/javafx/scene/chart/Axis.java
  
 https://bitbucket.org/openjfxmirrors/openjfx-8-master-rt/src/tip/modules/controls/src/main/java/javafx/scene/chart/CategoryAxis.java
 

Good call. Axises should be pretty simple. In my search, I stumbled upon the 
source in grep code (though I know it is available from openjdk) and spent some 
time looking at HBox and VBox as they are on the simpler side of things.

 It would be nice if Oracle or somebody else produced some documentation on 
 this.   You could create a feature request in Jira 
 (https://javafx-jira.kenai.com) for such documentation or email the 
 documentation team (javasedocs...@oracle.com), or write a blog or a openjfx 
 wiki article (https://wiki.openjdk.java.net/display/OpenJFX/Main) if you work 
 out some good techniques.

Never thought about a ticket for docs. Yeah, I plan to blog once I get feel for 
things.



Re: Extending a Region to create a JUNG Layout

2014-05-30 Thread Jeffrey Guenther
Thank you for the feedback!

 Can someone point me to a detailed explanation of how to extend Region to 
 create my own layout?
 In particular, how can I get a region to relayout it's children when it's 
 being resized?
 
 Some quick pointers. First, layout is done asynchronously to the changes that 
 cause the layout to have to occur. This is done so that we limit the number 
 of times we layout a container. For example, if a container’s width changes, 
 we mark that container (and on up the hierarchy) as needing a new layout, but 
 we don’t perform the layout yet. If you were to then change the height for a 
 container, we see that it has already been marked dirty and don’t have to go 
 any further. Without this, we ended up with “layout storms”.
 
 Layouts happen once “per pulse”. A “pulse” happens once per rendering. So we 
 get notification that we need to prepare the scene graph in order to render 
 the next frame. So we do CSS, layout, etc and then synchronize those changes 
 down to the graphics layer to draw. You don’t have to worry about the pulse. 
 Just know that when the width / height / etc of a layout container changes, 
 we mark it as dirty, and then perform layout *sometime before the next render 
 happens*.
 
 In order to manually tell a region that it has a dirty layout, call 
 requestLayout() on the region.
 
 When does a the region's parent call layoutChildren()?
 
 During the pulse. You can force a layout (which maybe is what you’re bumping 
 up against), but normally if you can, you want to let the “once per pulse” 
 mechanism cause layout to occur for you.
 

Hmm. I haven’t been forcing the layout. I’ve just overridden layoutChildren() 
to do the graph layout whenever it is called. (Trying to write as little code 
as necessary)

 During the layout pass, the layoutChildren() method on the region will be 
 called. Inside this method you are responsible for taking into account any 
 insets on the region (by calling getInsets()).

So the content area width for rendering the children, for example, is the size 
provided by the parent less the left and right insets. How do you access the 
width and height the parent is requesting the region to be?

For example, let’s say I have:

@Override
protected void layoutChildren() {
super.layoutChildren();
  
//  What methods do I call to get the desired width and height values 
from the parent to pass into the layout?

doGraphLayout(?, ?); // layout takes a width and height and layouts out 
the network inside in those dimensions - creates Shapes adds them as children 
to the region
}

 
 If the height and width of the region are set to Double.MAX_VALUE indicating 
 the area can grow infinitely, how does the region know what size to set 
 itself to?
 
 I assume you mean, when the prefWidth and prefHeight? The parent of the 
 region will ask the region for its min/pref/max width and height, and will 
 then decide what size to give your region. So in other words, the region 
 doesn’t figure out its own width/height, it is told its width and height, 
 *prior* to be being asked to layout its children.

Yes, sorry. prefWidth and prefHeight. And the parent calls resize(width, 
height)?

So if I understand this correctly, rendering starts at the scene graphs root 
and layouts are computed down the tree. The scene size tells the root node what 
size it should be and then it calls layoutChildren(). If the region has 
children it manages, they are provide with a size they should be. They in turn 
layout their children. The process continues down the tree. So layouts are top 
down? And properties like hgrow, vgrow, etc control the layout behaviour?

If I want to make my graph layout resizable, what do I need to do? Just 
implement resize(width, height)?


Jeff

Re: Extending a Region to create a JUNG Layout

2014-05-30 Thread Jeffrey Guenther
Danno, thanks! It works super well and has so little code!

If I use the class in my JUNG work, I need a BSD license. The rest of that 
codebase is BSD already. I’ll contact you off list if I go that direction. 
Right now, I’m trying to get my head wrapped around what it would take to 
modernize JUNG.


On May 30, 2014, at 4:20 PM, Danno Ferrin danno.fer...@oracle.com wrote:

 You may find this class valuable, it is a pane that listens to zoom and mouse 
 scroll events in a group, essential for large graphs:
 
 https://github.com/shemnon/FollowTheBitcoin/blob/master/src/main/groovy/com/shemnon/btc/view/ZoomPane.java
 
 I haven't had time to harden it and componentize it into a standalone 
 release.  If you don't like the license let me know what license you would 
 like.
 
 --Danno
 
 - Original Message -
 From: sven.reim...@gmail.com
 To: guenther.jeff...@gmail.com
 Cc: openjfx-dev@openjdk.java.net
 Sent: Friday, May 30, 2014 1:27:48 AM GMT -07:00 US/Canada Mountain
 Subject: Re: Extending a Region to create a JUNG Layout
 
 Hi Jeffrey,
 
 I did some prototyping with Jung JavaFX and Java 8, the results are here
 
 https://bitbucket.org/sreimers/jung8
 
 It uses gradle to build and contains an additional library for jungfx.
 
 Enjoy
 
 -Sven
 
 
 On Fri, May 30, 2014 at 8:44 AM, Jeffrey Guenther 
 guenther.jeff...@gmail.com wrote:
 
 Hi,
 
 I'm in the midst of exploring how I might port JUNG(
 http://jung.sourceforge.net/index.html) to JavaFX. JUNG is a graph/layout
 tool my lab uses for some of their data visualizations. With the release of
 JavaFX 2, we've started building our prototypes in JavaFX.
 
 Rather than use the JFXSwingPanel, I want to try modifying the JUNG to work
 natively in JavaFX. In the long term, I'd like to see JUNG ported
 completely to JavaFX using properties, CSS and the like.
 
 I've built a quick demo (
 https://gist.github.com/jrguenther/9d0c37329f9928a2b56e) and need help
 going forward. I've been reading the docs and hitting google, but I think I
 need more info.
 
 Can someone point me to a detailed explanation of how to extend Region to
 create my own layout?
 In particular, how can I get a region to relayout it's children when it's
 being resized?
 When does a the region's parent call layoutChildren()?
 If the height and width of the region are set to Double.MAX_VALUE
 indicating the area can grow infinitely, how does the region know what size
 to set itself to?
 
 Thanks,
 Jeff
 
 
 
 
 -- 
 Sven Reimers
 
 * Senior Expert Software Architect
 * NetBeans Dream Team Member: http://dreamteam.netbeans.org
 * Community Leader  NetBeans: http://community.java.net/netbeans
  Desktop Java:
 http://community.java.net/javadesktop
 * JUG Leader JUG Bodensee: http://www.jug-bodensee.de
 * Duke's Choice Award Winner 2009
 * Blog: https://www.java.net//blog/sven
 
 * XING: https://www.xing.com/profile/Sven_Reimers8
 * LinkedIn: http://www.linkedin.com/in/svenreimers
 
 Join the NetBeans Groups:
 * XING: http://www.xing.com/group-20148.82db20
 * NUGM: http://haug-server.dyndns.org/display/NUGM/Home
 * LinkedIn: http://www.linkedin.com/groups?gid=1860468
   http://www.linkedin.com/groups?gid=107402
   http://www.linkedin.com/groups?gid=1684717
 * Oracle: https://mix.oracle.com/groups/18497



Re: com.​sun.​javafx.​fxml.​expression

2014-04-03 Thread Jeffrey Guenther
Very interesting.

Is there any other documentation about it's design available? Some of the
things I'd be interested in knowing in more detail are the kind of
expressions it supports and the goals for the path resolution mechanism?
How does interact with native Java objects?


 From: Martin Sladecek martin.slade...@oracle.com
 To: openjfx-dev@openjdk.java.net
 Cc:
 Date: Thu, 03 Apr 2014 09:15:11 +0200
 Subject: Re: com.​sun.​javafx.​fxml.​expression
 Yes, that's an expression parser for FXML expressions, see
 http://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-
 files/introduction_to_fxml.html#expression_binding

 -Martin

 On 04/03/2014 12:57 AM, Jeffrey Guenther wrote:

 Hi,

 In the midst of an autocomplete in NetBeans I
 discovered com.​sun.​javafx.​fxml.​expression.​Expression. I'm in the
 middle of implementing an expression parser for a project and happen to
 also have an Expression object.

 May I ask what this package is for? It's the first I've seen of it and
 it's
 quite interesting. Looks like there is a little expression parser built
 into FXML?

 Thanks,
 Jeff




com.​sun.​javafx.​fxml.​expression

2014-04-02 Thread Jeffrey Guenther
Hi,

In the midst of an autocomplete in NetBeans I
discovered com.​sun.​javafx.​fxml.​expression.​Expression. I'm in the
middle of implementing an expression parser for a project and happen to
also have an Expression object.

May I ask what this package is for? It's the first I've seen of it and it's
quite interesting. Looks like there is a little expression parser built
into FXML?

Thanks,
Jeff