mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Working through color docs
This commit is contained in:
parent
cb2891db8a
commit
8b8601b464
7 changed files with 53 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @function Phaser.Display.Color.ColorToRGBA
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} color - [description]
|
||||||
|
*/
|
||||||
var ColorToRGBA = function (color)
|
var ColorToRGBA = function (color)
|
||||||
{
|
{
|
||||||
var output = {
|
var output = {
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
// Return a string containing a hex representation of the given color component.
|
// Return a string containing a hex representation of the given color component.
|
||||||
// @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255.
|
// @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255.
|
||||||
// @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64.
|
// @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64.
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @function Phaser.Display.Color.ComponentToHex
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} color - [description]
|
||||||
|
*
|
||||||
|
* @return {string} [description]
|
||||||
|
*/
|
||||||
var ComponentToHex = function (color)
|
var ComponentToHex = function (color)
|
||||||
{
|
{
|
||||||
var hex = color.toString(16);
|
var hex = color.toString(16);
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Given 3 color values this will return an integer representation of it.
|
* Given 3 color values this will return an integer representation of it.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @function Phaser.Display.Color.GetColor
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} red - [description]
|
||||||
|
* @param {number} green - [description]
|
||||||
|
* @param {number} blue - [description]
|
||||||
|
*
|
||||||
|
* @return {number} [description]
|
||||||
|
*/
|
||||||
var GetColor = function (red, green, blue)
|
var GetColor = function (red, green, blue)
|
||||||
{
|
{
|
||||||
return red << 16 | green << 8 | blue;
|
return red << 16 | green << 8 | blue;
|
||||||
|
|
|
@ -1,6 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* Given an alpha and 3 color values this will return an integer representation of it.
|
* Given an alpha and 3 color values this will return an integer representation of it.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @function Phaser.Display.Color.GetColor32
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} red - [description]
|
||||||
|
* @param {number} green - [description]
|
||||||
|
* @param {number} blue - [description]
|
||||||
|
* @param {number} alpha - [description]
|
||||||
|
*
|
||||||
|
* @return {number} [description]
|
||||||
|
*/
|
||||||
var GetColor32 = function (red, green, blue, alpha)
|
var GetColor32 = function (red, green, blue, alpha)
|
||||||
{
|
{
|
||||||
return alpha << 24 | red << 16 | green << 8 | blue;
|
return alpha << 24 | red << 16 | green << 8 | blue;
|
||||||
|
|
|
@ -7,6 +7,16 @@ var Color = require('./Color');
|
||||||
*
|
*
|
||||||
* An alpha channel is _not_ supported.
|
* An alpha channel is _not_ supported.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @function Phaser.Display.Color.HexStringToColor
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {string} hex - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Color} [description]
|
||||||
|
*/
|
||||||
var HexStringToColor = function (hex)
|
var HexStringToColor = function (hex)
|
||||||
{
|
{
|
||||||
var color = new Color();
|
var color = new Color();
|
||||||
|
|
|
@ -4,7 +4,6 @@ var Color = require('./Color');
|
||||||
|
|
||||||
Color.ColorToRGBA = require('./ColorToRGBA');
|
Color.ColorToRGBA = require('./ColorToRGBA');
|
||||||
Color.ComponentToHex = require('./ComponentToHex');
|
Color.ComponentToHex = require('./ComponentToHex');
|
||||||
Color.CSSToColor = require('./CSSToColor');
|
|
||||||
Color.GetColor = require('./GetColor');
|
Color.GetColor = require('./GetColor');
|
||||||
Color.GetColor32 = require('./GetColor32');
|
Color.GetColor32 = require('./GetColor32');
|
||||||
Color.HexStringToColor = require('./HexStringToColor');
|
Color.HexStringToColor = require('./HexStringToColor');
|
||||||
|
|
Loading…
Reference in a new issue