All Functions Modules Pages
image

Functions

IMAGE image.load (STRING path)
 Loads an image to RAM. More...
 
IMAGE image.load (STRING path, COLOR mask)
 Loads an image to RAM becoming transparent pixels which have the indicated color. More...
 
IMAGE image.load (STRING path, NUMBER w, NUMBER h)
 Loads an image to RAM as a sprite. More...
 
IMAGE image.load (STRING path, NUMBER w, NUMBER h, COLOR mask)
 Loads an image to RAM as a sprite, becoming transparent pixels which have the indicated color. More...
 
IMAGE image.loadfromdata (STRING data, NUMBER type)
 Load an image, from memory data. More...
 
IMAGE image.new (NUMBER w, NUMBER h, COLOR fill)
 Creates a rectangular image, filled with the specified color. More...
 
NIL image.blit (IMAGE img, NUMBER x, NUMBER y)
 Displays an entire screen image. More...
 
NIL image.blit (IMAGE img, NUMBER x, NUMBER y, NUMBER alpha)
 Displays an entire screen image, applying transparency. More...
 
NIL image.blit (IMAGE img, NUMBER x, NUMBER y, NUMBER xi, NUMBER yi, NUMBER w, NUMBER h)
 Displays a part of a screen image. More...
 
NIL image.blit (IMAGE img, NUMBER x, NUMBER y, NUMBER xi, NUMBER yi, NUMBER w, NUMBER h, NUMBER alpha)
 Displays a part of a screen image, applying transparency. More...
 
NIL image.blitsprite (IMAGE img, NUMBER x, NUMBER y, NUMBER frame)
 Displays one frame of a image loaded as sprite. More...
 
NIL image.blitsprite (IMAGE img, NUMBER x, NUMBER y, NUMBER frame, NUMBER alpha)
 Displays one frame of a image loaded as sprite with transparency. More...
 
NIL image.blittint (IMAGE img, NUMBER x, NUMBER y, COLOR color)
 Displays an entire screen image, with effect tint. More...
 
NIL image.fliph (IMAGE img)
 Flips an image horizontally. More...
 
NIL image.flipv (IMAGE img)
 Flips an image vertically. More...
 
NIL image.center (IMAGE img)
 Change the blit point (the point where the image is displayed) to the center of the image. More...
 
NIL image.center (IMAGE img, NUMBER xi, NUMBER yi)
 Change the blit point (the point where the image is displayed) to the specified point. More...
 
NIL image.rotate (IMAGE img, NUMBER angle)
 Rotate an image about its blit point. More...
 
NUMBER image.getw (IMAGE img)
 Obtains the image width in pixels. More...
 
NUMBER image.geth (IMAGE img)
 Obtains the image height in pixels. More...
 
NUMBER image.getrealw (IMAGE img)
 Obtains the REAL image width in pixels. More...
 
NUMBER image.getrealh (IMAGE img)
 Obtains the real image height in pixels. More...
 
NIL image.resize (IMAGE img, NUMBER w, NUMBER h)
 Resizes an image. More...
 
NIL image.scale (IMAGE img, NUMBER percent)
 Scale an image according to the percentage. More...
 
NIL image.clear (IMAGE img, COLOR fill)
 Fills an image with the specified color. More...
 
NIL image.reset (IMAGE img)
 Returns an image to the values ​​it had when it was loaded / created (in other words, removes all effects applied). More...
 
IMAGE image.copy (IMAGE img)
 Make a copy of the specified image. More...
 
IMAGE image.copyscale (IMAGE img, NUMBER w, NUMBER h)
 Make a scaled copy of the specified image. More...
 
NIL image.save (IMAGE img, STRING path)
 Save an image to the specified path (it should include the filename and its extension, only png). More...
 
NIL image.save (IMAGE img, STRING path, NUMBER compress)
 Save a compressed image of 8 PNG Bits in the indicated route (you must include the file name and extension, only accept .png format). More...
 
COLOR image.pixel (IMAGE img, NUMBER x, NUMBER y)
 Get a pixel from the specified image. More...
 
NIL image.pixel (IMAGE img, NUMBER x, NUMBER y, COLOR color)
 Set a pixel of an image. More...
 
