Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Mirror Image Java

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Mirror Image Java

    Hi...

    I'm looking for at bit help to solve an assignment in my programming course.

    I have to mirror an image in BlueJay (java)

    I have the following code, but it is missing a little bit. My instructor gave me a hint. He said that i have to use the setValue() and getValue() methods, but i'm still confused..

    This code only return a black image with the same compositions as the image I want to mirror.

     
     public Image mirror()
        {
            Image  mirrorImage;
            mirrorImage = new Image(foto.getWidth(), foto.getHeight(), "spejling");        
     
            for(int i = 0; i < foto.getWidth(); i++) 
            {
                for(int j = 0; j < foto.getHeight(); j++) 
                {
                    Pixel p = foto.getPixel(i, j);
                    Pixel s = mirrorImage.getPixel(foto.getWidth() - i - 1, j);
     
                }
            }
            mirrorImage.pixelsUpdated();
            return mirrorImage;
     
        }


    thank you...

    - Mette
    Last edited by Mette; September 18th, 2014 at 04:33 AM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Mirror Image Java

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Please post your code correctly per the above link.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    Mette (September 18th, 2014)

  4. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Mirror Image Java

    done !

Similar Threads

  1. How to show the output image (using java) as resultant image in webpage
    By Mumpy Zinu in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: February 24th, 2014, 08:00 AM
  2. Selecting and dragging a image from multiple image in Java Applet
    By CY5 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 26th, 2013, 02:44 PM
  3. Vertical mirror help
    By bbjk08 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 24th, 2013, 07:31 AM
  4. Replies: 2
    Last Post: June 29th, 2009, 03:06 PM

Tags for this Thread