Omnimaga

General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: nxtboy III on March 15, 2012, 06:36:03 pm

Title: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 15, 2012, 06:36:03 pm
Hi,
Could someone make a program for me that displays the screen and 2 times before, all in 33% opacity? It would refresh every *blank*(You can choose) milliseconds. That way I could have stuff for my NXT look grayscale.
Would it really be that hard? Could somebody?

Thanks, and have a nice day,
nxtboy III
Title: Re: Program to display screen 3 times before at 33% opacity
Post by: nxtboy III on March 16, 2012, 02:02:57 pm
So, would this be hard to make? It would help me...
Title: Re: Program to display screen 3 times before at 33% opacity
Post by: Xeda112358 on March 16, 2012, 02:23:31 pm
I've no clue how to approach this :/ Does the NXT natively support grayscale? If not, how easy is it to do bitwise logic?
Title: Re: Program to display screen 3 times before at 33% opacity
Post by: nxtboy III on March 16, 2012, 04:53:51 pm
No, the NXT does not natively support grayscale, just like the TI 84. What's bitwise logic?
Also I was talking about a computer program to do this, so I could use a utility that captures my NXT's screen (It captures it in monochrome). When I said "screen", I was talking about the computer screen, not the NXT's.
Title: Re: Program to display screen 3 times before at 33% opacity
Post by: Xeda112358 on March 16, 2012, 04:56:22 pm
Ah, okay. No, I wouldn't even know where to begin, sorry.
Title: Re: Program to display screen 3 times before at 33% opacity
Post by: nxtboy III on March 16, 2012, 04:58:55 pm
Yeah...
I would need someone who can program computers.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: jnesselr on March 17, 2012, 12:18:23 am
I can program both the nxt and the computer.  No, grayscale shouldn't work on the nxt.  It's not really made for games like that.  What are you programming the nxt with?

Might I suggest, if you want to use it as a controller, to use the usb routines from lejos, and write a computer program that emulates itself as a virtual key-board.  You can configure the buttons on the nxt to respond to certain key-presses.

My main question, though, is why you want to do this.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 17, 2012, 12:48:07 am
???
I already have made grayscale games on the NXT. Check in my sig, After Dark. It's a grayscale NXT game. I wanted a computer program to show the computer screen 3 times (current frame and a certain time before (twice) ) at 33% opacity.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: DJ Omnimaga on March 17, 2012, 12:54:34 am
Basically a NXT emulator for Windows? (with Axe/83+ASM grayscale style scanlines?)
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 17, 2012, 12:57:20 am
That would be better, (It would be AWESOME) but I was just asking for a program to display the computer screen 3 times (current frame, and frame at a certain time before(Then again))at 33% opacity.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 26, 2012, 07:28:20 pm
So this is what I want the program to do with the 3 pictures:

Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: cooliojazz on March 27, 2012, 12:46:28 am
To completely capture the whole screen sans-ss and then combine it with other ss, and then redisplay the combined ss fullscreen would take some sort of native hacks I feel like.  This was the closest i could get in java i think, good enough?
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: DJ Omnimaga on March 27, 2012, 02:37:23 am
Cooliojazz he meant multiple screens as in motion-blur

EDIT Actually nvm, for odd reasons the fuirst time I ran your program it ran so fast that I didn't see the motion blur.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 27, 2012, 06:52:01 pm
To completely capture the whole screen sans-ss and then combine it with other ss, and then redisplay the combined ss fullscreen would take some sort of native hacks I feel like.  This was the closest i could get in java i think, good enough?

How about it could take just a part of the screen, like you did in your .jar program, then it will save a screenshot every n milliseconds(you type in what n will be), and it will display the current screen, and 2 ones before.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: ruler501 on March 27, 2012, 09:34:28 pm
When you display the screenshot though it wont actually be gray will it? It will be the black/white colors wont it
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 27, 2012, 09:37:26 pm
it will be gray, cuz it is showing all 3 pics at 33% opacity.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: ruler501 on March 27, 2012, 10:15:30 pm
oh I get it now sorry
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 27, 2012, 10:17:29 pm
Ok. Could you make that program? Do you know how?
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: ruler501 on March 27, 2012, 10:18:50 pm
maybe not completely sure how to do it but I'll look into it

EDIT: How fast would you expect the NXT emulator to run(fps) without the 33% opacity?
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 27, 2012, 10:28:34 pm
Actually, its not an emulator, it just displays the screen of the NXT that is plugged into the computer. It refreshes every 50 ms.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: ruler501 on March 27, 2012, 10:52:33 pm
Is it open source? That would make it a lot easier to do otherwise I might be able to do it but I'm not sure how well it would work.

I've only used SDL for video work but it cant capture images from other programs so I have to figure out something else to use. I think I'll use D3D9 because i found a fast way to capture the screen with it. Now if I can convert that to a SDL_Surface with set user boundaries it should work I think
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: cooliojazz on March 27, 2012, 11:22:23 pm
nxtboy, did you actually try the program i wrote?  it doesn't necessarily show EXACTLY 3 frames at EXACTLY 30% opacity every time, it more layers a crapload of them at closer to 40%, but it has a similar effect to what you want I think... since I don't have that emulator i obviously couldn't test the exact values to make it seem grayest...
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: ruler501 on March 27, 2012, 11:26:36 pm
cooliojazz Could I see the source for your program? I'd just like to look at it to see how you did it. Also I'm trying to learn java so I would like to just read throug some real world programs to see how to make programs
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: cooliojazz on March 27, 2012, 11:34:53 pm
Sure
Code: [Select]
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
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: DJ Omnimaga on March 27, 2012, 11:36:12 pm
By the way Cooliojazz program would be nice if it captured a fixed regiion of the screen and the captured stuff remained in the middle. Basically some sort of window that creates a motion blur effect on the screen area where it is.
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: cooliojazz on March 27, 2012, 11:41:15 pm
DJ, I was searching for a way to do something like that, but java's screen-capturing utility basically just captures the whole area including windows in your program, so to do something like that, I would have to make the program constantly minimize and un-minimize itself, or constantly toggle between full size and (0,0), or something like that every time i capture the screen, all which take far too long and/or render the program un-interactable (have fun trying to close it now... =P) So i figured just leaving it fixed in the corner would serve the purpose at least...
Title: Re: Program to display computer screen 3 times before at 33% opacity- help!
Post by: nxtboy III on March 28, 2012, 06:03:23 pm
Yeah, I tried your program, but it doesn't work for what I am doing.
So could you do what I said maybe?