Difference between revisions of "ImageData"

Line 42: Line 42:
 
[[Category:Types]]
 
[[Category:Types]]
 
{{#set:Description=Raw (decoded) image data.}}
 
{{#set:Description=Raw (decoded) image data.}}
 +
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|ImageData}}
 
{{i18n|ImageData}}

Revision as of 10:27, 25 March 2011

Raw (decoded) image data.

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

Constructors

love.graphics.newScreenshotCreates a screenshot and returns the ImageData.
love.image.newImageDataCreates a new ImageData object.

Functions

BodyBodies are objects with velocity and position.
ByteDataData object containing arbitrary bytes in an contiguous memory.
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.
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.
FileRepresents a file on the filesystem.
FileDataData representing the contents of a file.
FontDefines the shape of characters than can be drawn onto the screen.
FontDataA FontData represents a font.
FramebufferOff-screen render target.
GearJointKeeps bodies together in such a way that they act like gears.
GlyphDataA GlyphData represents a drawable symbol of a font.
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.
MouseJointFor controlling objects with the mouse.
Object:typeGets the type of the object as a string.
Object:typeOfChecks whether an object is of a certain type.
ParticleSystemUsed to create cool effects, like fire.
PolygonShapePolygon is a convex polygon with up to 8 sides.
PrismaticJointRestricts relative motion between Bodies to one shared axis.
PulleyJointAllows you to simulate bodies connected through pulleys.
QuadA quadrilateral with texture coordinate information.
RasterizerA Rasterizer represents font data and glyphs.
RevoluteJointAllow two Bodies to revolve around a shared point.
ShapeShapes are objects used to control mass and collisions.
Shape (Français)Les Shapes sont des objets pour contrôler les masses et les collisions.
SoundDataContains raw audio samples.
SourceA Source represents audio you can play back.
SpriteBatchStore 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

Data Object

See Also


Other Languages