j2me中如何改变图片的大小合透明度
来源:百度知道 编辑:UC知道 时间:2024/05/16 11:36:39
1. 对图片进行缩放:输入参数为图片的指针/引用、缩放后的宽,高;
2. 修改图片透明度:输入参数为图片的指针/引用、透明度(百分比);
代码要求:答案分为两部分一部分为代码,一部分为语言描述的编写思路;可以定义全局变量/类变量。答案还可以对编辑内容进行选择,可选择其中任意的一种,也可以全部选择。
谢谢..急..
图片大小
/** A demonstration of anti-aliasing */
public class AntiAlias extends JPanel {
static final int WIDTH = 650, HEIGHT = 350; // Size of our example
public String getName() {
return "AntiAliasing";
}
public int getWidth() {
return WIDTH;
}
public int getHeight() {
return HEIGHT;
}
/** Draw the example */
public void paint(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
BufferedImage image = // Create an off-screen image
new BufferedImage(65, 35, BufferedImage.TYPE_INT_RGB);
Graphics2D ig = image.createGraphics(); // Get its Graphics for drawing
// Set the background to a gradient fill. The varying color of
// the background helps to demonstrate the anti-aliasing effect
ig.setPaint(new GradientPaint(0, 0, Color