Results 1 to 2 of 2
  1. #1
    wallyll is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Exclamation Problems with morphing Methods

    I am trying to use dr.java to create a morphing method, but when i test it, it comes out with white picture, anyone knows the reason?



    my code

    public void morphStage(Picture startPicture, Picture endPicture, int numStages, int k)
    {
    Pixel pixelArray1[] = startPicture.getPixels();
    Pixel pixelArray2[] = endPicture.getPixels();
    Pixel pixelObj1 = null;
    Pixel pixelObj2 = null;
    for(int i=0;i<pixelArray1.length;i++)
    {
    pixelObj1 = pixelArray1[i];
    int blueValue1 = pixelObj1.getBlue();
    int greenValue1 = pixelObj1.getGreen();
    int redValue1 = pixelObj1.getRed();
    pixelObj2 = pixelArray2[i];
    int blueValue2 = pixelObj2.getBlue();
    int greenValue2 = pixelObj2.getGreen();
    int redValue2 = pixelObj2.getRed();
    int blueValue = blueValue1 + ((blueValue2 - blueValue1)/(numStages + 1)) * k;
    int greenValue = greenValue1 + ((greenValue2 - greenValue1)/(numStages + 1)) * k;
    int redValue = redValue1 + ((redValue2 - redValue1)/(numStages + 1)) * k;
    pixelObj1.setRed(redValue);
    pixelObj1.setGreen(greenValue);
    pixelObj1.setBlue(blueValue);
    }
    }



    wally

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: Problems with morphing Methods

    Hello and welcome! Please use [code][/code] tags when posting code so we can easily read it!

    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

Similar Threads

  1. Help with morphing a picture
    By Fubarable in forum New To Java
    Replies: 4
    Last Post: 11-12-2012, 05:26 PM
  2. problems with boolean and recursive methods
    By mflb94 in forum New To Java
    Replies: 4
    Last Post: 09-27-2012, 11:40 AM
  3. Having problems with methods
    By JavatastesGood in forum New To Java
    Replies: 2
    Last Post: 10-02-2010, 11:57 PM
  4. Problems With Array/Methods
    By blueduiker in forum New To Java
    Replies: 4
    Last Post: 01-19-2010, 02:49 AM
  5. Morphing
    By aRTx in forum New To Java
    Replies: 4
    Last Post: 05-05-2009, 01:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •