![]() We also gonna make a string that will be used as an id to identify each color quickly. This table will be called look_up_color_table. Now we create a new table to be used as look up where each column of the first row of the palette image corresponds to each color of the first palette. ![]() max_palettes = palette_data : getHeight () We also must calculate the max number of palettes that we can use ( max_palettes), that will be of the same height as the image were are stored the palettes. newImageData ( image_map : getWidth (), image_map : getHeight ()) palette_data = love. newImageData ( 'ima.png' ) image_data = love. There has to be load an image that contains the palettes to be used, the palette_data, where each row of pixels is a palette. We also make an image of the same size where we will write all the changes to be made, and call it image_data 1. The algorithm is based on load to the memory our image as an object of type ImageData, in which we will do not any changes and only use as a ” map “ to know what is the color to be used, for that reason we gonna call it image_map. Is possible change the color of the images using the capacity of ImageData to access directly the pixels, to both, read the colors, as to modify they. Changing the color of a image can be a very useful form to reuse an asset without rise the file size of the game on disk. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |