41 Commits

Author SHA1 Message Date
David Capello
8deb9c46e7 [lua] Fix clipping when drawing an image on a cel image (fix #3054) 2021-11-15 15:53:14 -03:00
David Capello
b9241e6d91 Refactor ask_access() with ResourceType argument 2021-10-07 19:34:40 -03:00
David Capello
4cd137a639 [lua] Add Image.rowStride property now that Image.bytes is available
We need to know the specific rowStride to be able to set a proper
Image.bytes (bytes size = Image.height * Image.rowStride).
2021-10-07 19:10:27 -03:00
David Capello
c117b1b01f Simplify Image_set_bytes(): as bytes_size == bytes_needed we don't need to call std::min() 2021-10-06 19:16:51 -03:00
David Capello
f8dabfa294 Use portable memcpy instead of memcpy_s 2021-10-04 18:07:20 -03:00
lampysprites
f8ef06a86e Lua API Image:bytes - convert lua Image to data string and back 2021-10-02 14:40:28 +07:00
David Capello
70afe4195e [lua] Add Image(sprite) constructor (renders the first sprite frame) 2020-03-28 13:28:30 -03:00
David Capello
c7b3e15d05 [lua] Fix crash using invalid width/height in Image() 2020-03-28 13:28:25 -03:00
David Capello
cd598e5539 lua: Add Image:saveAs{ filename, palette } function 2020-01-13 12:27:32 -03:00
David Capello
70a211d978 Fix Palette:setColor() and Color Range command when alpha != 255
Use the app::Color alpha property to create the color for an
image (app::color_utils::color_for_image()) in several cases.

Fixed https://community.aseprite.org/t/4548
2020-01-08 17:40:43 -03:00
David Capello
ad1a39714e [lua] Add Image:resize() function
Closes: https://community.aseprite.org/t/3633
2019-08-13 18:16:30 -03:00
David Capello
744bd36408 Fix transparent color for sprites created w/NewSpriteFromSelection
Fixes https://community.aseprite.org/t/3629
2019-08-06 16:18:01 -03:00
David Capello
b2df59563b lua: Add __eq function to Image metatable to compare image IDs 2019-04-25 16:32:36 -03:00
David Capello
0bf5d1de30 lua: Add functions to load/save palettes and images directly 2019-04-17 23:59:59 -03:00
David Capello
07cc284c30 lua: Add Image:isEmpty() and Image:isPlain() 2019-03-29 15:55:10 -03:00
Gaspar Capello
f53544842c Fix non-normal blend modes when the backdrop is transparent (fix #1096) 2019-03-09 12:40:31 -03:00
David Capello
ed1a6233eb lua: Add support to receive Frame/frame number in all functions 2018-12-06 12:36:44 -03:00
David Capello
32e29b8ea7 lua: Add Image.cel property 2018-11-27 14:58:22 -03:00
David Capello
34d1906034 lua: use ObjectId to refer doc objects from script variables
This should fix several crashes using objects in invalid ways where
the object doesn't exist anymore (e.g. an undo deleted referenced
objects in scripts).
2018-11-20 18:12:43 -03:00
David Capello
5bba827924 lua: image:clear() without args must clear w/image.spec.transparentColor 2018-11-13 21:38:03 -03:00
David Capello
e2935dab64 lua: new Image:clear() function 2018-11-13 20:27:39 -03:00
David Capello
b388aef6e0 lua: rename Image:putImage/Sprite -> Image:drawImage/Sprite 2018-11-13 12:59:36 -03:00
David Capello
98f8086b04 lua: Fix Image:putSprite() when position is specified 2018-11-13 12:53:13 -03:00
David Capello
dea603753b lua: Add Image:isEqual() 2018-11-13 12:52:51 -03:00
David Capello
6108d2d5ad lua: add missing get_image_from_arg() function 2018-09-13 11:53:41 -03:00
David Capello
ded3b8ba77 lua: add Image:putSprite() 2018-09-13 11:50:30 -03:00
David Capello
b2f83e0a90 lua: complete some app.active* set/get properties 2018-09-12 12:17:48 -03:00
David Capello
4ab94e9982 lua: add Sprite/Image.spec (ImageSpec metatable) 2018-09-11 21:52:53 -03:00
David Capello
03c663da21 lua: add functions to create layers/frames/cels/tags/slices
Some extra additions:
* Layer.cels
* AniDir constants
* Slice property setters
* Tag.sprite
* Fixed frame numbers in Tag properties
2018-09-11 18:29:15 -03:00
David Capello
10d7020b23 lua: add Image:pixels(Rectangle) function 2018-09-07 18:03:33 -03:00
David Capello
f456f3cba3 lua: Initial support for sprite properties
Frames, Palettes/Color, Layers, Cels, Tags, Slices, etc.
2018-09-04 16:10:32 -03:00
David Capello
24b28ae064 lua: use push_new instead of push_obj with move ctor 2018-09-03 18:37:45 -03:00
David Capello
a107dd29a4 lua: add image iterators
In this way we can use:

    local img = Image(32, 32)
    for it in img:pixels() do
      local pixelValue = it() -- get pixel
      ...
      it(pixelValue)          -- set pixel
    end
2018-09-03 18:20:23 -03:00
David Capello
f292b4b96a lua: Add Image:putImage() method 2018-08-30 23:21:44 -03:00
David Capello
17366056b6 Use a ImageObj with a ImageRef for scripts
Also added __gc/new/clone methods, and colorMode property.
2018-08-30 20:47:11 -03:00
David Capello
4fe66f2ffb Change scripting language to Lua 2018-08-22 14:54:51 -03:00
David Capello
587f697bda js: Add Site class and app.site property 2018-08-20 15:15:38 -03:00
David Capello
bc300bf986 Remove Image/SpriteWrap for scripting
From now on we can share the transaction in the app::Context instead
of having the transaction in a SpriteWrap. This is useful to run
macros/scripts in a near future calling commands (and all commands
could share the same transaction).

Some changes with this:

* Added app::Context::setTransaction/transaction() methods.
* Added Tx class to create a new Transaction or use the currenet
  app::Context transaction.
* Added App.transaction() scripting method.
2018-08-20 14:20:27 -03:00
David Capello
bcf7efc9bb Replace duktape with mujs
Added other classes like Rectangle, Size, and Point.
2017-08-11 17:22:28 -03:00
David Capello
5ecc356a41 Replace GPL license with the new EULA 2016-08-29 13:08:21 -03:00
David Capello
956349f87b Add Image class to scripting
With this change we introduce SpriteWrap and ImageWrap to keep track
of modifications made by the script in one transaction. So we can undo
the script action as one simple action.
2016-04-06 19:05:06 -03:00