Commit Graph

214 Commits

Author SHA1 Message Date
Alex Szpakowski 5ef6730497 Added a variant of love.graphics.captureScreenshot which takes a single filename parameter. Resolves issue #1293.
--HG--
branch : minor
2017-07-29 12:54:53 -03:00
Alex Szpakowski b568e267eb Reorganized the ImageData decoding/encoding implementation slightly.
--HG--
branch : minor
2017-07-21 21:37:48 -03:00
Alex Szpakowski 34ebe18f14 Use luaL_check/optinteger instead of luaL_check/optnumber when getting integer arguments to functions. Resolves issue #1251.
--HG--
branch : minor
2017-07-16 12:17:50 -03:00
Alex Szpakowski 60f898af67 Fix a crash when loading .pvr compressed texture.
--HG--
branch : minor
2017-04-01 21:20:08 -03:00
Alex Szpakowski 074107b01d ImageData:paste can copy between ImageData of different formats. Resolves issue #1249.
--HG--
branch : minor
2017-03-03 22:10:10 -04:00
Alex Szpakowski 12ede289b4 Fix memory leak
--HG--
branch : minor
2017-02-26 20:22:03 -04:00
Alex Szpakowski b44e6b2156 love.graphics.newVolumeImage can now automatically convert a 1xN or Nx1 sheet of square images into layers.
--HG--
branch : minor
2017-02-26 20:18:06 -04:00
Alex Szpakowski 73fd45558b Implement Array, Cubemap, and Volume texture types (issue #1111).
- Add love.graphics.newArrayImage, newCubeImage, and newVolumeImage.
- Add love.graphics.newCanvas(w, h, layers) and newCanvas(w, h, layers, settings). Add ‘type’ field to the settings table of newCanvas.

- Add new love.graphics.setCanvas variants: setCanvas(canvas, slice), and setCanvas(canvastable) where canvastable is in the format: {{canvas1, layer=2}, {canvas2, face=5}}

- Add Texture:getTextureType, getDepth, getLayerCount, getMipmapCount, and getFormat.

- Remove Image:getData and Image:refresh.
- Add Image:replacePixels(imagedata [, slice] [, mipmap]).

- Update Canvas:newImageData to accept a slice argument.

- Add love.image.newCubeFaces(imagedata).

--HG--
branch : minor
2017-02-20 14:58:13 -04:00
Raidho 8572a33880 Prettifyed the code exploiting inheritance rules
added missing comma, added missing `override`

--HG--
branch : minor
2017-02-10 18:36:47 +03:00
Raidho 6ea1ebde9c Data:clone ported to minor
minor tweaks

--HG--
branch : minor
2017-02-10 06:19:53 +03:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski f98b7ce1ed Fix ImageData:paste.
--HG--
branch : minor
2016-12-18 00:09:11 -04:00
Bart van Strien 7bd3581a52 Merge dynamiccore2 into minor
Instead of a global type enum and bitfield, all types now have their own
love::Type static member. This means they automatically assign their ids, build
their bitsets, etc. As a bonus, it simplifies wrapper code since most functions
already know which type they're pushing to or getting from lua, so they can
directly get the static member (if it's called 'type').

--HG--
branch : minor
2016-11-30 22:38:30 +01:00
Bart van Strien 06f4d6363e Move all love::Type initialisation to their respective (new) files
Previously Data, Stream, Drawable and Image (and for some reason Filesystem) had types in types.cpp

--HG--
branch : dynamiccore2
2016-11-30 12:55:08 +01:00
Alex Szpakowski 0a3adc0839 Unify pixel format enums for ImageData, CompressedImageData, and Canvas into a single PixelFormat enum.
Replace love.graphics.getRawImageFormats and love.graphics.getCompressedImageFormats with love.graphics.getImageFormats.

--HG--
branch : minor
2016-11-27 22:53:23 -04:00
Bart van Strien 9f6aa716fa Pass Type to luax_register_type by pointer instead of reference
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski 60d90ca4a8 Merge default into minor
--HG--
branch : minor
2016-10-30 01:07:39 -03:00
Alex Szpakowski 5ba449d1ff Add support for BC4-7 compressed texture formats in KTX files. Updated the changelog. 2016-10-29 23:42:40 -03:00
Alex Szpakowski c6f8a1535d Fixed loading and saving 16 bit per component PNGs.
--HG--
branch : minor
2016-10-28 00:13:36 -03:00
Alex Szpakowski 3de1aa863a Fix encoding ImageData to 16 bit per color channel PNG.
--HG--
branch : minor
2016-10-27 22:23:24 -03:00
Alex Szpakowski 00d30b2a9d Merge default into minor
--HG--
branch : minor
2016-10-24 18:20:28 -03:00
Alex Szpakowski ff53e8fe71 Fix non-integer coordinates passed to ImageData:mapPixel/setPixel/getPixel and SoundData:set/getSample.
LuaJIT does interesting things when you index into a FFI array using a non-integer value.
2016-10-24 18:14:09 -03:00
Alex Szpakowski 27044e6eb8 Update tinyexr.
--HG--
branch : minor
2016-10-18 23:30:52 -03:00
Alex Szpakowski 37520bd18b Added Object:release. Calling it is the equivalent of removing all Lua-side references to an object and doing a full garbage collection cycle (thus deleting the object from memory if nothing else in LÖVE's code is referencing it).
Any attempt to call a method on the object after it has been released will result in an error. Object:release() returns true if it was successful, or false if not (if it has already been released previously).

--HG--
branch : minor
2016-10-06 21:59:01 -03:00
Alex Szpakowski ef61573cd3 Merge default into minor
--HG--
branch : minor
2016-08-29 22:41:24 -03:00
Alex Szpakowski acde58d311 Improved the error message when nil is passed as the first argument to love.image.newImageData (resolves issue #1205). 2016-08-21 11:22:21 -03:00
Alex Szpakowski e71f95595c ImageData (and Images loaded from them) now support different data formats. Resolves issue #1048.
Currently exposed formats are rgba8 and rgba16 (normalized), and rgba16f and rgba32f (floating-point). Some systems, especially mobile ones, won't support every format when creating a love.graphics Image. Use love.graphics.getRawImageFormats to check for support.

love.image.newImageData now takes an optional format parameter as its third argument when creating an empty sized ImageData. It defaults to rgba8.

16-bit PNGs, .hdr images, and floating-point OpenEXR images can now be loaded via love.image.newImageData and love.graphics.newImage.

--HG--
branch : minor
2016-05-22 15:28:20 -03:00
Alex Szpakowski 3e6d01748e Merged default into minor
--HG--
branch : minor
2016-05-22 15:11:15 -03:00
Alex Szpakowski 9900051647 Improved performance of ImageData:mapPixel when JIT compilation is unavailable (e.g. on iOS and Android) 2016-05-21 22:18:12 +00:00
Alex Szpakowski 4666d83beb Fixed ImageData:mapPixel again, for non-JIT platforms this time.
--HG--
branch : minor
2016-05-21 15:24:11 -03:00
Alex Szpakowski 963b4c4447 Fixed ImageData:mapPixel's color component arguments to the mapping function to be within [0, 1] instead of [0, 255].
--HG--
branch : minor
2016-05-21 14:46:17 -03:00
Alex Szpakowski 734789eb93 Added love.math.encode(format, data | string [, linelength]) and love.math.decode(format, data | string). Current formats are "base64" and "hex". The optional line length only applies to base64 and specifies the maximum number of characters per line in the encoded string.
Removed the variant of love.filesystem.newFileData which decoded a base64-encoded string since it's redundant.

--HG--
branch : minor
2016-03-28 19:28:40 -03:00
Alex Szpakowski 2e5f385be3 Merge default into minor
--HG--
branch : minor
2016-03-03 21:28:30 -04:00
Alex Szpakowski 8d7481c3b2 Improved the error message given when jpeg, TGA, and BMP images fail to decode. 2016-02-28 12:41:27 -04:00
Alex Szpakowski ed933847f8 Color values in love's APIs are now in the range of [0, 1] rather than [0, 255].
--HG--
branch : minor
2016-01-31 10:49:29 -04:00
Alex Szpakowski 7db2997bc3 Improved the error messages caused when invalid or missing arguments are given to ImageData and SoundData methods. 2016-01-26 22:19:35 -04:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Bart van Strien 22f2175bec Add initial video playback support for Ogg Theora videos (resolves issue #66.)
The basic APIs are:

video = love.graphics.newVideo("myvideo.ogv")

love.graphics.draw(video, ...) -- Video objects are Drawables.

video:play(), video:pause()

video:getDuration(), video:tell(), video:rewind(), video:seek(seconds)

video:getSource()

video:getWidth(), video:getHeight(), video:setFilter(min, mag)

More advanced APIs include video:setSource(source), video:getStream(), and videostream:setSync.

To use a custom pixel shader when drawing a Video, call the new TexelVideo(texcoords) function instead of Texel(texture, texcoords) in order to get the pixel colors of a video frame.
2015-12-08 22:41:19 -04:00
Alex Szpakowski e0dca60380 Cleaned up some code. 2015-12-07 23:01:52 -04:00
Alex Szpakowski 2c4e713114 Imported some of the dynamiccore branch from love-experiments:
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
2015-11-29 20:38:12 -04:00
Alex Szpakowski 77998c707d Added the ability to use ASTC compressed textures, when the system supports them. 2015-11-28 14:55:26 -04:00
Alex Szpakowski 7265f891de Improved support for non-PVRTC compressed texture formats in .pvr files. 2015-11-28 10:33:17 -04:00
Alex Szpakowski 5fabd64aea Improved the error message when an unsupported file format is used with love.image.newImageData or love.graphics.newImage. 2015-10-19 15:54:53 -03:00
Alex Szpakowski 99acec83c9 Renamed some internal functions to avoid name conflicts when some third-party code is #included. 2015-08-03 20:27:46 -03:00
Alex Szpakowski 66942d5f31 Added the ability to use custom mipmaps in Images, via love.graphics.newImage(filename, {mipmap1, mipmap2, ...}). Resolves issue #1064.
All mipmap levels must be present if custom mipmaps are used (and their sizes must be half the size of the previous mipmap level, rounded down.)

Image:getData now returns all custom mipmaps in an Image.
2015-07-30 20:48:36 -03:00
Bart van Strien 7e44034757 Add a MutexRef class to clean up Mutex handling code 2015-07-06 11:58:08 +02:00