精图规范1.0----12 颜色 Color

来源:互联网 发布:手机淘宝详情页不显示 编辑:程序博客网 时间:2024/05/19 19:34

previous next   contents   elements   attributes   properties   index  


04 September 2001

12 颜色 Color



内容 Contents

  • 12.1 引言 Introduction
  • 12.2 颜色属性 'color'   The 'color' property
  • 12.3 颜色简要表描述子  Color profile descriptions
    • 12.3.1 颜色简要表描述子概要  Overview of color profile descriptions
    • 12.3.2 定义颜色简要表描述子的两种方式 Alternative ways for defining a color profile description
    • 12.3.3 颜色简要表描述子元素 'color-profile'   The 'color-profile' element
    • 12.3.4 当使用CSS格式时的@color-profile    @color-profile when using CSS styling
    • 12.3.5 属性'color-profile'    'color-profile' property
  • 12.4 文档对象模型接口  DOM interfaces

12.1 引言 Introduction

所有的精图颜色在 sRGB 颜色空间(参见 [SRGB])中指定。至少精图用户代理应该遵守CSS2 规范 的颜色章节和最小限度的图像校正规则中所定义的颜色行为要求规定。 All SVG colors arespecified in the sRGB color space (see[SRGB]).At a minimum, SVG user agents shall conform to the color behavior requirementsspecified in thecolor unitssection and the minimal gammacorrection rules defined in the CSS2 specification.

另外, 精图内容可以使用 ICC 配置选项指定一种预备的颜色(参见 [ICC32]). 如果提供基于ICC 的颜色并且精图用户代理 支持 ICC 颜色, 则基于ICC的颜色优先于 sRGB 颜色加以考虑 . 注意即使提供了基于ICC 的颜色的规定,在RGB 颜色空间中仍会出现插补 (参见'color-interpolation').   Additionally, SVG content can specify an alternate color specification using anICC profile (see [ICC32]).If ICC-based colors are provided and the SVG user agent supports ICC color,then the ICC-based color takes precedence over the sRGB color specification.Note that color interpolation occurs in an RGB color space even if an ICC-basedcolor specification is provided (see'color-interpolation').

12.2 颜色属性'color'  The 'color' property

颜色属性'color' 用来为属性'fill','stroke','stop-color', 'flood-color', 'lighting-color' 提供一种潜在间接的值(currentColor) .  The 'color' property is used to provide a potentialindirect value (currentColor) for the'fill','stroke', 'stop-color', 'flood-color', 'lighting-color' properties.

'color'

Value:  

<color> |inherit

Initial:  

依赖于用户代理 depends on user agent

Applies to:  

用于具有属性 'fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color' 的元素 elements to which properties 'fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color' apply

Inherited:  

yes

Percentages:  

N/A

Media:  

visual

Animatable:  

yes

除了在此规范中提供的任何额外信息之外, 此属性的标准定义在 [CSS2]中.  Except for any additional information provided in thisspecification, the normative definition of the property is in [CSS2].



12.3 颜色配置选项描述子 Color profile descriptions



12.3.1 颜色配置选项描述子概览 Overview of color profile descriptions

  国际颜色协会 已经建立一个标准, ICC 配置选项 [ICC32], 作为输入输出设备对文档进行处理的颜色特征. 使用这些配置选项,建立一种可以在在不同的装置上进行浏览的传输和准确的可视数据是可能的.    TheInternationalColor Consortium has established a standard, the ICC Profile [ICC32], for documenting thecolor characteristics of input and output devices. Using these profiles, it ispossible to build a transform and correct visual data for viewing on differentdevices.

一个 颜色配置选项描述子  提供了一个 ICC 配置选项和精图内容对 ICC 配置选项的引用之间的桥梁 . 颜色配置选项描述子被增加到用户代理的众所周知的颜色配置选项的列表中以便用来对相关配置选项的选择.  颜色配置选项描述子包含在因特网上的颜色配置选项的位置描述子, 一个引用配置选项的名字和有关渲染意图的信息.   A color profile descriptionprovides the bridge between an ICC profile and references to that ICC profilewithin SVG content. The color profile description is added to the user agent'slist of known color profiles and then used to select the relevant profile. Thecolor profile description contains descriptors for the location of the color profileon the Web, a name to reference the profile and information about renderingintent.



