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.
Related
I want to know if there is any solution for the following scenario:
I have an application which uploads the files, after scanning and transcoding them, onto a server. Suppose, an image file is being uploaded which has been tampered with some additional contents over it. Now, as the uploaded file is illegitimate, I want to remove the additional tampered contents and upload just the original part of this image file. Is it possible to do so in Java?
Thanks.
It's not possible to detect in the general case, but there are some heuristic methods available to determine whether an image has been edited. Try using the tools at http://imageedited.com/ to get an idea of what's possible.
Removing the edit is a much more difficult problem, which is probably impossible with current methods.
I'm just speculating here, and I don't know how well it would work in practice, but you could do it if you limit to specific sources of tampering. E.g., suppose you want to remove the logo added to an image by memegenerator.net.
You know in advance what the text looks like and where it is. Create a transparent png template that matches the text. Then sum the differences between the image and template pixel colors, multiplying each by the alpha of the template pixel. Since for this particular logo, it's basically white (although it seems to have a thin black shadow) you would get false positives for a picture with a white part there, so you'd also need to verify that the surrounding pixels are (within a tolerance) not white. It's not clever but it could work for certain sites.
For anything more flexible (e.g., logos on images which have subsequently been resized) you're in to the territory of OCR and TinEye-like image matching, which are more advanced than I could advise you on.
To correctly detect all kinds of "tampering" and filter "illegitimate" from "legitimate" in general, you'd need an artificial intelligence that could understand the meaning and context of what it's seeing. The short answer is: you can't. That's what humans are for.
If this is for a website, probably the best thing you can do is a report button that lets users of your site report images that don't fit with your site's rules.
i am new to java 3d. i have encountered a situation like , i want to load ready made developed 3d model of any object [as an example shoe] developed in 3d modeling software like 3d studio max or Maya in my java program , update its texture or color properties etc. then render it and then display the updated model to the end user.
so i am asking all the 3d experts how should i proceed ahead to accomplish my goal ?
which input should i load into my program ?
how can i update the loaded model , render it and display the updated model to the end user ?
in simple story , i want to give my users ability to modify 3d model by their interactions as such ,
they provided 3d model of shoe for example in default colors and textures & some fields like sole color , if they choose color red then the loaded 3d model's sole is colored red (i.e. updated) and then displayed to end user with red color rubber sole shoe instead of default color shoe.
please, advice me to accomplish my goal.
Ok so first of all, complex objects are usually created using some 3D editing software like Blender or Art of Illusion. These programs can output the object into several different file formats, the most common being the .obj file format:
http://en.wikipedia.org/wiki/Wavefront_.obj_file
Another common format is .3ds, which in my experience is a lot more work than it's worth. They do make a .3ds file loader for Java3D, the page can be found here:
http://www.starfireresearch.com/services/java3d/inspector3ds.html
My advice for you is to just use the .obj file format, it is a lot easier to use. You can also just make your own parser for it which is not as hard as it sounds. This way you know exactly how your object is being loaded into the environment. Java does come with it's own parser, instructions on how to use it are here:
http://www.vrupl.evl.uic.edu/LabAccidents/java3d/lesson08/indexa.html
I have had a lot of trouble with files exported with Blender while using this file format unfortunately, they may have fixed the problem by now but I'm not sure. When I used to do a lot more 3D stuff I just used Art of Illusion, even know Blender is a lot more powerful. Blender can be run on a Mac but is a lot smoother on windows with the proper setup. Good luck! If you need some example code let me know and I would be more than happy to post some for you.
Art of Illusion:
http://www.artofillusion.org
http://www.artofillusion.org/documentation#
Blender:
http://www.blender.org
http://www.blender.org/education-help/tutorials/
Im not sure how you want the user to be able to change the object. If you want them to be able to change the color, or the type of shoe or whatnot that is not a huge deal. If you want the user to be able to change the lace length or something where you are changing the actual object's structure, that requires an in depth knowledge of 3D structure. If you want to change a color, just change the material. If you want to be able to change the type of shoe, just load a different shoe object. I hope this was helpful for you.
In the comments, you also talk about texture mapping, which in my experience is a lot easier to do in Blender than it is to do in Art of Illusion. I would probably use blender to accomplish this:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV
John
I assume you just want the user to select a different texture/color, right?
Then have a look at the Java3D tutorials out there, e.g. this one: http://www.java3d.org/tutorial.html
I further guess your shoe is actually a 2-part model, i.e. just the sole should get another color while the rest might get a different texture, right?
In that case, you'd need 2 models/shapes, each with its own appearance. Then, for example, alter the soles appearance as you like, e.g. by assigning a different material or changing the material's color.
I don't have much experience in Java, but I am attempt to write a simple rogue-like game to familiarize myself with it, and I am just wondering how I would go about creating an interface like this:
Are there any obvious ways that you would go about something like this? Being new to Java, I really have no idea what the best method would be.
Sorry to be vague!
Thanks
There is no such (simple) component in the JDK - if you don't need color, a JTextArea can be used to display ASCII-Art (after setting a fixed-width font). You will need to take care not to run into characterset issues (if you don't stick to US-ASCII 7-bit).
Writing a component that handles color display (and maybe escape sequences, in essence emulates a console window) wouldn't be too hard, but if you just started with Java it may prove to be an unwelcome challenge.
You could also just write your game in Java and leave displaying the ASCII to the system console (your game would simple output to stdout).
Edit: Color ASCII could be acieved by converting your internal format to (simple) HTML and that HTML could be displayed using a JLabel. Its probably not the most elegant method, but it should be reasonably simple to implement (and with nowadays hardware speed should not be an issue with this approach either). This approach builds on the capability that you can just use JLabel.setText() and pass a string that starts with a HTML tag. The JLabel then interprets the whole text as HTML.
Check out Trystan's Ascii Panel, and his blog and tutorial on making a roguelike here.
Better late than never, right? You may want to check Zircon Project.
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.
We have a requirement where we already have pre printed stationery and want user to put data in a HTML form and be able to print data on that form. Alignment/text size etc are very important since the pre-printed stationery already has boxes for each character. What could be a good way to achieve this in java? I have thinking of using jasper reports. Any other options? May be overlay image with text or something?
Also we might need to capability to print on plain paper in which case the boxes needs to be printed by our application and the form should match after the printed with the already printed blank stationery containing data.
Do we have some open source framework to do such stuff?
Jaspersoft reports -- http://sourceforge.net/projects/jasperreports/
You will then create XML templates, then you will be able to produce a report in PDF, HTML, CSV, XLS, TXT, RTF, and more. It has all the necessary options to customize the report. Used it before and recommend it.
You will create the templates with iReport then write the code for the engine to pass the data in different possible ways.
check http://www.jaspersoft.com/jasperreports
Edit:
You can have background images and overlay the boxes over it and set a limit on the max character size ... and many more
It is very powerful and gives you plenty of options
Here is one of iReport's tutorial for a background image http://ireport-tutorial.blogspot.com/2008/12/background-image-in-ireport.html
The big problem when printing form content that has been filled in electronically, is aligning it correctly on the pre-printed form. You may get content to align for one printer, but when you use another it is completely misaligned.
Fly Software have a form design product called InForm Designer that gets around the problem nicely by allowing users to specify and save vertical and horizontal offsets for printers. This ensures filled in form content is always aligned. I've tried it and it works perfectly. Take a look for yourself here...
http://www.flysoftware.com/products/inform_designer/overview.asp
It might be worth implementing a printer offset similar to InForm's in your own application (if possible).
Some things to think about.
First in terms of the web page, do you want use the stationery as the form layout?
Does it have to be exact?
Combed boxes (one for each character)
Do you want to show it like that on the web page, or deal with the combing later.
How are you going to deal with say a combed 6 digit number. Is this right aligned. What if they enter 7 digits. Same for text. what if it won't fit.
Font choices, we had a lot of fun with W...
How aligned do you want the character within the box, what font limitations does that imply, some of the auto magic software we looked at did crap like change the size of each character.
Combed editing is a nightmare, we display combed, but raise an edit surface the size of the full box on selection.
Another thing that might drive you barking mad, you find find small differences in the size and layout of the boxes, so they look okay from a distance but a column of boxes sort of shifts about by a pixel. Some of testing guys had to lend us their electron microscopes, so we could see how many ink molecules we were out by. :(
Expect to spend a lot of time in the UI side of things, and remember printed stationery changes, so giving yourself some sort of meta description of the form to start with will save you loads of trouble later on.