Media
Supported platforms:
Available since: Gideros ?
Description
Get images from Camera or gallery/file system Resize the image or make copy of them. Take screenshots Play videos for cutscenes Manipulate pictures by getting/setting pixels And much much more
MethodsMedia.new(path) -- create new Media object with provided image Media.new(width, height) -- create blank Media object with provided dimensions Media:getPath() -- returns the path that was used to create object Media:getWidth() -- returns the width of the image Media:getHeight() -- returns the height of the image Media:getPixel(x, y) -- returns r, g, b, a values of pixel at x,y coordinate (RGB are in range of 0 to 255, alpha is in range of 0 to 1) Media:setPixel(x, y, r, g, b, a) -- sets r, g, b, a values to pixel at x,y coordinate (RGB are in range of 0 to 255, alpha is in range of 0 to 1) Media:setPixel(x, y, hex, a, blendAlpha) -- sets hex, a values to pixel at x,y coordinate (alpha is in range of 0 to 1) Media:resizeWidth(newWidth, fixed) -- resize image width, if fixed is true image is resized with fixed aspect ratio Media:resizeHeight(newHeight, fixed) -- resize image height, if fixed is true image is resized with fixed aspect ratio Media:resize(newWidth, newHeight, fixed, crop) -- resize image to new width and new height, if fixed is true image is resized with fixed aspect ratio and takes crop value into account (by either cropping image if true, or doing letterbox resize if false) Media:crop(x, y, width, height) -- crop with and height from x and y point from a given image Media:copy(destination) -- make a copy of the image Media:save() -- save the changes made to file Media:setRotation() -- rotate image to provided angle in degrees Media:getRotation() -- return previously set rotation Media:getRotation() -- return previously set rotation Media:flipHorizontal() -- flip image horizontally Media:flipVertical() -- flip image vertically Media:drawImage(x, y, media, alpha) -- draw another image on current one at specific x and y coordinates. You can provide either another media object or string path to image file Media:drawText(x, y, text, hexColor, fontSize, alpha) -- draw a text at provided coorindates with provided settings Media:drawLine(x0, y0, x1, y0, hexColor, alpha, blendAlpha) -- draw a line from x0,y0 to x1,y1 with provided settings Media:drawFill(x, y, width, height, hexColor, alpha, blendAlpha) -- draw filled rectangle at x,y position with width,height dimensions and with provided settings Media:floodFill(x, y, hexColor, alpha, tolerance, blendAlpha) -- fill area with provided color based on tolerance to other colors Media:trim(hexColor) -- trim image by provided background color, if color is not provided, uses top left pixel to crop |
EventsEvent.MEDIA_RECEIVE (e.path) -- path to image Constants |