12.3.2 定义颜色配置选项描述子的两种方式 Alternative ways for defining a color profile description

颜色配置选项可以依照下列方式之一来设定:

  • 一个颜色配置选项元素 'color-profile'   a 'color-profile' element
  • 一种颜色配置选项在CSS 样式表中的规则 @color-profile (仅对支持使用CSS [CSS2]来格式化精图文档的用户代理可用)    an@color-profile rule within a CSS style sheet (only applicable for user agents which support using CSS [CSS2] to style the SVG content)

如果颜色配置选项在颜色配置选项元素 'color-profile' 和CSS 样式表中的规则 @color-profile中被指定了相同的名字, 那么用户代理将试图先定位由规则@color-profile 所指定的配置选项. If acolor profile with the samename value has been identified by both a'color-profile' element and @color-profilerules within a CSS style sheet, then the user agent shall first attempt tolocate the profile by using the specifications in the@color-profilerules first.



12.3.3 颜色配置选项元素'color-profile'  The 'color-profile' element

 
<!ELEMENT color-profile (%descTitleMetadata;) >
<!ATTLIST color-profile 
  %stdAttrs;
  %xlinkRefAttrs;
  xlink:href %URI; #IMPLIED
  local CDATA #IMPLIED  
  name CDATA #REQUIRED
  rendering-intent (auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric) "auto" >

属性定义 Attributedefinitions:

xlink:href = "<uri>"

 ICC 配置选项资源的位置 The location of an ICCprofile resource.
Animatable:no.

local = "<string>"

本地存储的颜色配置选项的唯一ID . <string> 是由国际颜色协会 指定的配置选项的唯一ID. 如果属性xlink:href 和  local 都被设置, 那么用户代理将首先查找本地系统的本地存储颜色配置选项, 并且, 如果本地的不可用, 那么试图使用由属性xlink:href 指定的资源. (注意: 配置选项描述域表示配置选项的唯一ID. 就当前 ICC提议而言, 配置选项的唯一ID是在配置选项开头部分的一个MD5编码的值 .). The unique ID for a locallystored color profile. <string> is the profile's unique ID as specified byInternational Color Consortium. If both thexlink:href and the localattributes are specified, then the user agent shall search the local system forthe locally stored color profile first, and, if not available locally, thenattempt to use the resource identified by thexlink:href attribute. (Note: Profile descriptionfields do not represent a profile's unique ID. With current ICCproposals, the profile's unique ID is an MD5-encoded value within the profileheader.).
Animatable:no.

name = "<name>"

name 作为在 'fill', 'stroke', 'stop-color', 'flood-color' 和'lighting-color' 属性值中使用的icc-color 规范的第一个参数 指定用于ICC颜色规范中的颜色配置选项( the color profile) 并且 name 可以为属性'color-profile' 的值.注意如果不提供<name> , 则不能对给定的颜色配置选项描述子(color profile description)进行引用. 名字 "sRGB"是预定义的; 任何其<name> 被设置为"sRGB"的颜色配置选项描述子将被忽略.为了CSS 词法扫描和分析规则与保持一致, 关键词 "sRGB" 是区分大小写的; 然而, 建议混合大写  "sRGB" 以便与通常的工业实践保持一致.                  The name which is used as the first parameter for icc-colorspecifications within'fill','stroke', 'stop-color', 'flood-color' and 'lighting-color' property values to identify thecolor profile to use for the ICC color specification and the name which can bethe value of the'color-profile' property. Note that if <name>is not provided, it will be impossible to reference the given color profiledescription. The name "sRGB" is predefined; any color profile descriptionswith <name> set to "sRGB" will beignored. For consistency withCSS lexical scanning andparsing rules, the keyword "sRGB" is case-insensitive; however,it is recommended that the mixed capitalization "sRGB" be used forconsistency with common industry practice.
Animatable:no.