STRING image.data (IMAGE img)
 Returns the RGBA buffer of pixels of an image. More...
 
NIL image.data (IMAGE img, STRING rgba)
 Setea el buffer RGBA de pixeles de una imagen. More...
 
IMAGE image.fxgrey (IMAGE img)
 Creates a copy of the img, with the effect of scaling applied gray. More...
 
IMAGE image.fxinvert (IMAGE img)
 Creates a copy of the img, with the effect of inverted colors. More...
 
IMAGE image.fxsepia (IMAGE img)
 Creates a copy of the img, with sepia effect. More...
 
IMAGE image.fxold (IMAGE img)
 Creates a copy of the img, with the effect of old (old stained). More...
 
IMAGE image.fxold (IMAGE img, NUMBER porcent)
 Creates a copy of the img, with the effect of old (old stained). More...
 
IMAGE image.setfilter (IMAGE img, NUMBER type)
 Apply an effect to an image. More...
 
NIL image.lost (IMAGE img)
 It loses the pointer of the buffer of an image. More...
 

Detailed Description

Using images.

Function Documentation

IMAGE image.load ( STRING  path)

Loads an image to RAM.

Parameters
pathPath to the image to load(formats png, jpg, bmp.).
Returns
An image type object, ready to use.
IMAGE image.load ( STRING  path,
COLOR  mask 
)

Loads an image to RAM becoming transparent pixels which have the indicated color.

Parameters
pathPath to the image to load(formats png, jpg, bmp.).
maskColor of the pixels that will become transparent.
Returns
An image type object, ready to use.
IMAGE image.load ( STRING  path,
NUMBER  w,
NUMBER  h 
)

Loads an image to RAM as a sprite.

Parameters
pathPath to the image to load(formats png, jpg, bmp.).
wWidth of each frame of the sprite.
hHeight of each frame of the sprite.
Note
Images loaded as sprite can only be displayed on the screen with image.blitsprite().
Returns
An image type object, ready to use.
IMAGE image.load ( STRING  path,
NUMBER  w,
NUMBER  h,
COLOR  mask 
)

Loads an image to RAM as a sprite, becoming transparent pixels which have the indicated color.

Parameters
pathPath to the image to load(formats png, jpg, bmp.).
wWidth of each frame of the sprite.
hHeight of each frame of the sprite.
maskColor of the pixels that will become transparent.
Returns
An image type object, ready to use.
IMAGE image.loadfromdata ( STRING  data,
NUMBER  type 
)

Load an image, from memory data.

Parameters
dataBinary data.
typeImage type. The numerical value into parentheses.
  • __PNG (0)
  • __JPG (1)
  • __BMP (2)
Returns
An image type object, ready to use.
IMAGE image.new ( NUMBER  w,
NUMBER  h,
COLOR  fill 
)

Creates a rectangular image, filled with the specified color.

Parameters
wWidth of the image.
hHeight of the image.
fillColor to fill the image.
Returns
An image type object, ready to use.
NIL image.blit ( IMAGE  img,
NUMBER  x,
NUMBER  y 
)

Displays an entire screen image.

Parameters
imgAn image type object.
xX coordinate where the image is displayed.
yY coordinate where the image is displayed.
Note
The image is displayed with its upper left corner at the point indicated by the coordinates, unless another point is established with image.center().
Returns
Nothing.
NIL image.blit ( IMAGE  img,
NUMBER  x,
NUMBER  y,
NUMBER  alpha 
)

Displays an entire screen image, applying transparency.

Parameters
imgAn image type object.
xX coordinate where the image is displayed.
yY coordinate where the image is displayed.
alphaTransparency level (0 to 255), more lower value is, more transparent image becomes.
Returns
Nothing.
NIL image.blit ( IMAGE  img,
NUMBER  x,
NUMBER  y,
NUMBER  xi,
NUMBER  yi,
NUMBER  w,
NUMBER  h 
)

Displays a part of a screen image.

Parameters
imgAn image type object.
xX coordinate where the image is displayed.
yY coordinate where the image is displayed.
xiX coordinate (relative to the upper left corner of the picture) from where you take the part to show.
yiY coordinate (relative to the upper left corner of the picture) from where you take the part to show.
wWidth of the part to be displayed.
hHeight of the portion to be displayed.
Returns
Nothing.
NIL image.blit ( IMAGE  img,
NUMBER  x,
NUMBER  y,
NUMBER  xi,
NUMBER  yi,
NUMBER  w,
NUMBER  h,
NUMBER  alpha 
)

