📄 bitmap.java
字号:
/*
* BITMAP.java
*
* Created on 15. M鋜z 2007, 14:39
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.xvolks.jnative.misc.basicStructures;
import org.xvolks.jnative.exceptions.NativeException;
import org.xvolks.jnative.misc.basicStructures.AbstractBasicData;
import org.xvolks.jnative.pointers.Pointer;
import org.xvolks.jnative.pointers.memory.HeapMemoryBlock;
import org.xvolks.jnative.pointers.memory.MemoryBlockFactory;
/**
*
* @author osthop
*/
public class BITMAP extends AbstractBasicData<BITMAP> {
/** Creates a new instance of BITMAP */
public BITMAP() {
super(null);
try {
createPointer();
} catch (NativeException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
public Pointer createBitmapBuffer() throws NativeException {
return new Pointer(new HeapMemoryBlock(getNeededBufferSize()));
}
public int getWidth() throws NativeException {
return pointer.getAsInt(4);
}
public int getHeight() throws NativeException {
return pointer.getAsInt(8);
}
public int getNeededBufferSize() throws NativeException {
return getWidth()*getHeight()*4;
}
public int getRealBitmapSize() throws NativeException {
return getWidth()*getHeight();
}
public Pointer createPointer() throws NativeException {
pointer = new Pointer(MemoryBlockFactory.createMemoryBlock(getSizeOf()));
return pointer;
}
public int getSizeOf() {
return 24;
}
public BITMAP getValueFromPointer() {
return this;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -