ImageData

Raw (decoded) image data.

You can't draw ImageData directly to screen. See Image for that.

Functions

BezierCurveA Bézier curve object that can evaluate and render Bézier curves of arbitrary degree.
BodyBodies are objects with velocity and position.
ByteDataData object containing arbitrary bytes in an contiguous memory.
CanvasOff-screen render target.
Canvas (Nederlands)Off-screen render target.
ChainShapeA ChainShape consists of multiple line segments.
ChannelAn object which can be used to send and receive data between different threads.
CircleShapeCircle extends Shape and adds a radius and a local position.
CompressedDataByte data compressed using a specific algorithm.
CompressedImageDataCompressed image data designed to stay compressed in RAM and on the GPU.
ContactContacts are objects created to manage collisions in worlds.
CursorRepresents a hardware cursor.
DataThe superclass of all data.
Data:cloneCreates a new copy of the Data object.
Data:getFFIPointerGets an FFI pointer to the Data.
Data:getPointerGets a pointer to the Data.
Data:getSizeGets the Data's size in bytes.
Data:getStringGets the full Data as a string.
DecoderAn object which can gradually decode a sound file.
DistanceJointKeeps two bodies at the same distance.
DrawableSuperclass for all things that can be drawn on screen.
DroppedFileRepresents a file dropped from the window.
EdgeShapeEdgeShape is a line segment.
FileRepresents a file on the filesystem.
FileDataData representing the contents of a file.
FixtureFixtures attach shapes to bodies.
FontDefines the shape of characters than can be drawn onto the screen.
FontDataA FontData represents a font.
FramebufferOff-screen render target.
FrictionJointA FrictionJoint applies friction to a body.
GearJointKeeps bodies together in such a way that they act like gears.
GlyphDataA GlyphData represents a drawable symbol of a font.
GraphicsBufferLow-level data stored in graphics memory, including arrays of vertices, vertex indices, and custom collections of data accessible in Shaders.
ImageDrawable image type.
ImageDataRaw (decoded) image data.
ImageData:encodeEncodes the ImageData to a file format and optionally writes it to the save directory.
ImageData:getDimensionsGets the width and height of the ImageData in pixels.
ImageData:getFormatGets the pixel format of the ImageData.
ImageData:getHeightGets the height of the ImageData in pixels.
ImageData:getPixelGets the color of a pixel.
ImageData:getStringGets the full ImageData as a string.
ImageData:getWidthGets the width of the ImageData in pixels.
ImageData:mapPixelTransform an image by applying a function to every pixel.
ImageData:pastePaste into ImageData from another source ImageData.
ImageData:setPixelSets the color of a pixel.
JointAttach multiple bodies together to interact in unique ways.
JoystickRepresents a physical joystick.
MeshA 2D polygon mesh used for drawing arbitrary textured shapes.
MotorJointControls the relative motion between two Bodies
MouseJointFor 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

Data Object

See Also

Other Languages