Displays a part of a screen image, applying transparency.

Parameters
imgAn image type object.
xX coordinate where the image is displayed.
yY coordinate where the image is displayed.
xiX coordinate (relative to the upper left corner of the picture) from where you take the part to show.
yiY coordinate (relative to the upper left corner of the picture) from where you take the part to show.
wWidth of the part to be displayed.
hHeight of the portion to be displayed.
alphaTransparency level (0 to 255), more lower value is, more transparent image becomes.
Returns
Nothing.
NIL image.blitsprite ( IMAGE  img,
NUMBER  x,
NUMBER  y,
NUMBER  frame 
)

Displays one frame of a image loaded as sprite.

Parameters
imgA image loaded as sprite.
xX coordinate where the picture is displayed.
yY coordinate where the picture is displayed.
frameFrame to display (numbered from left to right and top to bottom, starting with 0).
Returns
Nothing.
NIL image.blitsprite ( IMAGE  img,
NUMBER  x,
NUMBER  y,
NUMBER  frame,
NUMBER  alpha 
)

Displays one frame of a image loaded as sprite with transparency.

Parameters
imgA image loaded as sprite.
xX coordinate where the picture is displayed.
yY coordinate where the picture is displayed.
frameFrame to display (numbered from left to right and top to bottom, starting with 0).
alphaTransparency level (from 0 to 255), more lower value is, more transparent image becomes.
Returns
Nothing.
NIL image.blittint ( IMAGE  img,
NUMBER  x,
NUMBER  y,
COLOR  color 
)

Displays an entire screen image, with effect tint.

Parameters
imgAn image type object.
xX coordinate where the image is displayed.
yY coordinate where the image is displayed.
colorColor to tint the image.
Returns
Nothing.
NIL image.fliph ( IMAGE  img)

Flips an image horizontally.

Parameters
imgAn image type object.
Returns
Nothing.
NIL image.flipv ( IMAGE  img)

Flips an image vertically.

Parameters
imgAn image type object.
Returns
Nothing.
NIL image.center ( IMAGE  img)

Change the blit point (the point where the image is displayed) to the center of the image.

Parameters
imgAn image type object.
Returns
Nothing.
NIL image.center ( IMAGE  img,
NUMBER  xi,
NUMBER  yi 
)

Change the blit point (the point where the image is displayed) to the specified point.

Parameters
imgAn image type object.
xiX coordinate of the new blit point.
yiY coordinate of the new blit point.
Returns
Nothing.
NIL image.rotate ( IMAGE  img,
NUMBER  angle 
)

Rotate an image about its blit point.

Parameters
imgAn image type object.
angleRotation angle in degrees.
Returns
Nothing.
NUMBER image.getw ( IMAGE  img)

Obtains the image width in pixels.

Parameters
imgAn image type object.
Note
If the image was modified with image.resize(), the returned value will not be real. In case you need the real value, use image.getrealw().
Returns
The width of the specified image.
NUMBER image.geth ( IMAGE  img)

Obtains the image height in pixels.

Parameters
imgAn image type object.
Note
If the image was modified with image.resize(), the returned value will not be real. In case you need the real value, use image.getrealw().
Returns
The height of the specified image.
NUMBER image.getrealw ( IMAGE  img)

Obtains the REAL image width in pixels.

Parameters
imgAn image type object.
Returns
The REAL width of the specified image.
NUMBER image.getrealh ( IMAGE  img)

Obtains the real image height in pixels.

Parameters
imgAn image type object.
Returns
The real height of the specified image.
NIL image.resize ( IMAGE  img,
NUMBER  w,
NUMBER  h 
)

Resizes an image.

Parameters
imgAn image type object.
wThe new width of the image (in pixels).
hThe new height of the image (in pixels).
Returns
Nothing.
NIL image.scale ( IMAGE  img,
NUMBER  percent 
)

Scale an image according to the percentage.

