ImageData
Raw (decoded) image data.
You can't draw ImageData directly to screen. See Image for that.
Contents
Constructors
love.graphics.newScreenshot | Creates a screenshot and returns the ImageData. |
love.image.newImageData | Creates a new ImageData object. |
Functions
Body | Bodies are objects with velocity and position. |
ByteData | Data object containing arbitrary bytes in an contiguous memory. |
CircleShape | Circle extends Shape and adds a radius and a local position. |
CompressedData | Byte data compressed using a specific algorithm. |
CompressedImageData | Compressed image data designed to stay compressed in RAM and on the GPU. |
Contact | Contacts are objects created to manage collisions in worlds. |
Data | The superclass of all data. |
Data:clone | Creates a new copy of the Data object. |
Data:getFFIPointer | Gets an FFI pointer to the Data. |
Data:getPointer | Gets a pointer to the Data. |
Data:getSize | Gets the Data's size in bytes. |
Data:getString | Gets the full Data as a string. |
Decoder | An object which can gradually decode a sound file. |
DistanceJoint | Keeps two bodies at the same distance. |
Drawable | Superclass for all things that can be drawn on screen. |
File | Represents a file on the filesystem. |
FileData | Data representing the contents of a file. |
Font | Defines the shape of characters than can be drawn onto the screen. |
FontData | A FontData represents a font. |
Framebuffer | Off-screen render target. |
GearJoint | Keeps bodies together in such a way that they act like gears. |
GlyphData | A GlyphData represents a drawable symbol of a font. |
Image | Drawable image type. |
ImageData | Raw (decoded) image data. |
ImageData:encode | Encodes the ImageData to a file format and optionally writes it to the save directory. |
ImageData:getDimensions | Gets the width and height of the ImageData in pixels. |
ImageData:getFormat | Gets the pixel format of the ImageData. |
ImageData:getHeight | Gets the height of the ImageData in pixels. |
ImageData:getPixel | Gets the color of a pixel. |
ImageData:getString | Gets the full ImageData as a string. |
ImageData:getWidth | Gets the width of the ImageData in pixels. |
ImageData:mapPixel | Transform an image by applying a function to every pixel. |
ImageData:paste | Paste into ImageData from another source ImageData. |
ImageData:setPixel | Sets the color of a pixel. |
Joint | Attach multiple bodies together to interact in unique ways. |
MouseJoint | For controlling objects with the mouse. |
Object:type | Gets the type of the object as a string. |
Object:typeOf | Checks whether an object is of a certain type. |
ParticleSystem | Used to create cool effects, like fire. |
PolygonShape | Polygon is a convex polygon with up to 8 sides. |
PrismaticJoint | Restricts relative motion between Bodies to one shared axis. |
PulleyJoint | Allows you to simulate bodies connected through pulleys. |
Quad | A quadrilateral with texture coordinate information. |
Rasterizer | A Rasterizer represents font data and glyphs. |
RevoluteJoint | Allow two Bodies to revolve around a shared point. |
Shape | Shapes are objects used to control mass and collisions. |
Shape (Français) | Les Shapes sont des objets pour contrôler les masses et les collisions. |
SoundData | Contains raw audio samples. |
Source | A Source represents audio you can play back. |
SpriteBatch | Store image positions in a buffer, and draw it in one call. |
... further results |
Examples
Images that have dimensions that are not a 2^n will display incorrectly as a white rectangle on some graphics chipsets. This function pads images so they will display correctly.
function newPaddedImage(filename)
local source = love.image.newImageData(filename)
local w, h = source:getWidth(), source:getHeight()
-- Find closest power-of-two.
local wp = math.pow(2, math.ceil(math.log(w)/math.log(2)))
local hp = math.pow(2, math.ceil(math.log(h)/math.log(2)))
-- Only pad if needed:
if wp ~= w or hp ~= h then
local padded = love.image.newImageData(wp, hp)
padded:paste(source, 0, 0)
return love.graphics.newImage(padded)
end
return love.graphics.newImage(source)
end
Supertypes
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info