Is there a way to show an SVG image in a GEF editor? I found that one can convert the SVG image in a SWT image but I need it to be in vector format, so that when I zoom in I don't get quality loss.
According to this site, you should be able to use the SVGFigure class of GMF.
This class does not have dependencies to GMF.
Ok, I finally found something that works.
It seems like using org.eclipse.gmf.runtime.draw2d.ui.render.figures.ScalableImageFigure ist the answer. ScalableImageFigure is a sublcass of Figure so it works like a normal GEF Figure.
You cand find this in the runtime library pack from GMF.
Using ScalableImageFigure you can show an SVG image in GEF but when you zoom in you still get quality loss. To overcome this you need to sublcass ScalableImageFigure and implement org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode. When you zoom in the scalable figure will be repainted, and the image rerendered. org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode.LPtoDP(Translatable) will return the scale for the image to be rendered. I didn't have enough time to properly implement this interface, I just needed to check if it works so i simply created a field in the subclass(int named scale with default value 1) which is incremented each time LPtoDP is called
public Translatable LPtoDP(Translatable t) {
t.performScale(scale++);
return t;
}
This is totally experimental, when I will implement this feature in our application I'll revisit this Question and post a functional and corect implementation of this interface and class.Until then I hope this will help others who are looking into something like this.
Related
I wanted to know the best way of taking a list of images which come from an HTTP request, each image then needs to be retrieved.
I would then like to use the images to make an animation behaviour so it looks like the list of images is for example an animated gif. Moving between each image using a configurable time period.
This needs to be done using GWT. I saw that you can create a custom animation by using extends Animation and I also saw AbstractImagePrototype but I'm not sure what to use, also exists AnimationScheduler.
I made a simple example with javascript using setInterval but its not clear in GWT how this should be done.
Thanks for any help.
I own a sports apparel company and I'm looking to have an applet built that will allow customers to see how their team names will look in certain colors on jerseys. Below you can see the final result of a competitor site's Flash applet where text is rendered on 2D surfaces/images.
My requirements: I need users to be able to set the font, primary text color, outline text color, and text style (arched or straight).
So my question-- Is this sort of text rendering possible with only Javascript/PHP?
If so, what limitations do you for see? I've been told the arching and outline text color may be issues. I've also been told that I may have to upload library files to a server where the actual rendering may take place.
If not, what scripting would you guys recommend? I'm trying to stay away from Flash because it's slow and costly.
I'll be passing this onto our developers so please feel free to be as detailed as possible. I figure'd I'd save them some leg work!
Thank you!
Depending on how complex you want your graphics to be, html5 drawing abilities could be used. Check Raphaƫl library, for instance, webGL/canvas renderers already have a lot of features in modern browsers.
As of the solution with server rendering, it's also possible with gd2(php), but imho that would be less convenient, at least try something different from php (btw, what's your backend running on?)
Your competitor's solution with java applet honestly seems the easiest, except that it requires jre, which few people are eager to install =)
That's kind-of a high level question, but yes you can definitely use javascript for it.
If there's a problem with getting characters to look right, you can always save each letter as a separate image and have javascript place them next to each other in preview. I'd try to see how close you could get with the existing fonts first.
Layering the text: one color large font, then a different color smaller font will give you the outline effect your looking for.
I want to write an address in the address bar of a browser as well as click on a link using java Robot class. How can I track the different objects in a certain window?
Just giving a look at the API http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html, anyone who do this should know that via Robot Class there is no "trackComponent(Component specificComponent)" method, you got 2 things that may help you:
1-getPixelColor (more than help, seems useless for you by now, maybe i'm wrong).
2-createScreenCapture.
the second method is maybe the answer for your problem, you could take a picture of the screen and with some image processor (javaCV could help you on this: https://code.google.com/p/javacv/) you could then track the components on the screen you took (for instance: from pixels xxx to pixels yyy is the Address bar of browser), of course you need to read some documentation about javaCV (OpenCV) for get this done, after that just use the method for move cursor and enter keys for fill the components, hope someone give a simpler way to do this, but i think this way you learn a bit of JavaCV a really powerful tool.
I want to create a timeline-based editing GUI in java - in the style of a video-editing software (such as adobe premiere for example). Below is an image, how I have the GUI in mind (sorry for not including it directly - as a new user that feature is disabled):
Whats currently implemented is just the timeline-slider at the top (with JSlider) - all the rest is just made up with Photoshop (also the black-line that goes down from the slider, through the layers).
Now my question is not very specific, I just wanted to get some input how I could implement the rest as nice as possible. To be a little bit more precise, I would appreciate hints to the following topics very much:
How to organize the whole gui - concerning the time indicator-line
which goes from the top to the bottom through all the layers?
How to visualize the waveform, are there good (and free) packages
that can be used? (audio files are either MP3 or WAV)
Which element to use for the text-segment layers (they should be draggable & droppable somehow) -> JLabels, JButtons, how to best solve the drag-n-drop feature?
You see I have still some work ahead of me, any good advice or point to the right direction would be very kind!
For the waveform issue you could take a look to this question and the accepted answer. The class creates a PNG image file, but you should be able, instead of saving the image, just display it in your programm.
The drag n' drop thing is well explained in this tutorial by Oracle.
I will explain my question clearly.
I need to zoom in/zoom out the world map.
When I click on the particular country in map, control should redirected to new page with respective the country.
I dont have any idea about this in java. Please explain the steps to acheive the above task.
As the question is quite general, here is a general answer: Zooming often means, that you want to display a certain percentage of somethin, and not the whole, where your size of the displayed will not change.
But in your case it seems more like a "find a mouse click in a polygon" thing. So you have to add a selection/click listener to whatever widgets you use (Swt? swing? ....?) where you change what your program renders.
It sounds like you may be trying to reinvent the wheel. Google etc have already solved this problem rather well. It might be better to incorporate an existing solution into your application. Have a look at GoogleEarth inside Java Swing.