Share.share: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| Line 22: | Line 22: | ||
=== Example === | === Example === | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local | local share = require "Share" | ||
local | local tex = Texture.new("gfx/cat.jpg") | ||
local bmp = Bitmap.new(tex) | |||
local rt = RenderTarget.new(tex:getWidth(), tex:getHeight()) | |||
rt:draw(bmp) | |||
local buff = Buffer.new("cat.jpg") | |||
rt:save("|B|cat.jpg") | |||
local bdata = buff:get() | |||
share.share("image/jpeg", bdata) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Share}} | {{Share}} | ||
Revision as of 15:14, 20 February 2025
Available since: Gideros 2020.7
Class: Share
Description
Sharing a piece of data with an external app.
Share.share(mimeType,data)
This invokes the platform default sharing dialog, allowing to save, print, send, share, etc.
Supported MIME types:
- "text/*"
- "image/png"
- "image/jpeg"
Parameters
mimeType: (string) the MIME type of the data
data: (string) the data itself
Example
local share = require "Share"
local tex = Texture.new("gfx/cat.jpg")
local bmp = Bitmap.new(tex)
local rt = RenderTarget.new(tex:getWidth(), tex:getHeight())
rt:draw(bmp)
local buff = Buffer.new("cat.jpg")
rt:save("|B|cat.jpg")
local bdata = buff:get()
share.share("image/jpeg", bdata)