ImageData
Raw (decoded) image data.
You can't draw ImageData directly to screen. See Image for that.
Contents
Functions
BezierCurve | A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree. |
Body | Bodies are objects with velocity and position. |
ByteData | Data object containing arbitrary bytes in an contiguous memory. |
Canvas | Off-screen render target. |
Canvas (Nederlands) | Off-screen render target. |
ChainShape | A ChainShape consists of multiple line segments. |
Channel | An object which can be used to send and receive data between different threads. |
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. |
Cursor | Represents a hardware cursor. |
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. |
DroppedFile | Represents a file dropped from the window. |
EdgeShape | EdgeShape is a line segment. |
File | Represents a file on the filesystem. |
FileData | Data representing the contents of a file. |
Fixture | Fixtures attach shapes to bodies. |
Font | Defines the shape of characters than can be drawn onto the screen. |
FontData | A FontData represents a font. |
Framebuffer | Off-screen render target. |
FrictionJoint | A FrictionJoint applies friction to a body. |
GearJoint | Keeps bodies together in such a way that they act like gears. |
GlyphData | A GlyphData represents a drawable symbol of a font. |
GraphicsBuffer | Low-level data stored in graphics memory, including arrays of vertices, vertex indices, and custom collections of data accessible in Shaders. |
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. |
Joystick | Represents a physical joystick. |
Mesh | A 2D polygon mesh used for drawing arbitrary textured shapes. |
MotorJoint | Controls the relative motion between two Bodies |
MouseJoint | For controlling objects with the mouse. |
... 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