Parameters
imgAn image type object.
percentThe percentage of the scale to carry out.
Returns
Nothing.
NIL image.clear ( IMAGE  img,
COLOR  fill 
)

Fills an image with the specified color.

Parameters
imgAn image type object.
fillThe color to fill the image.
Returns
Nothing.
NIL image.reset ( IMAGE  img)

Returns an image to the values ​​it had when it was loaded / created (in other words, removes all effects applied).

Parameters
imgAn image type object.
Returns
Nothing.
IMAGE image.copy ( IMAGE  img)

Make a copy of the specified image.

Parameters
imgAn image object.
Returns
A copy of the given image.
IMAGE image.copyscale ( IMAGE  img,
NUMBER  w,
NUMBER  h 
)

Make a scaled copy of the specified image.

Parameters
imgAn image object.
wThe new width of the image (in pixels).
hThe new height of the image (in pixels).
Returns
A copy of the given image.
NIL image.save ( IMAGE  img,
STRING  path 
)

Save an image to the specified path (it should include the filename and its extension, only png).

Parameters
imgAn image object.
pathThe path, filename and extension of the image.
Returns
Nothing.
NIL image.save ( IMAGE  img,
STRING  path,
NUMBER  compress 
)

Save a compressed image of 8 PNG Bits in the indicated route (you must include the file name and extension, only accept .png format).

Parameters
imgAn image object.
pathThe path, filename and extension of the image.
compressA numerical value of 1 to perform the saving with compression.
Returns
Nothing.
COLOR image.pixel ( IMAGE  img,
NUMBER  x,
NUMBER  y 
)

Get a pixel from the specified image.

Parameters
imgAn image object.
xPixel position in X axis.
yPixel position in Y axis.
Returns
Pixelcolor at that position.
Note
Also returns the color of the pixel in decimal number.
NIL image.pixel ( IMAGE  img,
NUMBER  x,
NUMBER  y,
COLOR  color 
)

Set a pixel of an image.

Parameters
imgAn image object.
xPixel position in X axis.
yPixel position in Y axis.
colorNew color for this pixel.
Returns
Nothing.
STRING image.data ( IMAGE  img)

Returns the RGBA buffer of pixels of an image.

Parameters
imgAn image object.
Returns
A string with the RGBA buffer of pixels.
Note
This function is similar to image.pixel but faster.
NIL image.data ( IMAGE  img,
STRING  rgba 
)

Setea el buffer RGBA de pixeles de una imagen.

Parameters
imgAn image object.
rgbaBuffer of RGBA pixels.
Returns
Nothing.
Note
This function is similar to image.pixel but faster.
IMAGE image.fxgrey ( IMAGE  img)

Creates a copy of the img, with the effect of scaling applied gray.

Parameters
imgAn image object.
Returns
An image type object, ready to use.
IMAGE image.fxinvert ( IMAGE  img)

Creates a copy of the img, with the effect of inverted colors.

Parameters
imgAn image object.
Returns
An image type object, ready to use.
IMAGE image.fxsepia ( IMAGE  img)

Creates a copy of the img, with sepia effect.

Parameters
imgAn image object.
Returns
An image type object, ready to use.
IMAGE image.fxold ( IMAGE  img)

Creates a copy of the img, with the effect of old (old stained).

Parameters
imgAn image object.
Returns
An image type object, ready to use.
IMAGE image.fxold ( IMAGE  img,
NUMBER  porcent 
)

Creates a copy of the img, with the effect of old (old stained).

Parameters
imgAn image object.
porcentPercentage of effect to apply.
Returns
An image type object, ready to use.
IMAGE image.setfilter ( IMAGE  img,
NUMBER  type 
)

Apply an effect to an image.

Parameters
imgAn image object.
typeType effect. List of available constants:
  • __IMG_FILTER_POINT
  • __IMG_FILTER_APOINT
  • __IMG_FILTER_LINEAR
  • __IMG_FILTER_ALINEAR
Returns
Nothing.
NIL image.lost ( IMAGE  img)

It loses the pointer of the buffer of an image.

Parameters
imgAn image object.
Returns
Nothing.
Note
This function is only used when an image is created in another thread and will no longer be used in it, but if it will be used in another thread, once the pointer is lost, that image can not be destroyed in that same thread.