Quote:
Originally Posted by Stefan
What exactly is your suggestion (making all pixels of a specific color transparent ?)
|
Yes, you know how artists typically paint the background one color then set that as the transparent color?
In theory I would use it like so..
This is serverside usage
PHP Code:
// Declare Source Image
temp.sourceimg = "source.png";
// Create Panel and Draw Source Image
temp.img = new TDrawingPanel();
temp.img.setsize(getimgwidth(sourceimg), getimgheight(sourceimg));
temp.img.drawimage(0, 0, sourceimg);
// Get Top Left Pixel Color
temp.rgb = img.getPixelRGB(0, 0);
// Set Image Transparencies
temp.img.setTransparency(rgb[0], rgb[1], rgb[2]);
// Save the Image
temp.img.saveimage2("levels/image/newimage.png", 8);
Which reminds I think functionality to get the RGB value of a certain would be needed as well.
TDrawingPanel.getPixelRGB(x, y); - returns {red, green, blue}
This wouldn't hurt either..
TDrawingPanel.isimgpixeltransparent(x, y) - returns boolean ( like the scripted clientside function )
I'd use this functionality to make it easier for players to create their own heads, bodies, shields, other player content, and have it uploaded in-game versus emailing, or other systems. Typically most newbies usually just open the graphic in paint, and submit the BMP's. Provided they will still have to upload them in the right format but setting transparencies can be a difficult task.