您的位置:首页 > 其它

Illustrator CS4之fxg文件格式(MXML) Vs WPF之XAML

2009-01-03 23:28 239 查看
在Illustrator CS4中,可以将图形文件用 FXG 格式存储。根据Adobe文档,在 Illustrator 中创建可在 Adobe Flex® 中使用的结构化图形时,可将文件存储为 Flash XML 图形格式 (FXG) 格式。

先来看看一个例子:



这个例子非常简单,画一个带填充色和边框的矩形。

看看FXG代码:

<?xml version="1.0" encoding="utf-8" ?>
<Graphic version="1.0" viewHeight="100" viewWidth="106" xmlns="http://ns.adobe.com/fxg/2008">
  <Group d:type="layer" d:userLabel="Layer 1" xmlns:d="http://ns.adobe.com/fxg/2008/dt">
    <Rect x="0.5" y="0.5" width="105" height="99">
      <fill>
        <SolidColor color="#ffee00"/>
      </fill>
      <stroke>
        <SolidColorStroke color="#e60012" caps="none" weight="1" joints="miter" miterLimit="4"/>
      </stroke>
    </Rect>
  </Group>
</Graphic>

 

FXG 是基于 MXML(由 FLEX 框架使用的基于 XML 的编程语言)子集的图形文件格式。可以在 Adobe Flex Builder 等应用程序中使用 FXG 文件以开发丰富多采的 Internet 应用程序和体验。存储为 FXG 格式时,图像的总像素必须少于 6,777,216,并且长度或宽度应限制在 8192 像素范围内。

 

同样的东西,在XAML中:
<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <Canvas Width="106" Height="100">
    <Path Stroke="#e60012" StrokeThickness="1" Fill="#ffee00">
      <Path.Data>
        <RectangleGeometry Rect="0.5,0.5,105,99" />
      </Path.Data>
  </Canvas>
</Page>

通过比较,我们可以看到XAML与MXML的命名空间及元素语法是不一样的。XAML遵循首字母大写,而MXML则所有属性的首字母均是小写!

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息