ks.common.view
Class CardImages

java.lang.Object
  extended byks.common.view.CardImages

public class CardImages
extends java.lang.Object

Responsible for returning images for cards (as well as reverse).

This class is only responsible for storing images that some other entity has created.

Calculates card size based on reverseImage.

For V1.7 moved Loading code out of this class, and into CardImagesLoader. For V2.1 removed static fields and made first-class entity.


Constructor Summary
CardImages()
          Create CardImages object with no associated images.
 
Method Summary
 java.awt.Image getCardImage(Card c)
          Get the card image given a Card Object.
 java.awt.Image getCardImage(int rank, int suit)
          Extracts the card resource based upon the name.
 java.awt.Image getCardReverse()
          Get the reverse image for a card.
 int getHeight()
          Return the individual height (in pixels) of each card.
 java.lang.String getName()
          Return Name for this deck class.
 int getOverlap()
          Overlap is roughly 23% of the cardHeight.
 int getWidth()
          Return the width of each card.
 void setCardImage(Card c, java.awt.Image img)
          Used by CardImagesLoader to set the appropriate image once loaded.
 void setCardReverse(java.awt.Image reverseImage)
          Set the reverse image for a card.
 void setName(java.lang.String name)
          Set Name for this deck class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardImages

public CardImages()
Create CardImages object with no associated images.

Method Detail

getCardImage

public java.awt.Image getCardImage(int rank,
                                   int suit)
Extracts the card resource based upon the name.

Parameters:
rank - the rank of the desired card.
suit - the suit of the desired card.
Returns:
java.awt.Image

getCardImage

public java.awt.Image getCardImage(Card c)
Get the card image given a Card Object.

Parameters:
c - card whose image is being requested.
Returns:
Image

getCardReverse

public java.awt.Image getCardReverse()
Get the reverse image for a card.

Returns:
Image

getHeight

public int getHeight()
Return the individual height (in pixels) of each card.

Returns:
int

getName

public java.lang.String getName()
Return Name for this deck class.

Returns:
String deck name.

getOverlap

public int getOverlap()
Overlap is roughly 23% of the cardHeight.

Returns:
int size in pixels.

getWidth

public int getWidth()
Return the width of each card.

Returns:
int size in pixels.

setCardImage

public void setCardImage(Card c,
                         java.awt.Image img)
Used by CardImagesLoader to set the appropriate image once loaded.

Parameters:
c - the card whose image is being stored.
img - the image of the given Card object.

setCardReverse

public void setCardReverse(java.awt.Image reverseImage)
Set the reverse image for a card.

All calculations for card width, height, and offset are based on this card's dimensions.

Parameters:
reverseImage - image for the reverse of a card.

setName

public void setName(java.lang.String name)
Set Name for this deck class.

Parameters:
name - deck name.