
Last time, I showed that you could rotate an image 180 degrees in what amounts to one line of JavaScript, basically just doing pixels.reverse( ). Rotating an image by an arbitrary amount (something other than 180 degrees) is almost as easy. It requires about 8 lines of code.
JavaScript for doing the rotation with the Java Advanced Imaging API is shown below. JAI makes short work of this and a ton of other graphics transformations. All you have to do is be sure the JAI JARs are in your classpath. Then you can set up a transformation by creating a ParameterBlock with appropriate parameters (in this case, the x- and y-coordinates of the rotation origin, the amount of rotation in radians, and optionally a rendering hint as to what kind of pixel interpolation you'd like; in this case, we don't specify a hint and thus accept the default of INTERP_NEAREST).
Note that JAI expects parameters of type float, which is not what JavaScript provides by default. By default, numbers in JavaScript are doubles. So you have to explicitly create java.lang.Floats as shown.
As in previous posts, I'm using my little ImageMunger app to run the script.
Also, as with previous scripts, performance is quite good (through no fault of my own): rotation occurs at a rate of about 500 pixels per millisecond on a Dell Inspiron laptop with 2.2 GHz Intel Duo processor running (gack!) Windows Vista. Which ain't bad at all. I'll take 500-pixels-per-millisec throughput any day, on any OS.
Great and informative stuff. Keep bloggingn nad thanks.
ReplyDeleteRegards,
clipping path
pb = new Packages.java.awt.image.renderable.ParameterBlock().addSource(Image);
ReplyDeletepb.add(new Float(0));
pb.add(new Float(0));
pb.add(new Float(Math.PI/8));
image = Packages.javax.media.jai.JAI.create("rotate",pb).getRendering().getAsBufferedImage();
Panel.setImage(image);
Useful tips, thanks!
ReplyDeleteVery much useful article. Kindly keep blogging
ReplyDeleteJava Training in Chennai
Java Online Training India
Drawing trend lines is one of the few easy techniques that really WORK. Prices respect a trend line, or break through it resulting in a massive move. Drawing good trend lines is the MOST REWARDING skill.
ReplyDeleteThe problem is, as you may have already experienced, too many false breakouts. You see trend lines everywhere, however not all trend lines should be considered. You have to distinguish between STRONG and WEAK trend lines.
One good guideline is that a strong trend line should have AT LEAST THREE touching points. Trend lines with more than four touching points are MONSTER trend lines and you should be always prepared for the massive breakout!
This sophisticated software automatically draws only the strongest trend lines and recognizes the most reliable chart patterns formed by trend lines...
==> http://www.forextrendy.com?vgcvasdiugf9g87346
Chart patterns such as "Triangles, Flags and Wedges" are price formations that will provide you with consistent profits.
Before the age of computing power, the professionals used to analyze every single chart to search for chart patterns. This kind of analysis was very time consuming, but it was worth it. Now it's time to use powerful dedicated computers that will do the job for you:
==> http://www.forextrendy.com?vgcvasdiugf9g87346
Drawing trend lines is one of the few easy techniques that really WORK. Prices respect a trend line, or break through it resulting in a massive move. Drawing good trend lines is the MOST REWARDING skill.
ReplyDeleteThe problem is, as you may have already experienced, too many false breakouts. You see trend lines everywhere, however not all trend lines should be considered. You have to distinguish between STRONG and WEAK trend lines.
One good guideline is that a strong trend line should have AT LEAST THREE touching points. Trend lines with more than four touching points are MONSTER trend lines and you should be always prepared for the massive breakout!
This sophisticated software automatically draws only the strongest trend lines and recognizes the most reliable chart patterns formed by trend lines...
==> http://www.forextrendy.com?kdhfhs93874
Chart patterns such as "Triangles, Flags and Wedges" are price formations that will provide you with consistent profits.
Before the age of computing power, the professionals used to analyze every single chart to search for chart patterns. This kind of analysis was very time consuming, but it was worth it. Now it's time to use powerful dedicated computers that will do the job for you:
==> http://www.forextrendy.com?kdhfhs93874
Drawing trend lines is one of the few easy techniques that really WORK. Prices respect a trend line, or break through it resulting in a massive move. Drawing good trend lines is the MOST REWARDING skill.
ReplyDeleteThe problem is, as you may have already experienced, too many false breakouts. You see trend lines everywhere, however not all trend lines should be considered. You have to distinguish between STRONG and WEAK trend lines.
One good guideline is that a strong trend line should have AT LEAST THREE touching points. Trend lines with more than four touching points are MONSTER trend lines and you should be always prepared for the massive breakout!
This sophisticated software automatically draws only the strongest trend lines and recognizes the most reliable chart patterns formed by trend lines...
==> http://www.forextrendy.com?kdhfhs93874
Chart patterns such as "Triangles, Flags and Wedges" are price formations that will provide you with consistent profits.
Before the age of computing power, the professionals used to analyze every single chart to search for chart patterns. This kind of analysis was very time consuming, but it was worth it. Now it's time to use powerful dedicated computers that will do the job for you:
==> http://www.forextrendy.com?kdhfhs93874
There are many packers and movers in Hyderabad who are looking for ways to make easy money from innocent families and individuals like you who are planning to relocate.
ReplyDeleteMovers and Packers in Kondapur
Movers and Packers in Gachibowli
Movers and Packers in Kukatpally
Movers and Packers in Chanda Nagar
Movers and Packers in Manikonda
Many packers and movers Hyderabad, Telangana may boast about offering a huge list of services with little to no skill or expertise to carry out those services as required.
ReplyDeletePackers and Movers Hyderabad
Packers and Movers in Kondapur
Packers and Movers in Gachibowli
Packers and Movers in Kukatpally
The packer and movers in Hyderabad load and unload your household items using the necessary equipment and techniques depending on your specific requirements.
ReplyDeleteMovers and Packers in Chanda Nagar
Movers and Packers in Nallagandla
Movers and Packers in Kukatpally
Movers and Packers in Miyapur
Thanks for your stop at Indian Packers and Movers in Mumbai. We really know the intentions of the people who are moving their homes or offices in Mumbai. We are one of the best Packers And Movers in Mumbai that gives values to the suggestions and recommendations of the client. It is this heart reading and friendly packing and moving service that made us the most loved packers and movers in Mumbai to depend for professional local transport in Mumbai, courier services in Mumbai and relocation services Mumbai and more.
ReplyDeleteMovers and Packers in Chembur
Movers and Packers in Jogeshwari
Movers and Packers in Kharghar
Movers and Packers in Dombivli
We are known manufacturers of modern classic chair. The designs are so attractive that you will be confused among which one to buy. Our products are well appreciated by top interior designers, esteemed customers and architects. We not also supply our products to offices but also in many hospitals, schools, restaurants, auditorium and cafeterias. We also deal in the supply of lounge sofas, education benches and office tables.
ReplyDeleteVisitor Chair Supplier in Mumbai
Chair Dealers in Mumbai
Top Chair Manufacturers in Mumbai
Best Chair Manufacturers in Mumbai