Difference between revisions of "Legacy:Image"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20120828115544/http://www.spheredev.org/wiki/Object-Image)
 
(Initializers: GetTileImage)
 
Line 6: Line 6:
 
* [[API:LoadImage|LoadImage]](''filename''): Load an image from ''filename''.
 
* [[API:LoadImage|LoadImage]](''filename''): Load an image from ''filename''.
 
* [[API:GrabImage|GrabImage]](''x'', ''y'', ''width'', ''height''): Grab the screen contents at (''x'', ''y'', ''width'', ''height'') and store it in a new Image object.
 
* [[API:GrabImage|GrabImage]](''x'', ''y'', ''width'', ''height''): Grab the screen contents at (''x'', ''y'', ''width'', ''height'') and store it in a new Image object.
* [[API:GetTileImage|GetTileImage]]()
+
* [[API:GetTileImage|GetTileImage]](''tile''): Get the [[API:Image|Image]] of ''tile'' in the current map tileset.
 
* [[API:Surface/createImage|Surface.createImage]](): Create a new [[API:Surface|Surface]] using the picture data in the image.
 
* [[API:Surface/createImage|Surface.createImage]](): Create a new [[API:Surface|Surface]] using the picture data in the image.
  
Line 14: Line 14:
 
* [[API:GetSystemUpArrow|GetSystemUpArrow]](): Get the up-pointing arrow image that comes with the Sphere engine.
 
* [[API:GetSystemUpArrow|GetSystemUpArrow]](): Get the up-pointing arrow image that comes with the Sphere engine.
 
* [[API:GetSystemDownArrow|GetSystemDownArrow]](): Get the down-pointing arrow image that comes with the Sphere engine.
 
* [[API:GetSystemDownArrow|GetSystemDownArrow]](): Get the down-pointing arrow image that comes with the Sphere engine.
 
  
 
==Methods==
 
==Methods==

Latest revision as of 05:16, 4 June 2013

The Image object holds an image in memory to be used for drawing.

Initializers

  • LoadImage(filename): Load an image from filename.
  • GrabImage(x, y, width, height): Grab the screen contents at (x, y, width, height) and store it in a new Image object.
  • GetTileImage(tile): Get the Image of tile in the current map tileset.
  • Surface.createImage(): Create a new Surface using the picture data in the image.

System images

  • GetSystemArrow(): Get the right-pointing arrow image that comes with the Sphere engine.
  • GetSystemUpArrow(): Get the up-pointing arrow image that comes with the Sphere engine.
  • GetSystemDownArrow(): Get the down-pointing arrow image that comes with the Sphere engine.

Methods

  • Image.clone(): returns a copy of an existing image object
  • Image.blit(x, y): Draw the image with the top-left corner at (x, y).
  • Image.blitMask(x, y, mask): Draw the image at (x, y) with mask as the tinting color.
  • Image.rotateBlit(center_x, center_y, angle): Draw the image centered at (center_x, center_y), rotated by angle radians.
  • Image.rotateBlitMask(center_x, center_y, angle, mask): rotateBlit + mask.
  • Image.zoomBlit(x, y, factor): Draw the image zoomed by factor with the top-left corner at (x, y).
  • Image.zoomBlitMask(x, y, factor, mask): zoomBlit + mask.
  • Image.transformBlit(x1, y1, x2, y2, x3, y3, x4, y4): Draw the image with top-left (x1, y1), top-right (x2, y2), bottom-right (x3, y3) and bottom-left (x4, y4).
  • Image.transformBlitMask(x1, y1, x2, y2, x3, y3, x4, y4, mask): Draw the image stretched to fit 4 coordinates clockwise from the top-left, with a masking color.
  • Image.createSurface(): Create a new Surface using the picture data in the image.

Members

  • width The width of the image, in pixels.
  • height The height of the image, in pixels.

Notes

Operations cannot be performed on an Image object, so if you need to change the image you should use a Surface instead.

See also


API:Image/navbox