Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   TDrawingPanel.setTransparency() (https://forums.graalonline.com/forums/showthread.php?t=86758)

fowlplay4 07-08-2009 06:19 AM

TDrawingPanel.setTransparency()
 
Well I recently read that TDrawingPanel works serverside, and this is pretty much the only reason why I wouldn't have an in-game uploading option.

Possible usage:
TDrawingPanel.setTransparency(red, green, blue)

Admins 07-20-2009 01:19 AM

What exactly is your suggestion (making all pixels of a specific color transparent ?)

fowlplay4 07-20-2009 02:42 AM

Quote:

Originally Posted by Stefan (Post 1508696)
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(00sourceimg);
// Get Top Left Pixel Color
temp.rgb img.getPixelRGB(00);
// 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.

Crow 07-20-2009 02:55 AM

Quote:

Originally Posted by wiki.graal.net
getimgpixel(imagefile,x,y) - returns an array of {red,green,blue}

:p

fowlplay4 07-20-2009 02:58 AM

Quote:

Originally Posted by Crow (Post 1508720)
:p

Script help for 'getimgpixel':
Clientside:
getimgpixel(str, int, int) - returns object

I could use that and some wild scripting but.. it'd be alot easier if that functionality was available in serverside TDrawingPanel.

Crow 07-20-2009 03:09 AM

Quote:

Originally Posted by fowlplay4 (Post 1508721)
Script help for 'getimgpixel':
Clientside:
getimgpixel(str, int, int) - returns object

I could use that and some wild scripting but.. it'd be alot easier if that functionality was available in serverside TDrawingPanel.

Well, in your example above, you would just replace this:
PHP Code:

temp.rgb img.getPixelRGB(00); 

With this:
PHP Code:

temp.rgb getimgpixel(temp.sourceimg00); 


fowlplay4 07-20-2009 03:52 AM

Quote:

Originally Posted by Crow (Post 1508723)
Well, in your example above, you would just replace this:
PHP Code:

temp.rgb img.getPixelRGB(00); 

With this:
PHP Code:

temp.rgb getimgpixel(temp.sourceimg00); 


Yes but that's only clientside, I'm asking for serverside functionality, anyway let's just get both on the serverside if possible.

Crow 07-20-2009 04:36 AM

Ohh, right. I completely forgot what the topic actually was about. Sorry about that, heh.


All times are GMT +2. The time now is 08:40 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.