Huux
YaBB Newbies
Offline
Posts: 3
Re: moving desktop
Reply #2 - Mar 13th , 2009, 12:50pm
thanks for the reply! it would be great to change the color of the whole screen, and other stuff. if you mean that by fancy transitions than, yes. also, later i want beeing able to load and animate buttons on the right....but that's not the thing at the moment. i now have switched to a texture thats placed on the screen. i think thats a better way transforming the image(skewing/translating). but it is still very slow. how can i get the image to be drawn faster? and i have tried to make a pimage out of the bi, but it didn't work ( PImage img = new PImage(bufferedImage); ) it didn't show up. also, i've solved the problem with the export. java somehow uses a main() function, so it caused problems when i named a function main(), so i renamed it to mainly(). but the most annoying problem is the flash of the backgroundcolor everytime i start the sketch or do a resize of the image. might there be another way besides positioning the full monitor-resolution-sized window outside the visible desktop, and then repositioning it by some kind of action??? -------------- import javax.imageio.ImageIO; import java.awt.*; PImage img; int imgY = 0; int frameX = screen.width-10; int frameY = 0; int frameGo = 0; captureDesktop desk; void setup(){ frame.setLocation(frameX,frameY); size(screen.width,screen.height/2, P3D); background(254, 63, 82); frame.setAlwaysOnTop(true); desk = new captureDesktop(); } void draw(){ if(mouseX >0 && frameGo!=1){ desk.mainly(); frame.setLocation(0,0); frameGo=1; } if(frameGo==1){ background(14,166,255); beginShape(); texture(img); vertex(0, 0, 0, 0); vertex(mouseX, 0, screen.width, 0); vertex(mouseX, screen.height/2, screen.width, screen.height); vertex(0, screen.height/2, 0, screen.height); endShape(CLOSE); println(mouseX+" "+frameRate); } } public void init(){ frame.removeNotify(); frame.setUndecorated(true); frame.addNotify(); super.init(); } class captureDesktop{ void mainly(){ try{ Robot robot = new Robot(); BufferedImage bufferedImage = robot.createScreenCapture(new Rectangle(new Dimension(screen.width,screen.height/2))); File imageFile = new File("image.jpg"); ImageIO.write(bufferedImage, "jpg", imageFile); img = loadImage("image.jpg"); } catch (AWTException e) { e.printStackTrace(); } catch (IOException IOerror){ System.out.println("Whoops!!"); } } }