Does Love support this (Nothing in the docs)?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Does Love support this (Nothing in the docs)?
I know there is a SDL_SetColorKey function. Can I create an image from something.gif and then make anything that is pink (255,0,255) transparent? Pixel images are easy to edit in MSPaint
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Does Love support this (Nothing in the docs)?
Color keys are an old 90's software rendering technique. LÖVE uses post-millenium OpenGL (GPU-accelerated rendering), which doesn't have inherent support for that but does have full support for separate alpha channels in images.
You can load the image as imagedata (love.image.newImageData(filename)), and then use ImageData:mapPixel to find pixels of a specified color and replace them with pure transparency, before loading the imagedata to an OpenGL image with love.graphics.newImage(imagedata).
You can load the image as imagedata (love.image.newImageData(filename)), and then use ImageData:mapPixel to find pixels of a specified color and replace them with pure transparency, before loading the imagedata to an OpenGL image with love.graphics.newImage(imagedata).
- monsieur_h
- Citizen
- Posts: 69
- Joined: Tue Oct 30, 2012 4:43 pm
Re: Does Love support this (Nothing in the docs)?
Or you can simply put your image in <insert your favorite image editor here> and replace the given color by a fully transparent one, once for all. That way, what you will see is what is displayed get. Bonus: you don't bother your program with any heavy pixel-replacing function.slime wrote: You can load the image as imagedata (love.image.newImageData(filename)), and then use ImageData:mapPixel to find pixels of a specified color and replace them with pure transparency, before loading the imagedata to an OpenGL image with love.graphics.newImage(imagedata).
Who is online
Users browsing this forum: Google [Bot], zingo and 0 guests