Dojo Learning notes 9. Dojo.graphics.color & Dojo.uri.Uri

Source: Internet
Author: User

Module: Dojo.graphics.color

Here's the name of the color defined in dojo.

dojo.graphics.color.named.white//白色
dojo.graphics.color.named.black//黑色
dojo.graphics.color.named.red//红色
dojo.graphics.color.named.green//绿色
dojo.graphics.color.named.blue//蓝色
dojo.graphics.color.named.navy//海军蓝
dojo.graphics.color.named.gray//灰色
dojo.graphics.color.named.silver//银色
dojo.graphics.color.Color

Color class

Usage Example:

var color = new dojo.graphics.color.Color(dojo.graphics.color.named.black); //定义一个黑色的颜色对象
var color = new dojo.graphics.color.Color(0,0,0); //定义一个黑色的颜色对象
var color = new dojo.graphics.color.Color(0,0,0,1.0); //定义一个黑色的颜色对象
var color = new dojo.graphics.color.Color([0,0,0,1.0]); //定义一个黑色的颜色对象
var color = new dojo.graphics.color.Color('rgb(0,0,0)'); //定义一个黑色的颜色对象
var color = new dojo.graphics.color.Color('#000000'); //定义一个黑色的颜色对象
dojo.graphics.color.Color.toRgb

Usage Example:

color.toRgb(); //返回一个[0,0,0]的数组
color.toRgb(true);//返回一个[0,0,0,1.0]的数组
dojo.graphics.color.Color.toRgba

Usage Example:

color.toRgba(); //返回一个[0,0,0,1.0]的数组
dojo.graphics.color.Color.toHex
dojo.graphics.color.Color.toString

Usage Example:

Color.tohex (); Return to "#000000"

Color.tostring ()//Return to "#000000"

Dojo.graphics.color.Color.toCss

Usage Example:

Color.tocss (); Back to "RGB (0,0,0)"

Dojo.graphics.color.Color.blend

Mix another color to get a new color

Usage Example:

color.blend('#ffffff', 1);//返回[255,255,255]
color.blend('#ffffff', -1);//返回[0,0,0]
color.blend('#ffffff', 0);//按1比1混合黑色和白色,返回[127,127,127]
颜色参数可以为颜色的任意形式,比如数组,字符串等
or
dojo.graphics.color.blend([0,0,0], [255,255,255], 0);//will return [127,127,127]
dojo.graphics.color.blend("#000000", "#ffffff", 0);//will return "#7f7f7f"

If the first argument is a string, the return value also returns a string

Dojo.graphics.color.Color.blendHex

Usage Example:

Dojo.graphics.color.blendHex ("#000000", "#ffffff", 0);//will return "#7f7f7f"

Dojo.graphics.color.extractRGB

Converts input to an RGB array

Dojo.graphics.color.hex2rgb

Converts the input string to an RGB array

Dojo.graphics.color.rgb2hex

Converts the input RGB array to a string

Dojo.graphics.color.Color.fromArray

Usage Example:

var color = Dojo.graphics.color.Color.fromArray ([0,0,0,1.0]);

Module: Dojo.uri.Uri

Dojo.uri.Uri

Classes specifically used to process URIs (Uniform Resource Identifiers)

Usage Example:

uri = (new dojo.uri.Uri("http://myserver/dojo/", "guide.html")).toString();//uri will be "http://myserver/dojo/guide.html"
uri = (new dojo.uri.Uri("http://myserver/dojo/", "../guide.html")).toString();//uri will be "http://myserver/guide.html"

RFC-defined URI syntax: [scheme:][//authority][path][?query][#fragment]

Authority syntax: [user-info@]host[:p ORT]

For example, we define a URI

var uri = new Dojo.uri.Uri ("http://user:password@myserver:80/dojo/", "guide.html?page=1#top");

The properties of the URI are as follows:

Authority: Server name "USER:PASSWORD@MYSERVER:80"

Fragment: Fragment name "Top"

Host: hostname "MyServer"

Password: password "password"

Path: Paths "/dojo/guide.html"

Port: Ports 80

Query: Parameter "page=1"

Scheme: Mode "http"

URI: Full Address "http://user:password@myserver:80/dojo/guide.html?page=1"

User: The username, "User:" seems to have a problem with one more colon.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.