Working through color docs

This commit is contained in:
Richard Davey 2018-01-25 17:29:17 +00:00
parent cb2891db8a
commit 8b8601b464
7 changed files with 53 additions and 1 deletions

View file

@ -1,3 +1,11 @@
/**
* [description]
*
* @function Phaser.Display.Color.ColorToRGBA
* @since 3.0.0
*
* @param {number} color - [description]
*/
var ColorToRGBA = function (color)
{
var output = {

View file

@ -1,6 +1,16 @@
// 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.
// @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 hex = color.toString(16);

View file

@ -1,6 +1,18 @@
/**
* 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)
{
return red << 16 | green << 8 | blue;

View file

@ -1,6 +1,19 @@
/**
* 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)
{
return alpha << 24 | red << 16 | green << 8 | blue;

View file

@ -7,6 +7,16 @@ var Color = require('./Color');
*
* 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 color = new Color();

View file

@ -4,7 +4,6 @@ var Color = require('./Color');
Color.ColorToRGBA = require('./ColorToRGBA');
Color.ComponentToHex = require('./ComponentToHex');
Color.CSSToColor = require('./CSSToColor');
Color.GetColor = require('./GetColor');
Color.GetColor32 = require('./GetColor32');
Color.HexStringToColor = require('./HexStringToColor');