Our team is working on creating an online collage.
[https://jsfiddle.net/Lfz1bp7r/3/]
Characteristically, the collage should be under the mask of the PNG file. At this stage we are trying different libraries. Attention on fabricJS. The collage scheme is implemented using SVG paths. The first problem was tracking mouse events in SVG pathways. Implemented manually. The main problem is to add a new picture, which should be above the collage but below the mask. Manipulations with globalCompositeOperation do not help. There are no layers in the fabricJS.
So the question is - will the fabricJS allow you to implement the addition of a new picture on top of the collage, but under the PNG mask? It's possible?
Thank you very much in advance!
FabricJS includes two ways to draw on top of the canvas above the standard object and controls layers. You can set an overlayImage, and you can use the after:render event to run additional draw commands on the canvas context. See the Bounding Rectangle demo for a simple example of how to do this.
See How Fabric Canvas Layering Works.
Related
I want to evaluate Libgdx for my app. I want the following things to be possible with Libgdx:
The dynamic loading of images. (✔ Texture)
Cutting images. (✔ TextureRegion)
Support of the multiple screens. (✔ Screen)
Recognizing swinging to the right, left, up and down in a defined area. (✔ GestureDetector)
Nice to have:
Styling of buttons. (?)
Standard elements like lists, ScrollViews etc.(?)
SVG graphics rendering (?)
I am thinking about the three problems. I read that GestureDetector should be very slow (500ms) and that SVG graphics are not natively supported and rendered with extensions very slow.
My third concern is that I can't just style buttons the way I want them to, for example: enter image description here
I would like to know if my requirements can be solved with the LibGDX functions and if they are good and easy to use.
Thanks for your advice!
LibGDX comes with a sublibrary called Scene2D UI, which defines a bunch of standard UI widgets which can be styled with JSON. It comes with different Button classes and ScrollPane which are your ScrollView substitute.
Docs you might want for Scene2D UI:
https://github.com/libgdx/libgdx/wiki/Scene2d.ui For the widgets
https://github.com/libgdx/libgdx/wiki/Skin For styling the widgets
In regards to SVG rendering, best option is to render them to PNG files if you want to use LibGDX alone.
Also, you may want to look into TextureAtlas for managing all of your TextureRegions, as well as AssetManager for managing all the external resources in your app https://github.com/libgdx/libgdx/wiki/Managing-your-assets.
It's a good idea to compile all of your texture files into a single texture, so that not many textures have to be bound and unbound in OpenGL, so have a look at this https://github.com/crashinvaders/gdx-texture-packer-gui this will help you produce a TextureAtlas automatically.
I need to style nodes with SVG images but cannot make it work. I am using ImageNodeStyle and passing an SVG image to the constructor. However, applying this style to nodes has no effect. I tried using bitmap images and they work fine.
How do I enable SVG image support for node styling?
yFiles for JavaFX uses JavaFX as the rendering engine and JavaFX unfortunately does not directly support SVG images. You need to convert the SVG image into an image that JavaFX understands and then you will be able to use it with ImageNodeStyle.
Using WebViews would be another option, however this is a very heavyweight solution that does not scale very well for many SVGs. You can surely use for rendering a background SVG, but I would not use hundreds of instances to show simple SVG graphics for the visualization of nodes.
Take a look at this answer to a related SVG/JavaFX question: it proposes a solution to the generic problem, which should also work for this specific issue.
I am looking for a tool to draw the SVG diagram and I want to display the same in a webpage.
There are lot of tools to create SVG diagram, but I am looking for the one to add some extra fields to each shape.
OK first I will explain my requirement clear. When we create a rectangle using any SVG tool, it will create a SVG element with rect element, in my case I would like to differentiate two devices "device type-1" and "device type-2" (using CSS in my web application) but their shape is rectangle.
So, I have to add some additional information for each rectangle in the drawing tool, so that using Javascript I could understand the type of device, based on the device type I could apply different CSS for each rectangle.
How to do this? Any drawing tools support this kind of feature?
You could use http://svg-edit.googlecode.com/svn/branches/2.6/editor/svg-editor.html and define IDs that you reference later on in JavaScript
One approach would be to us Adobe Illustrator to design you elements and Raphael JS to display and animate said elements. There are some differences in the way illustrator draws vector graphics and the way SVG does so the general consensus is to keep you graphics relatively simple. There are several guides out there, but this one looks particuallry good:
http://snugug.com/musings/illustrator-raphael-js-guide
I am playing with generating dot files and then turned them into SVG graphs with a lot of nodes.
My question is that are there event listeners to detect mouse clicks on dot/SVG graph nodes?
For example, right click on a node in the SVG graph, I do something(maybe get the related information from the node and then do something),
Then how to generate dot file or SVG file to achieve this?
There are several ways to create an interactive SVG graph:
Use SMIL, an extension to svg (Example tutorial http://apike.ca/prog_svg_smil.html)
Javascript (the Raphael library is excellent)
CSS animations
In any case, you'll have to display the svg graphs in a client which supports any of those technologies (browser), and you will have to code it in addition to the svg output graphviz creates.
Just another thought on this (realizing the question is old, but maybe it helps someone coming across).
Depending on what you want to do, it may be easiest to decouple the event handling from the drawing. I mean, you can find out where graphviz positions the nodes (as well as edges, labels etc.), see, for example, this post on how to do it in python. Then you can paint the graph in the background of whatever GUI you're using, and use its native event handling to react on on_click by placing invisible clickable objects over the nodes.
If you want interactive graphs then graphviz might not be the best choice.
I'd recommend having a look at D3.js. Perhaps you could construct the graph data in json and load them with D3?
Can I rotate in a 3dish way a group tag in an SVG file?
Is there any need for an external JS library? I'd be glad to get a link somewhere.
Apparently 3d support isn't here yet so you have to make it look like there is three dimensions.
Have a look at the following links, they explain in detail how to use SVG to give a 3d effect.
rotating cube - wireframe (looks like 3d with controls to move it)
3d animation - advanced animation in 3d