Class GImage¶
The class provides support for drawing an image file. The image is given by a JPEG, PNG,
or GIF file whose name is stored in the attribute source
. Image files should be stored
in the Images directory so that Kivy can find them without the complete path name.
This class acts much like is parent GRectangle and shares all
of the same properties. As with that class, you can add a border to the rectangle if you
want, using the attribute linewidth
.
If the attributes width
and height
do not agree with the actual size of the image,
the image is scaled to fit. Furthermore, if you define fillcolor
, Kivy will tint
your image by the given color.
If the image supports transparency, then this object can be used to represent irregular shapes. However, the contains method still treats this shape as a rectangle.
Constructor¶
- class game2d.grectangle.GImage(**keywords)¶
A class representing a rectangular image.
The image is given by a JPEG, PNG, or GIF file whose name is stored in the attribute source. Image files should be stored in the Images directory so that Kivy can find them without the complete path name.
This class acts much like is parent
GRectangle
and shares all of the same properties. As with that class, you can add a border to the rectangle if you want, using the attributelinewidth
. The border will be rectangular, not matter the image transparency.If the attributes
width
andheight
do not agree with the actual size of the image, the image is scaled to fit.Furthermore, if you definefillcolor
, this object will tint your image by the given color.`If the image supports transparency, then this object can be used to represent irregular shapes. However, the
contains()
method still treats this shape as a rectangle.
Attributes¶
This class has all of the attributes of GRectangle. In addition, it has the following new attributes.
- GImage.source¶
The source file for this image.
invariant. Value be a string refering to a valid file.
Methods¶
This class does not have any methods beyond those defined in GObject.