Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 May, 2013, 15:01:11 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2]   Go Down
  Print  
Author Topic: Program to display computer screen 3 times before at 33% opacity- help! -  (Read 1079 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Offline Offline

Gender: Male
Last Login: Today at 08:18:01
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 614


Total Post Ratings: +52

View Profile WWW
« Reply #15 on: 28 March, 2012, 05:34:53 »
0

Sure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package screenrepeater;

import java.awt.*;
import java.awt.image.*;
import javax.swing.*;

public class ScreenRepeater extends JFrame {
   
    Image background = null;
    boolean bglock = false;

    public static void main(String[] args) {
        ScreenRepeater sr = new ScreenRepeater();
        sr.setSize(200, 200);
        sr.setAlwaysOnTop(true);
        sr.setVisible(true);
        sr.setDefaultCloseOperation(sr.EXIT_ON_CLOSE);
    }
   
    public ScreenRepeater() {
        Thread ssUpdater = new Thread() {
            public void run() {
                AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC, 0.2f);
                while (true) {
                    long time = System.currentTimeMillis();
                    try {
                        background = new Robot().createScreenCapture(new Rectangle(0, 0, getWidth(), getHeight()));
                        temp = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
                        Graphics2D g2 = (Graphics2D)temp.getGraphics();
                        g2.setComposite(ac);
                        g2.drawImage(background, 0, 0, null);
                        setTitle((1d / (double)(System.currentTimeMillis() - time) * 1000) + "");
                        sleep(1);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
        };
        ssUpdater.start();
        Thread repainter = new Thread() {
            public void run() {
                while (true) {
                    try {
                        repaint();
                        sleep(10);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
        };
        repainter.start();
    }

    BufferedImage temp;
   
    @Override
    public void paint(Graphics g) {
        g.drawImage(temp, 4, 25, null);
    }
}
Just probably don't try to learn good habits off of how I write code... =P
« Last Edit: 28 March, 2012, 05:35:23 by cooliojazz » Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.241 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.