Create the very bad start of the image api

CoolCat467 2020-12-30 20:17:11 -06:00
parent a8172b7d89
commit 8023d5b9f9

57
Image-API.md Normal file

@ -0,0 +1,57 @@
This library is made for dealing with Images.
image.blend(picture, blendColor, transparency)
Returns a new picture after blending the input picture with given blendColor arguments, with transparency. Transparency of 0 will be the original color of the picture, and a transparency of 1 will be the blendColor. This function could be useful for making fade-out effects.
image.expand(picture, fromTop, fromBottom, fromLeft, fromRight, background, foreground, alpha, symbol)
Add a border to an image with dimensions controlled by arguments, and border color is controlled by background, foreground, and alpha arguments. Symbol is what character to use for the boarder?
image.flipVertically(picture)
Function name explains it perfectly. Mirror the image in the y axes.
image.flipHorizontally(picture)
Function name explains it perfectly. Mirror the image in the x axes.
image.crop(picture, fromX, fromY, width, height)
Crop a given image down to dimensions specified in arguments.
image.transform(picture, newWidth, newHeight)
Transform a given image to a new size. May or may not permit scaling up an image.
image.getSize(picture)
Return the width and height of a given image. image.getWidth and image.getHeight provided for convenience.
image.get(picture, x, y)
Return information about a given pixel of a given image. Returns pixel's background, foreground, alpha, and symbol.
image.set(picture, x, y, background, foreground, alpha, symbol)
Set the given pixel in an image to given argument values.
# String support
These functions could be used to save and load an image from the internet
image.toString(picture)
Convert an image into a string and return the string.
image.fromString(pictureString)
Convert an image string into a picture again.
image.save(path, picture, encodingMethod)
Save a given picture to a given path, using a specified encoding method.
If no encoding method is given, encoding method 6 is automatically selected.
Returns true if image was saved successfully, false and an error message if not.
All images saves have the file header of "OCIF".
image.load(path)
Load an image from given path.
If successful, returns loaded picture. Otherwise, returns False and an error message.
image.copy(picture)
Create and return a copy of a given picture
image.create(width, height, background, foreground, alpha, symbol, random)
Create a new image of dimensions width and height. If no background or foreground color is given, black color (0x000000) is automatically selected. If no alpha value is given, no alpha (0x000000) is automatically selected. If random argument is set to true, a random unicode character is selected (from character codes 65 to 90, or 'A' to 'Z') for every pixel of the image. If random is not true and ff no symbol is given, space character (' ') is automatically selected. Otherwise if random is not true and symbol is given that character will be used for the entire image.
Returns created image
image.getIndex(x, y, width)
Returns the internal table position of a given pixel, given the xy coordinates of the target pixel and the width of the image you want pixel indexes from.