rendering-intent = "auto | perceptual | relative-colorimetric | saturation |absolute-colorimetric"

'rendering-intent' 允许指定非缺省的颜色配置选项的渲染意图. 'rendering-intent' 主要用于将颜色配置选项对应 CMYK 颜色空间. 不同的选项产生转换颜色到最终渲染设备的色域的不同方法:    'rendering-intent'permits the specification of a color profile rendering intent other than thedefault. 'rendering-intent' is applicableprimarily to color profiles corresponding to CMYK color spaces. The differentoptions cause different methods to be used for translating colors to the colorgamut of the target rendering device:

auto

此为缺省行为. 用户代理根据内容的类型确定最好的意图. 对于包含一个嵌入配置选项的图像内容, 将假定在此配置选项中指定的意图为所期望的意图. 否则, 用户代理将使用当前的配置选项确定其意图, 而忽略存储在配置选项本身的任何意图.           This is the default behavior. The user agent determines the best intent basedon the content type. For image content containing an embedded profile, it shallbe assumed that the intent specified within the profile is the desired intent.Otherwise, the user agent shall use the current profile and force the intent,overriding any intent that might be stored in the profile itself.

perceptual

此种方法, 常常为图像的首选, 保留了颜色之间的关系. 试图维持映射到最终设备的色域的像素中的相对颜色值. 有时为了避免色调漂移和不连续并且尽可能保持景色的全面外观会对最终设备的色域的最初像素值作必要的改变.          This method,often the preferred choice for images, preserves the relationship betweencolors. It attempts to maintain relative color values among the pixels as theyare mapped to the target device gamut. Sometimes pixel values that wereoriginally within the target device gamut are changed in order to avoid hueshifts and discontinuities and to preserve as much as possible the overallappearance of the scene.

saturation

保持最初像素的相对饱和度(色彩浓度)值. 对于超出色域范围的颜色将被转换为具有相同饱和度处在色域范围内的颜色.          Preserves the relative saturation (chroma) values of the original pixels. Outof gamut colors are converted to colors that have the same saturation but falljust inside the gamut.

relativecolorimetric

保持在色域中的颜色不变. 此方法通常将超出色域范围的颜色转换成在色域中具有相同光亮度的颜色.         Leaves colors thatfall inside the gamut unchanged. This method usually converts out of gamutcolors to colors that have the same lightness but fall just inside the gamut.

absolutecolorimetric

当转换颜色时使白点匹配失效. 通常不建议使用此项.        Disables white point matching when converting colors. This option is generallynot recommended.


Animatable:no.

Attributes defined elsewhere:

%stdAttrs;,%xlinkRefAttrs;.



12.3.4 @color-profile 当使用CSS 样式  @color-profilewhen using CSS styling

当使用CSS对文档格式化时, 可以用@color-profile 规则指定一个颜色配置选项描述.其一般形式为:     When the document is styled using CSS, the@color-profile rulecan be used to specify a color profile description. The general form is:

 
@color-profile { <color-profile-description> }

此处<color-profile-description> 具有下列形式:     where the<color-profile-description> has the form:

 
descriptor: value;
[...]
descriptor: value;

每个@color-profile 规则为每个颜色配置选项描述子指定一个值 , 不管是隐含的还是显式的. 那些在此规则中没有显式设定值将取在此规范中的每个描述子中给定的初始值. 这些描述子在 @color-profile 规则所定义的上下文中单独应用 , 并且不用于文档语言元素. 于是, 不存在描述子用于其上的元素的记号, 而不管其值是否被子元素所继承.         Each @color-profile rule specifies a value for every color profile descriptor,either implicitly or explicitly. Those not given explicit values in the ruletake the initial value listed with each descriptor in this specification. Thesedescriptors apply solely within the context of the @color-profile rule in whichthey are defined, and do not apply to document language elements. Thus, thereis no notion of which elements the descriptors apply to, or whether the valuesare inherited by child elements.

下列为一个<color-profile-description>的描述子 :  The following are the descriptorsfor a <color-profile-description>:

