{"id":15722599,"url":"https://github.com/britzl/defold-screenshot","last_synced_at":"2025-04-13T03:09:50.618Z","repository":{"id":17791673,"uuid":"82720505","full_name":"britzl/defold-screenshot","owner":"britzl","description":"Screenshot extension for the Defold game engine","archived":false,"fork":false,"pushed_at":"2025-04-02T05:30:46.000Z","size":1570,"stargazers_count":36,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T03:09:43.700Z","etag":null,"topics":["defold","defold-library"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/britzl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-21T19:49:37.000Z","updated_at":"2025-04-02T05:30:21.000Z","dependencies_parsed_at":"2024-06-10T18:02:50.266Z","dependency_job_id":"ca623644-70ef-4043-9b81-f4ac3f513d10","html_url":"https://github.com/britzl/defold-screenshot","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/britzl%2Fdefold-screenshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/britzl%2Fdefold-screenshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/britzl%2Fdefold-screenshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/britzl%2Fdefold-screenshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/britzl","download_url":"https://codeload.github.com/britzl/defold-screenshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657917,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["defold","defold-library"],"created_at":"2024-10-03T22:08:37.470Z","updated_at":"2025-04-13T03:09:50.591Z","avatar_url":"https://github.com/britzl.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"readme":"![](logo.png)\n\n# Defold-Screenshot\nScreenshot extension for the [Defold game engine](http://www.defold.com)\n\n## Installation\nYou can use Defold-Screenshot in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:\n\n\thttps://github.com/britzl/defold-screenshot/archive/master.zip\n\nOr point to the ZIP file of a [specific release](https://github.com/britzl/defold-screenshot/releases).\n\n## API\nThe screenshot API provides four versions of each function:\n\n* Partial screenshot - synchronous. Not available on HTML5.\n* Fullscreen screenshot - synchronous. Not available on HTML5.\n* Partial screenshot - asynchronous\n* Fullscreen screenshot - asynchronous\n\nThe asynchronous versions will capture the screenshot on POST RENDER. The synchronous versions will capture the screenshot immediately. On some mobile devices this may result in a blank capture.\n\n\n### screenshot.png([x, y, w, h, [callback]])\nCapture a full screen or partial screenshot as a PNG. Example:\n\n```\n-- fullscreen with callback\nscreenshot.png(function(self, image, w, h)\n\t-- do something with image\nend)\n\n-- partial with callback\n-- 100x200 pixels starting from 0,0 (lower left corner)\nscreenshot.png(0, 0, 100, 200, function(self, image, w, h)\n\t-- do something with image\nend)\n\n-- fullscreen\nlocal image, w, h = screenshot.png()\n\n-- partial\n-- 100x200 pixels starting from 0,0 (lower left corner)\nlocal image, w, h = screenshot.png(0, 0, 100, 200)\n```\n\n### screenshot.buffer([x, y, w, h, [callback]])\nCapture a full screen or partial screenshot as a Defold buffer.\n\n```\n-- Take screenshot and return it as a Defold buffer\n-- Set buffer as texture on a model\nlocal buffer, w, h = screenshot.buffer()\nlocal url = go.get(\"cube#model\", \"texture0\")\nresource.set_texture(url, { type = resource.TEXTURE_TYPE_2D, width = w, height = h, format = resource.TEXTURE_FORMAT_RGBA }, buffer)\n```\n\n\n\n### screenshot.pixels([x, y, w, h, [callback]])\nCapture a full screen or partial screenshot as raw pixels.\n\n```\n-- Take screenshot and return pixels as a Lua string\nlocal pixels, w, h = screenshot.pixels()\n```\n\n\n## Credits\n* [fpng](https://github.com/richgel999/fpng) for PNG encoding\n* Graphics in example by [Kenney](http://www.kenney.nl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbritzl%2Fdefold-screenshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbritzl%2Fdefold-screenshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbritzl%2Fdefold-screenshot/lists"}