SA-MP Forums Archive
[Include] [INC] color.inc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC] color.inc (/showthread.php?tid=56894)



[INC] color.inc - Simon - 02.12.2008

About:

color.inc is a function library filled with colour manipulating functions. It includes a lot of smaller functions as a base for creating your own larger functions. It also includes color defines for the web colours (if you'd like to overwrite these colours then define them BEFORE the #include <color> line).

Function List


FunctionDescription
__________________________________________________ ________________________________________________
setRed(color, red)Returns the specified colour with the specified RED intensity.
setGreen(color, green)Returns the specified colour with the specified GREEN intensity.
setBlue(color, blue)Returns the specified colour with the specified BLUE intensity.
setAlpha(color, alpha)Returns the specified colour with the specified ALPHA intensity.
__________________________________________________ ________________________________________________
stripRed(color)Returns the specified colour with all RED stripped from it (0x00XXXXXX).
stripGreen(color)Returns the specified colour with all GREEN stripped from it (0xXX00XXXX).
stripBlue(color)Returns the specified colour with all BLUE stripped from it (0xXXXX00XX).
stripAlpha(color)Returns the specified colour with all ALPHA stripped from it (0xXXXXXX00).
__________________________________________________ ________________________________________________
fillRed(color)Returns the specified colour with filled RED (0xFFXXXXXX).
fillGreen(color)Returns the specified colour with filled GREEN (0xXXFFXXXX).
fillBlue(color)Returns the specified colour with filled BLUE (0xXXXXFFXX).
fillAlpha(color)Returns the specified colour with filled ALPHA (0xXXXXXXFF).
__________________________________________________ ________________________________________________
getRed(color)Returns the intensity of RED from the specified colour.
getGreen(color)Returns the intensity of GREEN from the specified colour.
getBlue(color)Returns the intensity of BLUE from the specified colour.
getAlpha(color)Returns the intensity of ALPHA from the specified colour.
__________________________________________________ ________________________________________________
makeColor(red, green, blue, alpha)Returns a new colour with the specified intensities.
setColor(color, red, green, blue, alpha)Returns an edited version of the specified colour with the specfied intensities. Use the NO_SET define to leave an intensity as it is. Note 1


Colour List:

This is a list of colour names defined inside the include, if you define your own colour with the same name before these then your colour will be the one that is used.

_COLOR_BLACK
_COLOR_NAVY
_COLOR_BLUE
_COLOR_GREEN
_COLOR_TEAL
_COLOR_LIME
_COLOR_AQUA
_COLOR_CYAN
_COLOR_MAROON
_COLOR_PURPLE
_COLOR_OLIVE
_COLOR_GRAY
_COLOR_GREY
_COLOR_SILVER
_COLOR_RED
_COLOR_FUCHSIA
_COLOR_PINK
_COLOR_YELLOW
_COLOR_WHITE

Notes:

Note 1: Usage of the setColor function can be demonstrated like this:

pawn Код:
new Color = 0xAABBCCDD;
Color = setColor( Color, 0xFF, 0x00, NO_SET, 0xEE ); // This will set the colour to 0xFF00CCEE (leaving the CC (blue intensity) from the original colour in place).
Note 2: Colour intensities can go from 0 (same as 0x00) to 255 (same as 0xFF).

Note 3: This has been tested but obviously not for every colour (and testing was limited due to %x not formatting correctly with larger numbers, functions were tested on a bitwise calculator though). If you do find a bug with it then please post the code you're using and the effect you think is bad and I'll look into it.

Download:




Re: [INC] color.inc - Mikep - 02.12.2008

Wow awesome release Simon, but I won't use it

This would probally be good for /setcolor commands etc.


Re: [INC] color.inc - boylett - 02.12.2008

You spelt colour wrong :P
[me=Boylett]hides[/me]


Re: [INC] color.inc - rafay - 02.12.2008

Wow good one simon, i'll be using it!


Re: [INC] color.inc - Simon - 02.12.2008

Quote:
Originally Posted by Boylett
You spelt colour wrong :P
[me=Boylett]hides[/me]
I used 'color', because it seems that coding languages use 'color' instead of 'colour'. Just trying to keep it consistent for scripters :P.


Re: [INC] color.inc - Mikep - 02.12.2008

Quote:
Originally Posted by Simon
Quote:
Originally Posted by Boylett
You spelt colour wrong :P
[me=Boylett]hides[/me]
I used 'color', because it seems that coding languages use 'color' instead of 'colour'. Just trying to keep it consistent for scripters :P.
Silly Boylett[me=Mikep]hides[/me]


Re: [INC] color.inc - Amit - 02.12.2008

Quote:
Originally Posted by Boylett
You spelt colour wrong :P
[me=Boylett]hides[/me]
I think color is the American way of spelling it


Re: [INC] color.inc - Mikep - 02.12.2008

English American

Humour Humor
Colour Color
etc.

We have u's but I prefer to use color anyway, it's faster to type.


Re: [INC] color.inc - Kirollos - 20.06.2012

color = English American
colour = English British

Teachers told us that in school


Re: [INC] color.inc - Luis- - 20.06.2012

Are you stupid? Look at the fucking date of the last post. God.


Re: [INC] color.inc - sheenidgs - 20.06.2012

Please re-upload at Pastebin. I can't donwload from Solidfiles, it says Forbidden.


Re: [INC] color.inc - Luis- - 20.06.2012

Here, i've uploaded my copy. http://pastebin.com/yY2DRprH


Respuesta: [INC] color.inc - Jentebo - 28.06.2017

Please I need this INC to run an old script, re-upload.


Re: Respuesta: [INC] color.inc - Salik - 28.06.2017

Quote:
Originally Posted by Jentebo
Посмотреть сообщение
Please I need this INC to run an old script, re-upload.
Pastebin link >> https://pastebin.com/5Z6uVuWb