📄 propertyclass.java
字号:
/*****************************************************************************
Description: PropertyClass
* This class holds static variables and methods which is usable for other objects
*
Created By: Johan Kateby
@file PropertyClass.java
COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2004.
The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
The use of the software is subject to the terms of the end-user license
agreement which accompanies or is included with the software. The software is
provided "as is" and Sony Ericsson specifically disclaim any warranty or
condition whatsoever regarding merchantability or fitness for a specific
purpose, title or non-infringement. No warranty of any kind is made in
relation to the condition, suitability, availability, accuracy, reliability,
merchantability and/or non-infringement of the software provided herein.
*****************************************************************************/
import javax.microedition.lcdui.*;
public class PropertyClass {
// Where are we saving our snapshots
public static String HOME_DIR = "file:///c:/other/";
// used for scaling down images
public static Image scaleDownImage(Image image, double factor) {
int sourceWidth = image.getWidth();
int sourceHeight = image.getHeight();
int smallWidth = (int)((double)sourceWidth*factor);
int smallHeight = (int)((double)sourceHeight*factor);
Image small = Image.createImage(smallWidth, smallHeight);
Graphics g = small.getGraphics();
for (int y = 0; y < smallHeight; y++) {
for (int x = 0; x < smallWidth; x++) {
g.setClip(x, y, 1, 1);
int dx = x * sourceWidth / smallWidth;
int dy = y * sourceHeight / smallHeight;
g.drawImage(image, x - dx, y - dy,
Graphics.LEFT | Graphics.TOP);
}
}
Image scaledDownImage= Image.createImage(small);
return scaledDownImage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -