Menu

How do I display picture files?

voyager29
2010-09-14
2013-04-25
  • voyager29

    voyager29 - 2010-09-14

    The name says it all, how do I make JUDO display an image file?
    Code spinets would be nice…
    Any ideas?
    Its been bugging me for the last week…

     
  • Thomas Dunn

    Thomas Dunn - 2010-09-16

    Hello Voyager29,

    Unfortunately there is no built in support for drawing images in JUDO.  I agree this would be something nice to add in a future version.

    There is an object available in your JUDO programs called "jud0_graphics" - note that is a zero in jud0.  This is the object that is used for most of the graphics functions in JUDO.  In theory you should be able to use the Graphics.drawImage() method  to do what you are asking about.  Doing this is someone leaving the world of JUDO and getting more into straight Java code.  I tried it briefly and didn't get it to work, but maybe you or someone else can figure it out.

    Here are a couple pointers.
    http://download.oracle.com/javase/1.4.2/docs/api/java/awt/Graphics.html#drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
    http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter06/images.html

    Have fun,
    Tom

     
  • voyager29

    voyager29 - 2010-09-17

    Thank you for your help Tom.
    I'm making a point of learning Java, and Judo is for my quick programs.
    Judo doesn't make intense math easy to code though…
    But that's another post :)

     
  • Anonymous

    Anonymous - 2011-02-08

    void main() {

        Image img = Toolkit.getDefaultToolkit().getImage("C:\\Documents and Settings\\User\\Desktop\\a.gif");
        int x = 0;
        int y = 0;
    
        while (true) {
            jud0_graphics.drawImage(img, x, y, this);
        }
    }
    

    its cool that JUDO can do this!

    notes{
    I have only tested it on a GIF picture;

    you do not need a while (true) {}, however you will need to declare an ImageObserver for it and use that… more trouble;

    this does not have any error handling
    }

    Anyways. I only tested this once, I am a bit busy. I will submit a sample program on judo.sourceforge.net soon.

    Thanks,

    Edac

     

Anonymous
Anonymous

Add attachments
Cancel