diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-20 17:06:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-20 17:06:06 +0800 |
commit | 002e0c1673fdc5bd76331aaa1359cbb0925dad2e (patch) | |
tree | 6cbd6e62f3119798f300c2b67927677ae0dceaaa /meta/3rd/love2d/library/love.image.lua | |
parent | 4bad35e608179e74c9ce186fa2038573055e574b (diff) | |
download | lua-language-server-002e0c1673fdc5bd76331aaa1359cbb0925dad2e.zip |
update
Diffstat (limited to 'meta/3rd/love2d/library/love.image.lua')
-rw-r--r-- | meta/3rd/love2d/library/love.image.lua | 138 |
1 files changed, 136 insertions, 2 deletions
diff --git a/meta/3rd/love2d/library/love.image.lua b/meta/3rd/love2d/library/love.image.lua index 8101e071..be6c7411 100644 --- a/meta/3rd/love2d/library/love.image.lua +++ b/meta/3rd/love2d/library/love.image.lua @@ -12,7 +12,7 @@ function love.image.isCompressed(filename) end ---Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page. --- ---@param filename string # The filename of the compressed image file. ----@return CompressedImageData compressedImageData # The new CompressedImageData object. +---@return love.image.CompressedImageData compressedImageData # The new CompressedImageData object. function love.image.newCompressedData(filename) end --- @@ -20,5 +20,139 @@ function love.image.newCompressedData(filename) end --- ---@param width number # The width of the ImageData. ---@param height number # The height of the ImageData. ----@return ImageData imageData # The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. +---@return love.image.ImageData imageData # The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. function love.image.newImageData(width, height) end + +---@class love.image.CompressedImageData: love.image.Data, love.image.Object +local CompressedImageData = {} + +--- +---Gets the width and height of the CompressedImageData. +--- +---@return number width # The width of the CompressedImageData. +---@return number height # The height of the CompressedImageData. +function CompressedImageData:getDimensions() end + +--- +---Gets the format of the CompressedImageData. +--- +---@return love.image.CompressedImageFormat format # The format of the CompressedImageData. +function CompressedImageData:getFormat() end + +--- +---Gets the height of the CompressedImageData. +--- +---@return number height # The height of the CompressedImageData. +function CompressedImageData:getHeight() end + +--- +---Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count. +--- +---@return number mipmaps # The number of mipmap levels stored in the CompressedImageData. +function CompressedImageData:getMipmapCount() end + +--- +---Gets the width of the CompressedImageData. +--- +---@return number width # The width of the CompressedImageData. +function CompressedImageData:getWidth() end + +---@class love.image.ImageData: love.image.Data, love.image.Object +local ImageData = {} + +--- +---Encodes the ImageData and optionally writes it to the save directory. +--- +---@param format love.image.ImageFormat # The format to encode the image as. +---@param filename string # The filename to write the file to. If nil, no file will be written but the FileData will still be returned. +---@return love.image.FileData filedata # The encoded image as a new FileData object. +function ImageData:encode(format, filename) end + +--- +---Gets the width and height of the ImageData in pixels. +--- +---@return number width # The width of the ImageData in pixels. +---@return number height # The height of the ImageData in pixels. +function ImageData:getDimensions() end + +--- +---Gets the height of the ImageData in pixels. +--- +---@return number height # The height of the ImageData in pixels. +function ImageData:getHeight() end + +--- +---Gets the color of a pixel at a specific position in the image. +--- +---Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param x number # The position of the pixel on the x-axis. +---@param y number # The position of the pixel on the y-axis. +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). +function ImageData:getPixel(x, y) end + +--- +---Gets the width of the ImageData in pixels. +--- +---@return number width # The width of the ImageData in pixels. +function ImageData:getWidth() end + +--- +---Transform an image by applying a function to every pixel. +--- +---This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData. +--- +---The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel. +--- +---function pixelFunction(x, y, r, g, b, a) +--- +--- -- template for defining your own pixel mapping function +--- +--- -- perform computations giving the new values for r, g, b and a +--- +--- -- ... +--- +--- return r, g, b, a +--- +---end +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param pixelFunction function # Function to apply to every pixel. +---@param x number # The x-axis of the top-left corner of the area within the ImageData to apply the function to. +---@param y number # The y-axis of the top-left corner of the area within the ImageData to apply the function to. +---@param width number # The width of the area within the ImageData to apply the function to. +---@param height number # The height of the area within the ImageData to apply the function to. +function ImageData:mapPixel(pixelFunction, x, y, width, height) end + +--- +---Paste into ImageData from another source ImageData. +--- +---@param source love.image.ImageData # Source ImageData from which to copy. +---@param dx number # Destination top-left position on x-axis. +---@param dy number # Destination top-left position on y-axis. +---@param sx number # Source top-left position on x-axis. +---@param sy number # Source top-left position on y-axis. +---@param sw number # Source width. +---@param sh number # Source height. +function ImageData:paste(source, dx, dy, sx, sy, sw, sh) end + +--- +---Sets the color of a pixel at a specific position in the image. +--- +---Valid x and y values start at 0 and go up to image width and height minus 1. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param x number # The position of the pixel on the x-axis. +---@param y number # The position of the pixel on the y-axis. +---@param r number # The red component (0-1). +---@param g number # The green component (0-1). +---@param b number # The blue component (0-1). +---@param a number # The alpha component (0-1). +function ImageData:setPixel(x, y, r, g, b, a) end |