计算机科学技术系98级 任品.docx
- 文档编号:14485322
- 上传时间:2023-04-23
- 格式:DOCX
- 页数:15
- 大小:101.33KB
计算机科学技术系98级 任品.docx
《计算机科学技术系98级 任品.docx》由会员分享,可在线阅读,更多相关《计算机科学技术系98级 任品.docx(15页珍藏版)》请在冰豆网上搜索。
计算机科学技术系98级任品
AnIn-depthAnalysisofScalableVectorGraphics
计算机科学技术系98级任品
Abstract:
Anewtwo-dimensionalvectorgraphicsstandardnamedScalableVectorGraphics(SVG)[1]isemerging.ItisbasedontheXMLandvectorgraphicstechnologyanddevelopedbytheW3Corganizationandothermajorindustryplayers.Itpromisestobringthefastandrich-contentgraphicstothewebwhileovercomingtheshortcomingsoftraditionalrastergraphics.SVGintroducesalotofexcitingfeaturestothewebgraphicsworld,andcanbeseamlesslyintegratedintootherexistingwebtechnologies.Thispaperwillgiveanin-depthanalysistothisnewgraphicsstandard,focusingonitsfeatures,industrialimplementationstatus,therelatedresearchfieldsandthefuturework.Atlastweuseademotodemonstratethediscussedfeatures.
Keywords:
SVG,XML,graphicsstandard,vectorgraphics,web-basedgraphics
摘要:
SVG(ScalableVectorGraphics)是一种新的二维矢量图形标准,它基于XML技术,由W3C组织负责开发制订。
SVG能给网络应用带来快速高效,效果丰富的图形,同时克服了传统光栅图形的不足。
SVG给网络图形应用领域引入了很多新的技术特性,还可以和其他现存的网络技术无缝集成应用。
本文将重点分析SVG的技术特性,相关的关键应用实现和研究进展,并提出自己的观点,最后展示一个作者实现的SVG的应用实例。
关键词:
SVG,XML,图形标准,矢量图形,网络图形
1IntroductiontotheScalableVectorGraphics
Oneoftheultimategoalsforwebtechnologiesistobeabletoprovidethewebuserswithaclearandeffectivecommunicationenvironment.Toachievethisgoal,fast,scalableandrich-contentgraphicsisindispensable.However,thetraditionalrastergraphicssuchasGIFandJPEGcanonlymeetsomeofthecriteria.Theyarebig,slow,andresolution-fixed.SVGisdesignedtoimprovethissituation.Withthisnewgraphicsformat,thecomplexgraphicslayouts,sophisticatedgeometricobjects,resolution-scalableartworksandhighlyinteractiveanimationswithareasonablesmallfilesizeareallpossibleforthewebpagesandotherapplications.
TheSVGformatisbasedontheXML[2]technology.XMListheuniversalformatforstructureddocumentsanddataontheWebandregardedasthekeytothenextgenerationWeb.SVGusestheXMLgrammartodefinethescalablevector-based2DgraphicsandcanbeusedasaXMLNamespace[3]intheweb,thereforeitisabletocooperateeasilywithotherXML-basedwebtechnologies.BeingaXMLNamespace,aSVGdocumentisabornXMLdocument,soitcanenjoyalladvantagestheXMLdocumentshave.Forexample,itisabletobeeasilyeditedbytheplaintexteditorsanddynamicallygeneratedbytheserversidescriptlanguagessuchasPERLandPHP.
SVGisanopenstandardtechnology.ItisdevelopedbytheW3C.TheW3C(WorldWideWebConsortium)isanorganizationtodevelopinteroperabletechnologies(specifications,guidelines,software,andtools)toleadtheWebtoitsfullpotential.TomakeSVGmorepracticalandvendorneutral,majorindustrycompaniesinthisfieldareinvitedtodevelopthisstandardtogether,includingMicrosoft,Adobe,Canon,Kodak,IBM,Sunandsoon.TheW3ChasjustreleasedSVG1.0Specification[4]asaW3CRecommendationinthisSeptember.AnofficialTestSuite[5]hasalsobeenissuedbytheW3C.Allthetestsaredesignedtoguaranteetheimplementationoffeaturesdefinedinthespecificationandtheconformanceofvariousimplementationstoonespecificfeature.
2ThefeaturesofSVG
2.1Overview
Asagraphicsstandard,SVGallowsforthreetypesofgraphicobjects:
vectorgraphicshapes(e.g.,pathsconsistingofstraightlinesandcurves),imagesandtext.Graphicalobjectscanbegrouped,styled,transformedandcompositedintopreviouslyrenderedobjects.Thefeaturesetincludesnestedtransformations,clippingpaths,alphamasks,filtereffectsandtemplateobjects.
SVGdrawingscanbeinteractiveanddynamic,animationaredefinedandtriggeredeitherdeclaratively(tousethesamemechanismastheSMIL[6])orviascripting.
SVGisnaturallyreadyforthewebuse.AsaXMLnamespace,itiscompatiblewithalmostalltheprevailingwebtechnologies.WebgraphicsapplicationscanbenefitalotfromthesmallsizeofSVGfilesandthearrestingexpressivenessofSVGgraphics.
2.2Basicfeatures
SVGusesspecifictagstodefinebasicvectorgraphicsobjectssuchasrect,circle,ellipse,polyline,polygonandsoon.ComplexgraphicsthatcannotbedescribedbythebasicshapesaredefinedasPath.TherearetwokindsofSVG’sPath,linesandcurves,whilearcsandBeziercurvesarethemajormeanstodefinecurves.
SVGgraphicsarerenderedintoafiniterectangularregion,whichiscalledviewport.AnegotiationprocessbetweentheSVGdocumentfragmentanditsparentdeterminesthesizeoftheSVGviewport.Afterestablishingaviewport,anewviewportandusercoordinatesystemisimplicitlyformed.AnewuserspacecanbeestablishedatanyplacewithinaSVGdocumentbyspecifyingatransformationmatrix,includingrotation,skewing,scaling,andtranslation.
SVGusesa“Painter’sModel”forrendering.Allthepaintoperationsareprocessedsuccessively.ThefirstelementintheSVGdocumentgettingpaintedfirst,subsequentelementarepaintedontopofpreviouslypaintedelements.Graphicselementsareblendedintotheelementsalreadyrenderedonthecanvasusingsimplealphacompositing.Thefollowingtworenderingproperties‘color-interpolation’and‘color-rendering’provideinformationaboutthecolorspacetoapplythecompositingoperation.
AllSVGcolorsarespecifiedinthesRGBcolorspace.Additionally,SVGcontentcanspecifyanalternatecolorspecificationusinganICC(InternationalColorConsortium)[7]profile.IfICC-basedcolorsareprovidedandtheSVGuseragentsupportsICCcolor,thentheICC-basedcolortakesprecedenceoverthesRGBcolorspecification.TheICCprofileisastandardfordocumentingthecolorcharacteristicsofinputandoutputdevices.Usingthisstandard,itispossibleforSVGcontenttobecorrectlytransformedandviewedondifferentdevices.
SVGusesstylingpropertiestodescribemanyofitsdocumentparameters.StylingpropertiesdefinehowthegraphicselementsintheSVGcontentaretoberendered.StylingpropertiescanbeassignedeitherusingSVG’spresentationattributesorusingCSS[8].ForeachstylepropertydefinedinSVG,thereisacorrespondingpresentationattribute(XMLattribute).Tochangethestylingresult,wecansimplyalterthevalueoftherelevantpresentationattributes.CSSisawidelyimplementeddeclarativelanguageforassigningstylingpropertiestoHTMLorXMLcontent,includingSVG.Itrepresentsacombinationoffeatures,simplicityandcompactnessthatmakesitverysuitableformanyapplicationofSVG.CSSrulescanbeneatlyexploitedinSVGdocumentasexternalCSSstylesheet,internalCSSstylesheetorinlinestyle.XSLT[9]isanotherusefultoolforstyling.XSLTdefineshowtotransformXMLcontentintosomethingelse,usuallyotherXML.WecanobtaintotallydifferentexteriorstylingresultsviaapplyingproperXSLstylesheetstooneSVGdocument.
2.3Rich-contentgraphics
ThetextcapabilityinSVGispowerful.Textcanberenderedinahorizontal、verticallineoralongacomplexpath.InSVGalltheparametersforgeneratingtextcanbedeclarativelyspecified,suchasfontfamily,fontsize,position,widthetc.SVGalsosupportsexternalfontdescriptionfiles,whichcanbeentirelyembeddedintoaSVGdocument.SVGperformsnoautomaticlinebreakingorwordwrapping.Tag
SVGallowsanypaintingoperationlimitedtoasub-regionoftheviewportbyclippingandmasking.Clippingpathsuseanycombinationofpaths,textandbasicshapestoserveastheoutlineofa1-bitmask,whereeverythingonthe"inside"oftheoutlineisallowedtoshowthroughbuteverythingontheoutsideismaskedout.Masksarecontainerelements,whichcancontaingraphicalelements,orothercontainerelementsthatdefineasetofgraphicsthatistobeusedasasemi-transparentmaskforcompositingforegroundobjectsintothecurrentbackground.Onekeydistinctionbetweenaclippingpathandamaskisthatclippingpathsarehardmaskswhereasmasksconsistofanimagewhereeachpixelvalueindicatesthedegreeoftransparencyandopacity.Inamask,eachpixelvaluecanrangefromfullytransparenttofullyopaque.
Themostexcitingrich-contentfeatureisFilter.Afiltereffectconsistsofaseriesofgraphicsoperationsthatareappliedtoagivensourcegraphicstoproduceamodifiedgraphicalresult.Theresultofthefiltereffectisrenderedtothetargetdeviceinsteadoftheoriginalsourcegraphic.Whencombinedwiththe2DpowerofSVG,filtereffectscandescribemuchofthecommonartworkontheWebinsuchawaythatclient-sidegenerationandalterationcanbeperformedeasily.Sofarthereare19filterprimitivesintheSVGspecification1.0.Eachfilterprimitiveperformsasinglefundamentalgraphicaloperation.Filterprimitivesareusuallycombinedtoachieveacomplexfiltereffect.Becausemostofthefilterprimitivesrepresentsomeformofimageprocessing,inmostcasestheoutputfromafilterprimitiveisasingleRGBAimage.
2.4Dynamicfeatures
BecausetheWebisadynamicmedia,SVGsupportstheabilitytochangevectorgraphicsovertime.SVGprovidestwomajoranimationmeans:
usingSVG’sanimationelementsorusingSVGDOM.
SVG’sanimationelementsaredevelopedincollaborationwithW3C’sSMIL[]workinggroup.Theanimationelementssupportthetime-basedmodificationtotheSVGdocument’selements.TheysharethesametimingandanimationmechanismswithSMIL.Theanimationdefinesamappingoftimetovaluesforthetargetattributes.Thismappingaccountsforallaspectsoftiming,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机科学技术系98级 任品 计算机科学 技术 98
![提示](https://static.bdocx.com/images/bang_tan.gif)