Commit Graph

44 Commits

Author SHA1 Message Date
Alex Szpakowski f3b52f66fe Update the internal naming convention for pixel formats.
--HG--
branch : minor
2019-12-23 23:38:04 -04:00
Alex Szpakowski 9ab2a94037 Rename internal C++ Color struct to Color32 to help differentiate it from Colorf. 2019-09-14 23:13:40 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski 844900db39 Rename all cases of 'pixel density' to 'DPI scale' in love's APIs.
--HG--
branch : minor
2017-09-24 16:09:05 -03:00
Alex Szpakowski b129d49a6c Move Color.h from modules/graphics/ to common/
--HG--
branch : minor
2017-08-01 23:53:44 -03:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski d26002f5cc Revamped and streamlined retina / high-DPI support (resolves issue #1122).
With the highdpi window flag enabled on a retina-capable display and OS, content should now appear to the user at the same size and in the same positions as with the flag disabled.

As a result, mouse and touch coordinates, Texture and graphics dimensions, and the graphics coordinate system now use pixel density-scaled units instead of pixels. Raw pixel units should generally only be used for things such as shader algorithms which execute per-pixel and rely on accurate pixel dimensions. love.window.fromPixels and friends typically don’t need to be used anymore.

Images, Canvases, and Fonts can have an optional explicit ‘pixel density’ set when creating them. This allows for easily loading high pixel density content which displays at the same size as regular or low pixel density content.

API changes:

- Added Texture:getPixelWidth/getPixelHeight/getPixelDimensions and Texture:getPixelDensity. Texture:getWidth/getHeight return the pixel density-scaled width and height (as it will appear on the screen when drawn) rather than the number of pixels on each texture dimension.

- Added love.graphics.getPixelWidth/getPixelHeight/getPixelDimensions.

- Added optional ‘pixeldensity’ field to the settings table parameter of love.graphics.newImage. It defaults to 1, or if the file the Image was loaded from has “@2x”, “@3x”, etc. at the end of its name, it uses that number as the pixel density scale by default.

- love.graphics.newCanvas now takes a table as its third parameter, with fields “format”, “msaa”, and “pixeldensity”. pixeldensity defaults to the main screen’s pixel density. The width and height parameters specify the visual size that the Canvas will be drawn at / can be drawn to (pixel density-scaled units).

- love.graphics.newVideo accepts a table as its second parameter, with optional fields “audio” and “pixeldensity”. pixeldensity defaults to 1.

- love.graphics.newFont variants have an optional pixeldensity parameter at the end of the argument list. For TrueType fonts this defaults to the current pixel density scale of the screen, and for BMFonts and ImageFonts this defaults to 1.

- Added Font:getPixelDensity.

- Renamed love.window.getPixelScale to love.window.getPixelDensity.

--HG--
branch : minor
2016-12-29 23:55:51 -04:00
Alex Szpakowski 8aa6725039 Cleaned up some duplicated pixel format-related code in Font files.
--HG--
branch : minor
2016-12-29 02:45:27 -04: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
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 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski a119e6a862 Added an optional spacing argument to love.graphics.newImageFont, allowing additional spacing (positive or negative) to be applied to all glyphs rendered using that font. 2015-03-11 18:28:22 -03:00
Alex Szpakowski a7e4148869 Merged default into minor
--HG--
branch : minor
2015-01-16 15:47:26 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski d527307adc Font glyphs created from ImageFonts no longer treat separator pixels as spacing (resolves issue #190.)
--HG--
branch : minor
2014-09-28 21:26:17 -03:00
Alex Szpakowski 8edb90a719 Added support for loading BMFont bitmap font files with love.graphics.newFont (see issue #190.) Some esoteric BMFont features are not supported.
Moved the Font module Lua wrapper code out of the freetype implementation folder.

--HG--
branch : minor
2014-09-28 16:00:40 -03:00
Alex Szpakowski d59c76a55f Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs! 2014-08-07 14:53:17 -03:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 6e3a7288dd Improved performance of ImageData:mapPixel (now up to 2x as fast as in 0.8.0!); love.graphics.newImage, Image:refresh, love.window.setIcon, and ImageRasterizers now prevent other threads from modifying the ImageData used in those functions until they're done accessing it 2013-06-25 05:28:20 -03:00
Alex Szpakowski 76618f0328 Cleaned up font code to always use uint32 instead of the slightly more ambiguous "unsigned int" for codepoints 2013-06-16 19:48:53 -03:00
Alex Szpakowski d48d1fd441 Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph. 2013-06-16 07:36:18 -03:00
Alex Szpakowski 4c616e409b Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602) 2013-05-03 04:04:44 -03:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
Alex Szpakowski 191af5cd5b Minor cosmetics 2013-01-23 06:26:17 -04:00
Alex Szpakowski 76b0537eff ImageFonts now replace the spacer color with transparency when generating a glyph instead of when first parsing ImageData (source ImageData used to generate an ImageFont is now unmolested.) 2013-01-23 06:00:28 -04:00
Alex Szpakowski e51a9eb25d Added support for UTF-8 ImageFont glyphs and ImageFonts with more than 256 characters 2013-01-23 03:02:46 -04:00
Alex Szpakowski 022f549554 Use unsigned ints instead of unsigned shorts to represent UTF8 font glyphs 2013-01-22 23:43:35 -04:00
Bart van Strien 63daffb22f Correctly set the spacing for the last character in an ImageFont as well 2012-08-21 15:18:12 +02:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
Bill Meltsner 9d38cba626 brutally murdered padding and predefined glyph loading
--HG--
branch : newfont
2011-03-05 23:37:36 -05:00
Bill Meltsner fde708160e bringing in the new year by changing every 2010 to 2011 2011-01-15 14:40:27 -06:00
Bill Meltsner c06d5c3263 hopefully padded fonts so that people with crappy graphics cards can still see them - this needs testing, though 2010-08-19 13:41:19 -05:00
bart@bartbes.ath.cx 3d726b0dd9 Added mutexes to the GC and made tip buildable again on linux 2010-05-20 17:31:07 +02:00
Bill Meltsner f8f812a719 did a bunch of other stuff, sorry about the monolithic changeset but the diffs should be understandable enough 2010-04-15 10:19:01 -04:00
Bill Meltsner e3a5aacd5a Overhauled ImageRasterizer, fixed a bunch of other crap, getting ready to poke around in love.graphics 2010-04-14 21:51:35 -04:00
Bill Meltsner 7c33786100 fixed a ridiculous number of gcc warnings, nearly all of which were complaints about unused parameters - the remaining 199 warnings I get are from code that isn't ours (box2d is responsible for all but 8 of them) 2010-02-26 03:55:21 -05:00
Bill Meltsner 3ebcee1e17 fixed a bug in ImageRasterizer's constructor where it wasn't using the ImageData passed to it 2010-02-09 13:20:40 -05:00
rude aa01c984b9 Updated all dates to 2010. 2010-01-31 16:54:47 +01:00
rude 477d5a05b8 Updated love.font, and added Glyph object in love.graphics. 2009-07-30 21:43:00 +02:00
michaee 74190255ed Added basic (unfinished and untested) font module. 2009-07-28 20:22:48 +02:00