JNI win32 and Layered windows.
Hi, recently I wrote a DLL to make javas windows transparent in win32.
The file works partially, thats the weird thing. When setting the window
to transparent, the window becomes transparent, and drawing to its
Graphics works as long as you don't use drawImage, if you use drawImage,
the window stops being transparent. Any ideas on whats wrong?
JNI makeTransparent:
SetWindowLong(hwnd, GWL_EXSTYLE, oldGWL_EXSTYLE | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwnd, color, alpha, flags);
Java:
class Wnd extends Window{
public void paint(Graphics g){
g.drawRect(10, 10, 10, 10); // <-- Works fine
g.drawImage(image, 0, 0, null); // <-- results in a non
transparent window 80% of the time.
}
public static void main(String[] vArgs){
Window w = new Wnd();
int hwnd = JNI.getWindowHandle(w);
int color = new Color(0xff, 0x00, 0xff).getRGB();
JNI.makeTransparent(hwnd, color, 0, JNI.LWA_COLORKEY);
}
}
//Regards
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---