当前位置: 技术问答>java相关
请问可以在APPLET程序中将图象旋转90度显示吗?
来源: 互联网 发布时间:2015-04-02
本文导语: 请问可以在APPLET程序中将图象旋转90度显示吗?如果可以的话,怎么实现?我用drawImage方法(带十个参数来做,没做出来)。谢谢帮忙!! | from http://www.rgagnon.com/javadetails/java-0248.html Rotate an...
请问可以在APPLET程序中将图象旋转90度显示吗?如果可以的话,怎么实现?我用drawImage方法(带十个参数来做,没做出来)。谢谢帮忙!!
|
from http://www.rgagnon.com/javadetails/java-0248.html
Rotate an image
The following snippet rotates an image (90 degrees). The applet assumes the dimension 32x32 for the image. You may want to grap this image for testing purpose.
import java.applet.Applet;
import java.net.*;
public class rotateGumby extends Applet {
Image img = null;
Image rot = null;
int buffer[] = new int[32 * 32];
int rotate[] = new int[32 * 32];
public void init() {
try {
MediaTracker tracker = new MediaTracker (this);
img = getImage(new URL(getDocumentBase(), "gumby.gif"));
tracker.addImage (img, 0);
tracker.waitForAll();
PixelGrabber grabber =
new PixelGrabber(img, 0, 0, 32, 32, buffer, 0, 32);
try {
grabber.grabPixels();
}
catch(InterruptedException e) {
e.printStackTrace();
}
for(int y = 0; y
Rotate an image
The following snippet rotates an image (90 degrees). The applet assumes the dimension 32x32 for the image. You may want to grap this image for testing purpose.
import java.applet.Applet;
import java.net.*;
public class rotateGumby extends Applet {
Image img = null;
Image rot = null;
int buffer[] = new int[32 * 32];
int rotate[] = new int[32 * 32];
public void init() {
try {
MediaTracker tracker = new MediaTracker (this);
img = getImage(new URL(getDocumentBase(), "gumby.gif"));
tracker.addImage (img, 0);
tracker.waitForAll();
PixelGrabber grabber =
new PixelGrabber(img, 0, 0, 32, 32, buffer, 0, 32);
try {
grabber.grabPixels();
}
catch(InterruptedException e) {
e.printStackTrace();
}
for(int y = 0; y
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!