Results 1 to 11 of 11
  1. #1
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Where is source code for createImage(byte[] imagedata, int imageoffset, int imageleng

    As shown on java.awt: Toolkit.java, the toolKit classes createImage(byte[] imagedata) member function calls createImage(imagedata, 0, imagedata.length).

    Where is the source code for createImage(byte[] imagedata, int imageoffset, int imagelength)?

    Stephen

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    Toolkit (Java Platform SE 6)
    "Subclasses of the Toolkit class are used to bind the various components to particular native toolkit implementations."
    and
    Most applications should not call any of the methods in this class directly. The methods defined by Toolkit are the "glue" that joins the platform-independent classes in the java.awt package with their counterparts in java.awt.peer. Some methods defined by Toolkit query the native operating system directly.
    http://oreilly.com/openbook/javawt/book/ch15.pdf

    The Toolkit object is an abstract class that provides an interface to platform-specific details like window size, available fonts, and printing. Every platform that supports Java must provide a concrete class that extends the Toolkit class

  3. #3
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    Thanks for the link to the book.

    Ok, where can I find the platform specific source code for createImage(byte[] imagedata, int imageoffset, int imagelength)?

  4. #4
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    oO - for which platform? There a several implementations: sun.awt: abstract public class: SunToolkit

  5. #5
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    Windows 7.

  6. #6
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    Are you serious? ....
    System.out.println(Toolkit.getDefaultToolkit());

  7. #7
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    System.out.println(Toolkit.getDefaultToolkit()) returned sun.awt.windows.WToolkit.

    I looked in OpenJDK\jdk\src\windows\classes\sun\awt\windows\WT oolkit.java and I didn't find any createImage(byte[] imagedata, int imageoffset, int imagelength).

    Ok, I found out the WToolkit extends the SunToolkit which implements the createImage(byte[] imagedata, int imageoffset, int imagelength). Thanks.
    Last edited by shall; 04-10-2012 at 10:15 PM.

  8. #8
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    The SunToolkit class createImage(byte[] imagedata, int imageoffset, int imagelength) member function calls createImage(new ByteArrayImageSource(data, offset, length)).

    I couldn't find an associated createImage(ByteArrayImageSource ...) function.

    Does anyone know where its located?

    I noticed that ByteArrayImageSource extends InputStreamImageSource and that InputStreamImageSource implements ImageProducer .

    Does that mean that public Image createImage(ImageProducer producer) would be called? If so, why?

  9. #9
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    Quote Originally Posted by shall View Post
    Does that mean that public Image createImage(ImageProducer producer) would be called?
    Yes
    If so, why?
    ?? What do you mean with why? Why not? :) Strange questions.

  10. #10
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    I wasn't exactly sure that a ByteArrayImageSource could be thought of some sort of ImageProducer. But I'm fairly sure it can after reading another post about classes and interfaces.

  11. #11
    gillbates is offline Member
    Join Date
    Apr 2012
    Posts
    12
    Rep Power
    0

    Default Re: Where is source code for createImage(byte[] imagedata, int imageoffset, int image

    I was trying to figure out where the implementation for EntityManager was and found this thread. Using grep (The println trick, above, would have saved me some time.) I figured out that it was implemented in eclipse/persistence/internal/jpa/EntityManagerImpl.java but being kind of old school I wanted to know how java knew to go there.

    My guess is that the compiler maps all of the functions in all of the libraries in the build path and grabs the first implementation he sees. Is that right?

Similar Threads

  1. Replies: 16
    Last Post: 01-31-2012, 08:36 PM
  2. Replies: 0
    Last Post: 08-07-2011, 08:32 PM
  3. createImage
    By pabloma2002 in forum Eclipse
    Replies: 1
    Last Post: 01-18-2011, 06:30 PM
  4. SWT ImageData -- How to obtain number of channels
    By jiapei100 in forum SWT / JFace
    Replies: 0
    Last Post: 04-17-2010, 09:22 AM
  5. Replies: 1
    Last Post: 11-28-2008, 06:27 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
  •