Difference between revisions of "Media"
m (reformatting) |
(added examples) |
||
Line 20: | Line 20: | ||
* And much more... | * And much more... | ||
</translate> | </translate> | ||
+ | |||
+ | === <translate>Examples</translate> === | ||
+ | <source lang="lua"> | ||
+ | -- is camera available | ||
+ | print(mediamanager:isCameraAvailable()) | ||
+ | |||
+ | -- take screenshot (no permission needed) | ||
+ | mediamanager:takeScreenshot() | ||
+ | |||
+ | -- get picture from gallery (*need read permission*) | ||
+ | mediamanager:getPicture() | ||
+ | |||
+ | -- save picture to sdcard/pictures folder (*need write permission*) | ||
+ | mediamanager:postPicture("gfx/ball.png") | ||
+ | </source> | ||
=== <translate>Notes</translate> === | === <translate>Notes</translate> === | ||
Line 27: | Line 42: | ||
<br/> | <br/> | ||
The dimensions when resizing are all actual dimensions of the image and not logical dimensions in your project. | The dimensions when resizing are all actual dimensions of the image and not logical dimensions in your project. | ||
+ | <br/> | ||
<br/> | <br/> | ||
Revision as of 02:23, 3 August 2019
Available since: Gideros ?
Description
- Get image from Camera, gallery or file system
- Resize image
- Make copy of an image
- Take screenshots
- Play videos (for cutscenes)
- Manipulate pictures (getting/setting pixels)
- And much more...
Examples
-- is camera available
print(mediamanager:isCameraAvailable())
-- take screenshot (no permission needed)
mediamanager:takeScreenshot()
-- get picture from gallery (*need read permission*)
mediamanager:getPicture()
-- save picture to sdcard/pictures folder (*need write permission*)
mediamanager:postPicture("gfx/ball.png")
Notes
By resizing image you will actually resize the file of the image, so there is no going back to upscale it later.
getPicture method gives you copies of the image, so you won't harm the original.
The dimensions when resizing are all actual dimensions of the image and not logical dimensions in your project.
Methodsmediamanager:isCameraAvailable() -- returns true is you can get picture from camera Media.new(path) -- create new Media object with provided image |
EventsEvent.MEDIA_RECEIVE (e.path) -- path to image Constants |