您的位置:程序门 -> java -> j2se / 基础类



求教,根据一个xml文件定义的内容,生成相应图片


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


求教,根据一个xml文件定义的内容,生成相应图片
发表于:2007-01-24 16:47:09 楼主
<!--  

关于图片坐标的说明:

任何图片的坐标,旋转,放缩都是以图片中心为原点进行操作的。
比如图片的坐标为(0,   0),表示图片的中心点位于card的左上角零点处。

-->

<root>

<layer>
        <id> <![cdata[0]]> </id>   <!--   图层唯一标识符   -->
        <url> <![cdata[images/gallery/4.jpg]]> </url>   <!--   图片url   -->
        <depth> <![cdata[0]]> </depth>   <!--   图层深度,数值大的在上面   -->
        <y> <![cdata[-18]]> </y>   <!--   图片坐标,相对于card的左上角   -->
        <x> <![cdata[-6.5]]> </x>
        <alpha> <![cdata[100]]> </alpha>   <!--   图片透明度   -->
        <rotation> <![cdata[0]]> </rotation>   <!--   旋转角度   -->
        <yscale> <![cdata[100]]> </yscale>   <!--   y   轴方向放缩比例   100为100%大小,200为200%原尺寸...   ,负值表示   x   轴的对称翻转,尺寸比例同正值,比如-100为100%大小   -->
        <xscale> <![cdata[100]]> </xscale>   <!--   x   轴方向放缩比例   100为100%大小,200为200%原尺寸...   ,负值表示   y   轴的对称翻转,尺寸比例同正值,比如-100为100%大小-->
        <hue> <![cdata[0]]> </hue>   <!--   色调   数值范围   0~360   -->
        <saturation> <![cdata[1]]> </saturation>   <!--   饱和度   数值范围   0~1   -->
        <contrast> <![cdata[0]]> </contrast>   <!--   对比度   数值范围   -1~1   -->
        <brightness> <![cdata[0]]> </brightness>   <!--   亮度   数值范围   -255~255   -->
        <effect> <![cdata[0]]> </effect>   <!--   0:无效果,1-4为特殊效果:   desaturate:1,   emboss:2,   oldstyle:3,   invert:4   -->
</layer>

<layer>
        <id> <![cdata[1]]> </id>  
        <url> <![cdata[images/gallery/4.jpg]]> </url>
        <depth> <![cdata[1]]> </depth>
        <y> <![cdata[18]]> </y>
        <x> <![cdata[20]]> </x>
        <alpha> <![cdata[100]]> </alpha>
        <rotation> <![cdata[0]]> </rotation>
        <yscale> <![cdata[100]]> </yscale>
        <xscale> <![cdata[100]]> </xscale>
        <hue> <![cdata[0]]> </hue>
        <saturation> <![cdata[1]]> </saturation>
        <contrast> <![cdata[0]]> </contrast>
        <brightness> <![cdata[0]]> </brightness>
        <effect> <![cdata[0]]> </effect>
</layer>

<text>  
        <id> <![cdata[0]]> </id>   <!--   文字唯一标识符   -->
        <x> <![cdata[15]]> </x>   <!--   文字坐标,相对于card的左上角   -->
        <y> <![cdata[15]]> </y>
        <value> <![cdata[asdasd]]> </value>   <!--   文本内容   -->
        <font> <![cdata[arial   black]]> </font>   <!--   字体   -->
        <size> <![cdata[14]]> </size>   <!--   大小   -->
        <color> <![cdata[13209]]> </color>   <!--   颜色   十进制:3368703,   根据需要你们可以转成16进制的格式   0x3366ff   -->
        <underline> <![cdata[1]]> </underline>   <!--   是否有下划线   值:   0/1   -->
        <italic> <![cdata[1]]> </italic>   <!--   斜体   值:   0/1   -->
        <bold> <![cdata[1]]> </bold>   <!--   粗体   值:   0/1   -->
</text>

<text>
        <id> <![cdata[1]]> </id>
        <x> <![cdata[28]]> </x>
        <y> <![cdata[117]]> </y>
        <value> <![cdata[sdasda]]> </value>
        <font> <![cdata[arial]]> </font>
        <size> <![cdata[12]]> </size>
        <color> <![cdata[0]]> </color>
        <underline> <![cdata[0]]> </underline>
        <italic> <![cdata[0]]> </italic>
        <bold> <![cdata[0]]> </bold>
</text>

<templete> <![cdata[images/templete/3.png]]> </templete>   <!--   templete图片的url   -->

</root>


头有点大了...

不胜感激

特别是透明度、色调、饱和度、对比度、亮度这几项有没有算法?
发表于:2007-01-24 17:14:171楼 得分:0
学习大家经验。。

会不会有属性可以设置??
waiting...
发表于:2007-01-24 17:17:572楼 得分:0
非要这样干吗直接传坐标.我这里有个应用是c++画的图,拿java来读出来
这个是xml的部分,lz参考下.非要搞成lz这样的实在是麻烦得很噢
</points>
</line>
<line   name= "line116 "   origin= "290,556.85 "   showhint= "false "   fillfq= "0 "   linefq= "0 "   picname= "&apos;&apos; "   linecolor= "$ff ">
<points>
266,556.85,6
330,556.85,2
</points>
</line>
<element   name= "element18 "   bounds= "258,600.85,274,622.1 "   origin= "266,611.475 "   showhint= "false ">
<element   name= "element2 "   bounds= "258,614.1,274,622.1 "   origin= "282,622.1 "   showhint= "false ">
<line   name= "line7 "   origin= "265.5,614.1 "   showhint= "false "   fillfq= "0 "   linefq= "0 "   picname= "&apos;&apos; "   linecolor= "$ff ">
<points>
258,614.1,6
274,614.1,2
</points>
</line>
<line   name= "line8 "   origin= "273.5,622.1 "   showhint= "false "   fillfq= "0 "   linefq= "0 "   picname= "&apos;&apos; "   linecolor= "$ff ">
<points>
260.666666667,618.1,6
271.333333333,618.1,2
</points>
</line>
<line   name= "line9 "   origin= "281.5,630.1 "   showhint= "false "   fillfq= "0 "   linefq= "0 "   picname= "&apos;&apos; "   linecolor= "$ff ">
<points>
263.333333333,622.1,6
268.666666667,622.1,2
</points>
</line>
</element>
<line   name= "line7 "   origin= "266,617.85 "   showhint= "false "   fillfq= "0 "   linefq= "0 "   picname= "&apos;&apos; "   linecolor= "$ff ">
<points>
266,600.85,6
266,613.85,2
</points>
</line>
发表于:2007-01-25 12:34:583楼 得分:0
楼上的兄弟,由于本应用是和flash配合的,flash生成的xml文件来记录图形信息

现在主要是卡在透明度、色调、饱和度、对比度、亮度这几项

不知兄弟有没有java的这类算法?或我们留下联系方式,彼此多多交流

msn:dds@citiz.net


快速检索

最新资讯
热门点击