Masking in Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    #1

    Masking in Java

    hi,

    i'm trying to create a game. it's a monopoly like game
    it needs masking because i need to draw the players on top of the board. while the player's image is not just square.

    how to do this in java?
    is that right that i can use png files to make this easy?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by thesti
    hi,

    i'm trying to create a game. it's a monopoly like game
    it needs masking because i need to draw the players on top of the board. while the player's image is not just square.

    how to do this in java?
    is that right that i can use png files to make this easy?

    I don't understand the phrase "while the player's image is not just square", it might
    be a little language problem, but yes you can draw and change the image to be
    drawn at any time you want. btw, not just .png files but also .jpeg (.jpg) and .gif
    images can be drawn.

    kind regards,

    Jos

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Originally posted by thesti
      hi,

      i'm trying to create a game. it's a monopoly like game
      it needs masking because i need to draw the players on top of the board. while the player's image is not just square.

      how to do this in java?
      is that right that i can use png files to make this easy?
      Images with transparency (from PNG or GIF files) can simply be drawn. If you want to do clipping (masking) then Graphics/Graphics2D has several methods to support this: clip, clipRect, getClip, setClip. Take the 2D tutoiral: http://java.sun.com/docs/books/tutorial/2d/index.html

      Comment

      • thesti
        New Member
        • Nov 2007
        • 144

        #4
        hi,

        thank you for the answers.
        so i can do it either with an image with transparency or with the clipping methods in Java.

        i'm learning both of the options now.
        maybe i'll ask question again later if i'm stucked.

        thank you

        Comment

        Working...