'src' (Descriptor)

Values:

sRGB | <local-profile> | <uri> | (<local-profile> <uri>) | inherit

Initial:

sRGB

Media:

visual

sRGB

源配置选项为sRGB 颜色空间. 为了CSS 词法扫描和分析规则与保持一致, 关键词 "sRGB" 是区分大小写的; 然而, 建议混合大写  "sRGB" 以便与通常的工业实践保持一致.                The source profile is the sRGB colorspace. For consistency withCSS lexical scanning andparsing rules, the keyword "sRGB" is case-insensitive; however,it is recommended that the mixed capitalization "sRGB" be used forconsistency with common industry practice.

<local-profile>

源配置选项为本地存储配置选项. <local-profile> 的语法如下:     The source profile is a locally-storedprofile. The syntax for <local-profile> is:

"local(" + <string> + ")"

这里<string> 为配置选项的由国际颜色协会 指定的唯一标识. (注记: 配置选项描述域不代表一个配置选项的唯一 ID. 按照当前的ICC 提议, 配置选项的唯一ID 为一种 MD5-编码的在配置选项开头部分的值.)    where <string> is the profile's unique ID as specified byInternational Color Consortium. (Note: Profiledescription fields donot represent a profile's unique ID. Withcurrent ICC proposals, the profile's unique ID is an MD5-encoded value withinthe profile header.)

<uri>

源配置选项为指向一颜色配置选项URI 引用.    The source profile is aURIreference to a color profile.

(<local-profile> <uri>)

两种配置选项被指定. 如果<local-profile> 不能在本地系统中找到, 则使用第二项配置选项 <uri>.      Two profiles are specified. If<local-profile> cannot be found on the local system, then the<uri> isused.

'name' (Descriptor)

Values:

<name>

Initial:

undefined

Media:

visual

<name>

参见对元素'color-profile' 的属性name 的描述. 注意如果不提供<name> , 则不能引用给定的@color-profile 定义.    See the description for the name attribute on the 'color-profile' element. Note that if<name> is not provided, it will be impossible to reference the given@color-profile definition.

'rendering-intent' (Descriptor)

Values:

auto | perceptual | relative-colorimetric |
saturation | absolute-colorimetric

Initial:

auto

Media:

visual

Animatable:  

no

参见对元素 'color-profile' 的属性rendering-intent 的描述. See the description for therendering-intent attribute on the 'color-profile' element.



12.3.5 'color-profile'property

 

'color-profile'

Value:  

auto | sRGB | <name> | <uri> | inherit

Initial:  

auto

Applies to:  

'image' elements that refer to raster images

Inherited:  

yes

Percentages:  

N/A

Media:  

visual

Animatable:  

yes

auto

此为缺省行为.假定所有颜色在 sRGB 颜色空间中定义除非在内容数据中指定了更精确的嵌入配置选项 . 对于本身数据中具有一个配置选项的图像便使用此配置选项. 而对于没有自身配置选项的图像, 则使用 sRGB 配置选项.      This is the default behavior. All colors are presumed to be defined in the sRGBcolor space unless a more precise embedded profile is specified within contentdata. For images that do have a profile built into their data, that profile isused. For images that do not have a profile, the sRGB profile is used.

sRGB

源配置选项假定为sRGB. 它与 auto不同的地方在于此时不考虑在图像本身的配置选项.         The source profile is assumed to be sRGB. This differs from auto in that itoverrides an embedded profile inside an image.

为了 CSS 词法扫描和分析规则与保持一致, 关键词 "sRGB" 是区分大小写的; 然而, 建议混合大写  "sRGB" 以便与通常的工业实践保持一致.         Forconsistency withCSS lexicalscanning and parsing rules, the keyword "sRGB" iscase-insensitive; however, it is recommended that the mixed capitalization"sRGB" be used for consistency with common industry practice.

<name>

