新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论SVG, GML, X3D, VRML, VML, XAML, AVALON, Batik等基于XML的图形技术,以及有关GIS的应用。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - 高级XML应用『 SVG/GML/VRML/X3D/XAML 』 → SVG规范文档V1.1 (第三部分中英文对照稿) 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3478 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: SVG规范文档V1.1 (第三部分中英文对照稿) 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     naijgnaw 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究汇编)
      文章:31
      积分:239
      门派:XML.ORG.CN
      注册:2004/12/28

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给naijgnaw发送一个短消息 把naijgnaw加入好友 查看naijgnaw的个人资料 搜索naijgnaw在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看naijgnaw的博客楼主
    发贴心情 SVG规范文档V1.1 (第三部分中英文对照稿)

    3 渲染模型Rendering Model

    目录Contents

    3.1 简介Introduction

    3.2 绘画模型The painters model

    3.3 渲染次序Rendering Order

    3.4 组的渲染How groups are rendered

    3.5 元素的渲染How elements are rendered

    3.6 图形元素类型Types of graphics elements

    3.6.1 填充形状和文本Painting shapes and text

    3.6.2 栅格图像的填充Painting raster images

    3.7 过滤画过的区域Filtering painted regions

    3.8 裁剪、蒙罩、对象不透明Clipping, masking and object opacity

    3.9 上层合成Parent Compositing


    3.1 简介Introduction
    就像本章将要描述的,应用SVG就像是应用渲染(或成像)模型,这样应用模型的时候,不需要应用实例,但在所有支持该应用的设备上显示的结果都会和模型描述的一样。Implementations of SVG are expected to behave as though they implement a rendering (or imaging) model corresponding to the one described in this chapter. A real implementation is not required to implement the model in this way, but the result on any device supported by the implementation shall match that described by this model.
    关于一致性需求(conformance requirements)的附件描述了实际应用可能偏离描述的范围。在实现的时候,实际的应用往往会由于输出设备的局限(比如只支持有限的颜色范围),稍稍偏离描述,以及在实现精确数学模型时的偏差。比如,实践中用直线近似表示曲线,这种近似必须足够精确以满足一致性需求。The appendix on conformance requirements describes the extent to which an actual implementation may deviate from this description. In practice an actual implementation will deviate slightly because of limitations of the output device (e.g. only a limited range of colors might be supported) and because of practical limitations in implementing a precise mathematical model (e.g. for realistic performance curves are approximated by straight lines, the approximation need only be sufficiently precise to match the conformance requirements).
    3.2 绘画模型The painters model
    SVG使用渲染的绘画模型,绘画(PaintPaint)是应用在对输出设备的连续操作,每个操作在输出设备的不同区域描绘。当与前面描绘过的区域重叠时,新描绘的内容就会全部或部分地遮掩前面的内容。当重叠的内容不是完全不透明时,输出设备上的结果将由Alpha混合(Alpha Blending)描述的合成数学规则定义。SVG uses a "painters model" of rendering. Paint is applied in successive operations to the output device such that each operation paints over some area of the output device. When the area overlaps a previously painted area the new paint partially or completely obscures the old. When the paint is not completely opaque the result on the output device is defined by the (mathematical) rules for compositing described under Alpha Blending.
    3.3 渲染模型Rendering Order
    SVG文档片断中的元素有固定的绘制顺序,第一个元素首先被"描绘"。后面的元素画在前面的元素之上。Elements in an SVG document fragment have an implicit drawing order, with the first elements in the SVG document fragment getting "painted" first. Subsequent elements are painted on top of previously painted elements.
    3.4 组的渲染How groups are rendered
    组合元素(如'g'元素,参见容器元素container elements)(如'g'元素,参见容器元素container elements)能产生临时画布的效果,该画布初始化为透明背景,并在其上绘制子元素。在完成的组之上,所有对组定义的滤镜效果(filter effects)都会应用来创建更改的临时画布。更改的临时画布合成到背景中,并考虑所有组级别的遮罩(masking)和透明性(opacity)的设置。Grouping elements such as the 'g' (see container elements) have the effect of producing a temporary separate canvas initialized to transparent black onto which child elements are painted. Upon the completion of the group, any filter effects specified for the group are applied to create a modified temporary canvas. The modified temporary canvas is composited into the background, taking into account any group-level masking and opacity settings on the group.
    3.5 元素的渲染How elements are rendered
    个别图形元素就像每个图形元素代表他们自己的组,因此,这个效果就像为每个图形元素创建临时独立的画布。元素首先被画在临时画布上(参见下面的绘制图形和文本以及栅格图像的绘制),这时所有为图形元素指定的滤镜效果(filter effectsfilter effects)被用来创建改变的临时画布。更改的临时画布合成到背景中,并考虑所有对图形元素的剪裁,遮罩和对象透明性(clipping, masking and object opacity)等设置。Individual graphics elements are rendered as if each graphics element represented its own group; thus, the effect is as if a temporary separate canvas is created for each graphics element. The element is first painted onto the temporary canvas (see Painting shapes and text and Painting raster images below). Then any filter effects specified for the graphics element are applied to create a modified temporary canvas. The modified temporary canvas is then composited into the background, taking into account any clipping, masking and object opacity settings on the graphics element.
    3.6 图形元素类型Types of graphics elements
    SVG支持三种基本的能够在画布上渲染的图形元素(graphics elementsgraphics elements)类型。SVG supports three fundamental types of graphics elements that can be rendered onto the canvas:

    形状(Shapes),是直线和曲线的组合。Shapes , which represent some combination of straight line and curves

    文本(Text),是字符字形的组合。Text, which represents some combination of character glyphs

    栅格图像(Raster images),是指定矩形网格上点的序列的颜色和透明性(常常是alpha术语)数组的值(SVG支持一致性需求conformance requirements指定的栅格图像格式)。Raster images, which represent an array of values that specify the paint color and opacity (often termed alpha) at a series of points on a rectangular grid. (SVG requires support for specified raster image formats under conformance requirements.)

    3.6.1 绘制形状和文本Painting shapes and text
    形状和文本可以被充填(filledfilled)(例如在图形内部应用涂画)和勾画(stroked)(例如沿着图形轮廓涂画)。勾画操作集中在对象的轮廓,实际上是一半画在图形内部,一半画在外部。Shapes and text can be filled (i.e., apply paint to the interior of the shape) and stroked (i.e., apply paint along the outline of the shape). A stroke operation is centered on the outline of the object; thus, in effect, half of the paint falls on the interior of the shape and half of the paint falls outside of the shape.
    对某些类型的形状,标记符号(marker symbols,它们自己可组成任何复合图形、文本和图像)可以被画在选定至高点。每个标记符号都可以绘制,就像其图形内容已经扩展成SVG文档树,紧随在使用标记符号的形状对象之后。标记符号的图形内容可以用像图形元素一样的方法渲染。标记符号对文本不适用。For certain types of shapes, marker symbols (which themselves can consist of any combination of shapes, text and images) can be drawn at selected vertices. Each marker symbol is painted as if its graphical content were expanded into the SVG document tree just after the shape object which is using the given marker symbol. The graphical contents of a marker symbol are rendered using the same methods as graphics elements. Marker symbols are not applicable to text.
    填充首先涂画,接着是勾画,接着是标记符号。标记符号沿着形状轮廓顺序渲染,从图形的开始到图形的结束。The fill is painted first, then the stroke, and then the marker symbols. The marker symbols are rendered in order along the outline of the shape, from the start of the shape to the end of the shape.
    每个填充和勾画操作都有自己的透明性设置,因此,可以用半透明的画好的实体颜色,不同的填充和勾画操作的透明性值来充填和(或)勾画形状。Each fill and stroke operation has its own opacity settings; thus, you can fill and/or stroke a shape with a semi-transparently drawn solid color, with different opacity values for the fill and stroke operations.
    填充和勾画操作是完全独立的绘画操作,因此,如果同时充填并勾画一个图形,一半的勾画将被画在填充的部分之上。The fill and stroke operations are entirely independent painting operations; thus, if you both fill and stroke a shape, half of the stroke will be painted on top of part of the fill.
    SVG支持下列内置的绘画类型,它们可以用在填充和勾画操作上:SVG supports the following built-in types of paint which can be used in fill and stroke operations:

    实心颜色(Solid color)Solid color

    梯度(Gradients,线状和放射状) (linear and radial)

    模式(Patterns )Patterns

    3.6.2 绘制栅格图像Painting raster images
    当栅格图像渲染时,原先的样本被重新"采样",用标准运算法则在输出设备需要的位置上产生点。重采样需求将在一致性需求(conformance requirementsconformance requirements)中讨论。When a raster image is rendered, the original samples are "resampled" using standard algorithms to produce samples at the positions required on the output device. Resampling requirements are discussed under conformance requirements.
    3.7 过滤画过的区域Filtering painted regions
    SVG允许任何绘画操作被过滤(参见滤镜效果Filter EffectsFilter Effects)。SVG allows any painting operation to be filtered. (See Filter Effects.)
    在这种情况下,结果必须就像绘制操作被应用到初始化成透明背景的画布媒介上,以滤镜效果(Filter Effects)中给出的规则决定的大小,接着被滤镜效果(Filter Effects)中定义的方法过滤。In this case the result must be as though the paint operations had been applied to an intermediate canvas initialized to transparent black, of a size determined by the rules given in Filter Effects then filtered by the processes defined in Filter Effects.
    3.8 剪裁、遮罩与对象透明性Clipping, masking and object opacity
    SVG允许任何绘画操作通过裁剪和遮罩方式限定在输出设备的一个子区域上,这在裁剪、遮罩和组合(Clipping, Masking and CompositingClipping, Masking and Compositing)中描述。SVG allows any painting operation to be limited to a subregion of the output device by clipping and masking. This is described in Clipping, Masking and Compositing.
    裁剪用路径来定义输出设备上的一个区域,在该区域上应用绘画。所有在裁剪范围内执行的绘画操作都必须被渲染,以便只有落在剪裁区域内的部分才受绘画操作的影响。裁剪路径可以被看作是遮罩,路径外面的像素是黑色,alpha 值为0;路径内部的像素是白色的,alpha值为1。内部和外部的范围是由定义绘画路径内部范围的规则定义的。裁减路径在低分辨率设备上有典型的平滑处理(参见形状渲染'shape-rendering'),裁剪在裁剪路径(Clipping paths)中描述。Clipping uses a path to define a region of the output device to which paint can be applied. Any painting operation executed within the scope of the clipping must be rendered such that only those parts of the device that fall within the clipping region are affected by the painting operation. A clipping path can be thought of as a mask wherein those pixels outside the clipping path are black with an alpha value of zero and those pixels inside the clipping path are white with an alpha value of one. "Within" is defined by the same rules used to determine the interior of a path for painting. The clipping path is typically anti-aliased on low-resolution devices (see 'shape-rendering'). Clipping is described in Clipping paths.
    遮罩使用被引用的SVG元素的颜色和alpha通道的亮度来定义一组补充的alpha值,并乘以图形种已有的alpha值,供遮罩使用。在遮罩(Masking)中有描述。Masking uses the luminance of the color channels and alpha channel in a referenced SVG element to define a supplemental set of alpha values which are multiplied to the alpha values already present in the graphics to which the mask is applied. Masking is described in Masking.
    追加的遮罩操作还可以通过应用一组渲染操作的"全局"不透明性来指定。这时,遮罩是无穷大的,颜色为白色,给定补透明性值的alpha通道。(参见不透明性属性'opacity' property) A supplemental masking operation may also be specified by applying a "global" opacity to a set of rendering operations. In this case the mask is infinite, with a color of white and an alpha channel of the given opacity value. (See 'opacity' property.)
    在所有情形下,SVG实现必须做到要像在画布媒介上首次进行绘画、过滤一样,该画布被初始化成透明的黑色。这时,画布媒介上的alpha值被乘上裁减路径、遮罩、不透明性属性('opacity' property)上的固定的alpha值,最终的画布用简单alpha混合而合成到背景中。因此,如果一个设备的输出区域用实体红色填充50%透明,接着在充填实体绿色,最终效果是就像仅仅充填了绿色50%透明。这是因为不透明的实体绿色在画布媒介上,在输出设备上渲染整个结果前,将红色完全遮盖。In all cases the SVG implementation must behave as though all painting and filtering is first performed to an intermediate canvas which has been initialized to transparent black. Then, alpha values on the intermediate canvas are multiplied by the implicit alpha values from the clipping path, the alpha values from the mask, and the alpha values from the 'opacity' property. The resulting canvas is composited into the background using simple alpha blending. Thus if an area of the output device is painted with a group opacity of 50% using opaque red paint followed by opaque green paint the result is as though it had been painted with just 50% opaque green paint. This is because the opaque green paint completely obscures the red paint on the intermediate canvas before the intermediate as a whole is rendered onto the output device.
    3.9 上层合成Parent Compositing
    SVG文档片段可以是半透明的,在许多环境中(比如Web浏览器),SVG文档片段都有最终的复合步骤,使得整个文档透明地混合到背景画布中。SVG document fragments can be semi-opaque. In many environments (e.g., Web browsers), the SVG document fragment has a final compositing step where the document as a whole is blended translucently into the background canvas.


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/6/6 17:08:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/7/21 22:26:47

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms