Open comods opened 5 months ago
@dacap I need your advise: I was thinking about this:
cel.image = nil
An idea: this could result in cel removal.
Or as @comods said: give to cel.image
a default 1 pixel image with mask color.
In the other hand, I think Image(cel.image, Rectangle(0,0,0,0))
is OK returning nil, perhaps we can add a warning. I'm also fine with giving a default image of 1 pixel.
What do you think about both issues?
What do you think about both issues?
I think it should work as you said:
cel.image = nil
should remove the cel (and invalidate the cel
pointer automatically), andImage(otherImage, rectangle)
can return nil if rectangle.isEmpty
is trueOther option for 1, but for the future, is to add a special "cel with an empty image". This should be related with #1303.
cel.image = Image(cel.image, rectangle)
can error with[string "internal"]:1: bad argument #2 to 'f' (ImageObj expected, got nil)
without any line number nor stack trace.Image(cel.image, rectangle)
can return nil if rectangle is zero width and zero height yetcel.image
can't be set to this same nil.Expected behavior:
Image(cel.image, rectangle)
should not return nil but instead Image(1, 1, cel.image.colorMode) otherwise the colorMode is lost.cel.image = nil
should either do:1: Equivalent of
cel.image = Image()
which will set image to a 1px by 1px transparent image.2: Have a sane error message with a line number and stack trace AND update https://www.aseprite.org/api/image#image to say that it can return nil and you must check for it yourself.
Aseprite and System version
Aseprite v1.3.7-x64 appimage