与用户代理的颜色配置选项描述数据库中的某个已经定义的颜色配置选项相对应的名字. 用户代理在颜色配置选项描述数据库中查找 颜色配置选项描述项其名字描述子与<name> 匹配并且使用最后一个找到的匹配项. 如果找到一个匹配 , 则使用相应的配置选项而忽略在一个图像中嵌入的配置选项. 如果没有找到匹配, 则使用图像中嵌入的配置选项.              A name corresponding to a defined color profile that is in the user agent'scolor profile description database. The user agent searches the color profiledescription database for a colorprofile description entry whose name descriptor matches <name> anduses the last matching entry that is found. If a match is found, thecorresponding profile overrides an embedded profile inside an image. If nomatch is found, then the embedded profile inside the image is used.

<uri>

一个对源颜色配置选项的URI引用. 所引用的颜色配置选项将取代嵌入图像中的配置选项.           AURIreference to the source color profile. The referenced color profileoverrides an embedded profile inside the image.



12.4 DOM interfaces

下列接口定义如下: SVGColorProfileElement, SVGColorProfileRule.     The following interfaces are defined below: SVGColorProfileElement, SVGColorProfileRule.

 

接口 SVGColorProfileElement    Interface SVGColorProfileElement

SVGColorProfileElement 接口对应 'color-profile' 元素.     The SVGColorProfileElement interface corresponds tothe 'color-profile' element.


IDL 定义   IDL Definition

 
interface SVGColorProfileElement : 
                SVGElement,
                SVGURIReference,
                SVGRenderingIntent { 
 
           attribute DOMString      local;
                       // raises DOMException on setting
           attribute DOMString      name;
                       // raises DOMException on setting
           attribute unsigned short renderingIntent;
                       // raises DOMException on setting
};

 

属性 Attributes

DOMString local

与给定元素的local 属性相对应.    Corresponds to attribute local on the givenelement.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生  Raised on an attempt to change the value of a readonly attribute.

DOMString name

与给定元素的name 属性相对应.    Corresponds to attribute name on the givenelement.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生 Raised on an attempt to change the value of a readonly attribute.

unsigned short renderingIntent

与给定元素的rendering-intent  属性相对应. 渲染意图的类型, 通过一个 SVGRenderingIntent 常量来指定.    Corresponds to attribute rendering-intent on thegiven element. The type of rendering intent, identified by one of theSVGRenderingIntent constants.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生 Raised on an attempt to change the value of a readonly attribute.

 

接口 SVGColorProfileRule   Interface SVGColorProfileRule

  SVGColorProfileRule接口代表在CSS样式表中的 一种@color-profile 规则. 一个@color-profile 规则指定在给定文档中进行引用的 ICC 配置选项.       The SVGColorProfileRule interfacerepresents an @color-profile rule in a CSS style sheet. An @color-profile ruleidentifies a ICC profile which can be referenced within a given document.

对接口SVGColorProfileRule 支持只需用户代理支持 使用CSS格式化.   Support for the SVGColorProfileRuleinterface is only required in user agents that supportstyling withCSS.


IDL 定义 IDLDefinition

 
interface SVGColorProfileRule : 
                SVGCSSRule,
                SVGRenderingIntent { 
 
           attribute DOMString      src;
                       // raises DOMException on setting
           attribute DOMString      name;
                       // raises DOMException on setting
           attribute unsigned short renderingIntent;
                       // raises DOMException on setting
};

 

属性 Attributes

DOMString src

对应于一个@color-profile 规则的属性 src.     Corresponds to property srcwithin an @color-profile rule.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生 Raised on an attempt to change the value of a readonly attribute.

DOMString name

对应于一个@color-profile 规则的属性 name.     Corresponds to property namewithin an @color-profile rule.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生 Raised on an attempt to change the value of a readonly attribute.

unsigned short renderingIntent

渲染意图的类型, 通过一个SVGRenderingIntent 常量来指定.       The type of rendering intent,identified by one of the SVGRenderingIntent constants.

设置时的例外 Exceptions on setting

DOMException

 

NO_MODIFICATION_ALLOWED_ERR: 当企图改变一个只读属性的值时发生 Raised on an attempt to change the value of a readonly attribute.


previous next   contents   elements   attributes   properties   index  

0 0