SlideShare a Scribd company logo
DojoX GFX
       Eugene Lazutkin
Dojo Toolkit/Sun Microsystems

SVG Open 2007, Tokyo, Japan
Welcome to Dojo

    Dojo consists of three sub-projects:
●


        Dojo Core (a.k.a. Dojo)
    –

             Includes Dojo Base — always available basic
         ●


             functionality.
        Dijit
    –

             Set of core widgets aimed at simplification of UI
         ●


             creation.
        DojoX (a.k.a. Dojo eXtended/eXperimental)
    –

             Advanced functionality, experimental code.
         ●


             DojoX GFX is part of DojoX.
         ●
Intro I

    GFX loosely follows the SVG model.
●



    The length unit is pixel.
●



    Point definition:
●


        {x: 0, y: 0}
    –

    JavaScript-specific features:
●


        Duck-typing is used where possible.
    –

        All setters are chained.
    –
Intro II

    At present time following backends are
●


    supported:
        SVG.
    –

        VML.
    –

        Silverlight.
    –

    We strive to be as portable as possible,
●


    but restricted (mostly by VML).
        Always test your program in target
    –
        environments!
Intro III

    GFX defines six classes of objects:
●


        Shape.
    –

             Important shape: group.
         ●



        Fill.
    –

        Stroke.
    –

        Font.
    –

        Matrix.
    –

        Surface.
    –

             Serves as a top-level group.
         ●
Colors I

    GFX includes dojo.Color() by default.
●



    dojo.Color (part of Dojo Base):
●


        Defines common color names,
    –
        representations (hex, rgb/rgba, array).
        dojo.colors module adds the CSS3 support
    –
        and extended set of color names.
    GFX accepts a large set of color
●


    definitions directly.
Colors II

    Examples of color “red”:
●


        Strings:
    –

             “red”, “#F00”, “#FF0000”, “rgb(255, 0, 0)”,
         ●


             “rgba(255, 0, 0, 1)”.
        Arrays:
    –

             [255, 0, 0], [255, 0, 0, 1]
         ●



        CSS3 strings (needs dojo.colors):
    –

             “rgb(100%, 0%, 0%)”, “rgba(100%, 0%, 0%, 1)”,
         ●


             “hsl(0, 100%, 50%)”, “hsla(0, 100%, 50%, 1)”
         ●



        new dojo.Color(255, 0, 0)
    –
Shapes I

    Following shapes are defined:
●


        Basic shapes: rectangle, ellipse,
    –
        polyline/polygon, path, image, text.
        Convenient shapes: circle, line.
    –

        Experimental shapes: textpath.
    –

    Cheatsheet for all definition objects:
●


        dojox/gfx/_base.js (right after utility
    –
        definitions).
Shapes II

    Each shape is made up of two objects:
●


        Shape definition.
    –

             Describes a geometry.
         ●


             Simple JSON object.
         ●


                  Can be serialized, and streamed.
              –

             Full support for duck-typing.
         ●


                  No need to specify default values.
              –

        Shape object.
    –

             Represents an instantiated shape.
         ●


             Provides an OO-based interface.
         ●


             Keeps a shape definition object.
         ●
Shapes III

    Every shape supports following methods:
●


        getShape/setShape.
    –

             Access to the underlying shape definition.
         ●


             Each shape accepts only shape-specific
         ●


             definitions.
        getFill/setFill, getStroke/setStroke.
    –

             Access to current fill and stroke definitions.
         ●



        getTransform/setTransform,
    –
        applyRightTransform/applyLeftTransform.
             Transformation manipulations.
         ●


             applyTransform == applyRightTransform.
         ●
Shapes IV

    Every shape supports following methods:
●


        moveToFront/moveToBack.
    –

             Z-order manipulations.
         ●



        getParent, remove.
    –

             Parent-related manipulations.
         ●



        connect/disconnect.
    –

             Event processing.
         ●



        Experimental introspection methods.
    –

    Shape objects are defined by renderers.
●
Events

    Supported events:
●


        onclick
    –

        onmousedown
    –

        onmouseup
    –

        onmousemove
    –

        onmouseenter
    –

        onmouseleave
    –

        onkeydown
    –

        onkeyup
    –
Surface I

    Defines a drawing area.
●



    Serves as a top-level group object.
●



    Defines shape creators:
●


        createPath, createRect, createCircle,
    –
        createEllipse,createLine, createPolyline,
        createImage, createText, createTextPath.
             Shape's type is implied.
         ●



        createShape.
    –

             You should specify a type.
         ●



        createGroup.
    –
Surface II

    Surface is a renderer-specific object.
●



    It supports the same event interface as
●


    shapes.
    Surface creation:
●


        dojox.gfx.createSurface(domNode, width,
    –
        height).
Rectangle

    Definition with defaults:
●


        {type: quot;rectquot;, x: 0, y: 0, width: 100, height:
    –
        100, r: 0}.
        As always you can skip any default values.
    –

        What is “r”? It is a radius of rounded corners.
    –

    Creator method:
●


        createRect(rect).
    –
Stroke I

    Definition with defaults:
●


        {type: quot;strokequot;, color: quot;blackquot;, style: quot;solidquot;,
    –
        width: 1, cap: quot;buttquot;, join: 4}.
        Styles:
    –

             “Solid”, “ShortDash”, “ShortDot”, “ShortDashDot”,
         ●


             “ShortDashDotDot”, “Dot”, “Dash”, “LongDash”,
             “DashDot”, “LongDashDot”, “LongDashDotDot”.
        Caps:
    –

             “Butt”, “Round”, “Square”.
         ●
Stroke II

    Definition with defaults:
●


        {type: quot;strokequot;, color: quot;blackquot;, style: quot;solidquot;,
    –
        width: 1, cap: quot;buttquot;, join: 4}.
        Joins:
    –

             “Round”, “Square”.
         ●


             If number, miter-type join is used.
         ●



    “null” means “use default”, which is “no
●


    stroke” at the moment.
    A string is interpreted as a solid color
●


    stroke.
Fill I

    There are four types of fill:
●


        Solid fill (specified by a color object).
    –

             Shortcuts are okay.
         ●



        Linear gradient.
    –

        Radial gradient.
    –

        Tiled pattern.
    –

        null — use default (“no fill”).
    –
Fill II

    Linear gradient definition with defaults:
●


        {type: quot;linearquot;, x1: 0, y1: 0, x2: 100, y2: 100,
    –
        colors: [{offset: 0, color: quot;blackquot;}, {offset: 1,
        color: quot;whitequot;}]}
        colors member defines an array of color
    –
        stops.
    Be careful:
●


        VML renderer doesn't support opacity for
    –
        color stops.
Fill III

    Radial gradient definition with defaults:
●


        {type: quot;radialquot;, cx: 0, cy: 0, r: 100, colors:
    –
        [{offset: 0, color: quot;blackquot;}, {offset: 1, color:
        quot;whitequot;}]}
        Very similar to the linear gradient.
    –

    Be careful:
●


        VML uses very peculiar (and visually
    –
        incompatible) algorithm to render the radial
        gradient.
Fill IV

    Pattern definition with defaults:
●


        {type: quot;patternquot;, x: 0, y: 0, width: 0, height:
    –
        0, src: quot;quot;}
        Similar to the image shape definition.
    –

    Be careful:
●


        Firefox SVG does not implement this fill style
    –
        yet.
Line

    Definition with defaults:
●


        {type: quot;linequot;, x1: 0, y1: 0, x2: 100, y2: 100}
    –

    Creator method:
●


        createLine(line).
    –

    This is a redundant shape.
●


        Can be easily simulated by polyline.
    –

        Yet frequently asked for especially by
    –
        novices.
    Obviously it doesn't support setFill().
●
Group I

    Defines all creators just like Surface.
●



    Used to group other shapes.
●


        Can have other groups as children.
    –

        Propagates events, and transformations.
    –

        Propagation for fill/stroke/font is planned.
    –

    No shape definition.
●



    Creator method:
●


        createGroup().
    –
Group II

    Group-specific API:
●


        add(shape)
    –

             Adds a shape to the group removing it from the
         ●


             previous parent.
        remove(shape)
    –

             Removes a shape from the group making it stand-
         ●


             alone.
        clear()
    –

             Removes all shapes.
         ●
Circle

    Definition with defaults:
●


        {type: quot;circlequot;, cx: 0, cy: 0, r: 100}
    –

    Creator method:
●


        createCircle(circle).
    –

    This is a redundant shape.
●


        Can be easily simulated by ellipse.
    –

        Yet frequently asked for especially by
    –
        novices.
Ellipse

    Definition with defaults:
●


        {type: quot;ellipsequot;, cx: 0, cy: 0, rx: 200, ry: 100}
    –

    Creator method:
●


        createEllipse(ellipse).
    –
Polyline

    Definition with defaults:
●


        {type: quot;polylinequot;, points: []}
    –

        points is an array of points.
    –

             Array of numbers is permitted.
         ●


             In this case numbers should go in pairs in [x, y]
         ●


             order.
    Doubles for polygon.
●


        If you want a closed polygon, do it explicitly.
    –

    Creator method:
●


        createPolyline(polyline)
    –
Path I

    Definition with defaults:
●


        {type: quot;pathquot;, path: quot;quot;}
    –

        path uses the SVG notation.
    –

    Path is a super-shape:
●


        It can emulate all other geometric shapes.
    –

        Exceptions: image, text, textpath.
    –

    Creator method:
●


        createPath(path)
    –
Path II

    Path-specific API:
●


        getAbsoluteMode/setAbsoluteMode
    –

             true for absolute mode, and false for relative
         ●


             mode.
        getLastPosition
    –

             Returns a point in absolute coordinates.
         ●



        moveTo, lineTo, hLineTo, vLineTo, closePath
    –

        curveTo, smoothCurveTo, qCurveTo,
    –
        qSmoothCurveTo
        arcTo
    –
Path III

    Shortcut:
●


        If you specify a string, creator assumes it is a
    –
        path definition.
    Be careful:
●


        VML doesn't support sub-pixel coordinates.
    –
Image I

    Definition with defaults:
●


        {type: quot;imagequot;, x: 0, y: 0, width: 0, height: 0,
    –
        src: quot;quot;}
        By specifying different width/height, you can
    –
        stretch the image.
    Obviously setFill/setStroke are not
●


    supported.
Image II

    Be careful:
●


        VML has problems displaying PNG files with
    –
        opacity.
        Silverlight doesn't support GIF.
    –
Text I

    Definition with defaults:
●


        {type: quot;textquot;, x: 0, y: 0, text: quot;quot;, align: quot;startquot;,
    –
        decoration: quot;nonequot;, rotated: false, kerning:
        true}
        Alignment:
    –

             “start”, “end”, “middle” relative to the anchor
         ●


             point.
        Decoration:
    –

             “underline”, “none”.
         ●



        Rotated:
    –

             If true, rotates each character 90 degrees CCW.
         ●
Text II

    Text-specific methods:
●


        getFont/setFont
    –
               Assigns a font definition to the shape.
           –

    Be careful:
●


        Kerning is not supported by some renderers.
    –

        Safari 3 beta doesn't support rotation.
    –
Font I

    Definition with defaults:
●


        {type: quot;fontquot;, style: quot;normalquot;, variant:
    –
        quot;normalquot;, weight: quot;normalquot;, size: quot;10ptquot;,
        family: quot;serifquot;}
        Styles:
    –

             “normal”, “italic”, “oblique”.
         ●



        Variants:
    –

             “normal”, “small-caps”.
         ●



        Weights:
    –

             “normal”, “bold”, numeric weight 100-900.
         ●
Font II

    family is a font name.
●


        Predefined names: “serif”, “sans-serif”,
    –
        “times”, “helvetica”, “monotone”.
             This fonts are mapped to platform-specific
         ●


             equivalents.
        VML on IE7 ignores family and always uses
    –
        Arial.
        SVG on Firefox ignores family in many cases.
    –

        Silverlight supports only predefined fonts.
    –
TextPath

    Be careful:
●


        Highly experimental.
    –

        Inconsistent support.
    –

        API is unfinished.
    –

    Definition with defaults:
●


        {type: quot;textpathquot;, text: quot;quot;, align: quot;startquot;,
    –
        decoration: quot;nonequot;, rotated: false, kerning:
        true }
        Supports a subset of the text definition.
    –
Matrix I

    Standard 2D matrix:
●


        {xx: 1, xy: 0, yx: 0, yy: 1, dx: 0, dy: 0}
    –

        You can use duck-typing skipping defaults.
    –

        Defined in dojox.gfx.matrix as Matrix2D.
    –

        Propagated up to dojo.gfx.Matrix2D.
    –
Matrix II

    Supports all common operations:
●


        Predefined constants:
    –

             identity, flipX, flipY, flipXY.
         ●



        Translation:
    –

             translate(x, y)
         ●



        Scaling:
    –

             scale(sx, sy)
         ●



        Rotation:
    –

             rotate(rad) — accepts radians.
         ●


             rotateg(deg) — accepts degrees.
         ●
Matrix III

    Supports all common operations:
●


        Skewing:
    –

             skewX(rad)
         ●


             skewXg(deg)
         ●


             skewY(rad)
         ●


             skewYg(deg)
         ●
Matrix IV

    Supports all common operations:
●


        General transformations:
    –

             invert(matrix)
         ●


             reflect(a, b) — forms a reflection matrix.
         ●


             project(a, b) — forms an orthogonal projection
         ●


             matrix.
             normalize(matrix) — produces Matrix2D, if
         ●


             necessary.
             clone(matrix) — creates a copy.
         ●


             multiply(m1, m2, ...)
         ●


             multiplyPoint(matrix, x, y)
         ●
Matrix V

    Provides “at” versions for some
●


    transformations.
        “At” implements the “transform at the point”
    –
        operation:
             xxxAt(arg, x, y) is equivalent to:
         ●


             translate(x, y) * xxx(arg) * translate(-x, -y)
         ●



        Provided methods:
    –

             scaleAt, rotateAt, rotategAt, skewXAt, skewXgAt,
         ●


             skewYAt, skewYgAt.
Matrix VI

    Shortcuts:
●


        Array of matrices is normalized by
    –
        multiplying its elements sequentially left to
        right.
        By default all incoming matrices are
    –
        normalized in GFX.
Questions


?   ?   ?   ?
 ?   ?   ?   ?
  ?   ?   ?   ?

More Related Content

What's hot

Lecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of TwenteLecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of Twente
Dirkjan Bussink
 
OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...
Doris Chen
 
Clojure Deep Dive
Clojure Deep DiveClojure Deep Dive
Clojure Deep Dive
Howard Lewis Ship
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
Danilo Sousa
 
Ruby
RubyRuby
CS 151 Classes lecture 2
CS 151 Classes lecture 2CS 151 Classes lecture 2
CS 151 Classes lecture 2
Rudy Martinez
 
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
Stephen Chin
 

What's hot (7)

Lecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of TwenteLecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of Twente
 
OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...
 
Clojure Deep Dive
Clojure Deep DiveClojure Deep Dive
Clojure Deep Dive
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
 
Ruby
RubyRuby
Ruby
 
CS 151 Classes lecture 2
CS 151 Classes lecture 2CS 151 Classes lecture 2
CS 151 Classes lecture 2
 
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
Cleaner APIs, Cleaner UIs with Visage (33rd Degrees)
 

Viewers also liked

The Design of Data
The Design of DataThe Design of Data
The Design of Data
Ian White
 
Departmental Seminar: Innovation
Departmental Seminar: InnovationDepartmental Seminar: Innovation
Departmental Seminar: Innovation
Ian White
 
Geotrends For 2011 And Beyond
Geotrends For 2011 And BeyondGeotrends For 2011 And Beyond
Geotrends For 2011 And Beyond
Ian White
 
Dark Side Of Data
Dark Side Of DataDark Side Of Data
Dark Side Of Data
Ian White
 
How Open Is Open (Redux)?
How Open Is Open (Redux)?How Open Is Open (Redux)?
How Open Is Open (Redux)?
Ian White
 
Big Data = Bigger Metadata
Big Data = Bigger MetadataBig Data = Bigger Metadata
Big Data = Bigger Metadata
Ian White
 

Viewers also liked (6)

The Design of Data
The Design of DataThe Design of Data
The Design of Data
 
Departmental Seminar: Innovation
Departmental Seminar: InnovationDepartmental Seminar: Innovation
Departmental Seminar: Innovation
 
Geotrends For 2011 And Beyond
Geotrends For 2011 And BeyondGeotrends For 2011 And Beyond
Geotrends For 2011 And Beyond
 
Dark Side Of Data
Dark Side Of DataDark Side Of Data
Dark Side Of Data
 
How Open Is Open (Redux)?
How Open Is Open (Redux)?How Open Is Open (Redux)?
How Open Is Open (Redux)?
 
Big Data = Bigger Metadata
Big Data = Bigger MetadataBig Data = Bigger Metadata
Big Data = Bigger Metadata
 

Similar to DojoX GFX Session Eugene Lazutkin SVG Open 2007

DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
Eugene Lazutkin
 
Building a Visualization Language
Building a Visualization LanguageBuilding a Visualization Language
Building a Visualization Language
jeresig
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
Anthony Starks
 
Intro to HTML5 Canvas
Intro to HTML5 CanvasIntro to HTML5 Canvas
Intro to HTML5 Canvas
Juho Vepsäläinen
 
JavaFX 1.0 SDK Aquarium Paris
JavaFX 1.0 SDK Aquarium ParisJavaFX 1.0 SDK Aquarium Paris
JavaFX 1.0 SDK Aquarium Paris
Alexis Moussine-Pouchkine
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
Kaz Yoshikawa
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
Wynn Netherland
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
jeresig
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
Filip Van Laenen
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
Jussi Pohjolainen
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Adam Darowski
 
Simplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and NibSimplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and Nib
Christian Joudrey
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVG
SpeedPartner GmbH
 
DotNetNuke World CSS3
DotNetNuke World CSS3DotNetNuke World CSS3
DotNetNuke World CSS3
gravityworksdd
 
Pythonic Graphics
Pythonic GraphicsPythonic Graphics
Pythonic Graphics
Kirby Urner
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaAnkara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
Ensar Basri Kahveci
 
Lec2
Lec2Lec2
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
QConLondon2008
 
CSS3 For WebKit: iPadDevCamp Presentation
CSS3 For WebKit: iPadDevCamp PresentationCSS3 For WebKit: iPadDevCamp Presentation
CSS3 For WebKit: iPadDevCamp Presentation
Estelle Weyl
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
SiliconExpert Technologies
 

Similar to DojoX GFX Session Eugene Lazutkin SVG Open 2007 (20)

DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
 
Building a Visualization Language
Building a Visualization LanguageBuilding a Visualization Language
Building a Visualization Language
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Intro to HTML5 Canvas
Intro to HTML5 CanvasIntro to HTML5 Canvas
Intro to HTML5 Canvas
 
JavaFX 1.0 SDK Aquarium Paris
JavaFX 1.0 SDK Aquarium ParisJavaFX 1.0 SDK Aquarium Paris
JavaFX 1.0 SDK Aquarium Paris
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
Simplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and NibSimplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and Nib
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVG
 
DotNetNuke World CSS3
DotNetNuke World CSS3DotNetNuke World CSS3
DotNetNuke World CSS3
 
Pythonic Graphics
Pythonic GraphicsPythonic Graphics
Pythonic Graphics
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaAnkara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
 
Lec2
Lec2Lec2
Lec2
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
CSS3 For WebKit: iPadDevCamp Presentation
CSS3 For WebKit: iPadDevCamp PresentationCSS3 For WebKit: iPadDevCamp Presentation
CSS3 For WebKit: iPadDevCamp Presentation
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 

More from Eugene Lazutkin

Service workers
Service workersService workers
Service workers
Eugene Lazutkin
 
Advanced I/O in browser
Advanced I/O in browserAdvanced I/O in browser
Advanced I/O in browser
Eugene Lazutkin
 
Streams
StreamsStreams
Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScript
Eugene Lazutkin
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.js
Eugene Lazutkin
 
TXJS 2013 in 10 minutes
TXJS 2013 in 10 minutesTXJS 2013 in 10 minutes
TXJS 2013 in 10 minutes
Eugene Lazutkin
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
Eugene Lazutkin
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
Eugene Lazutkin
 
Pulsar
PulsarPulsar
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
Eugene Lazutkin
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)
Eugene Lazutkin
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
Eugene Lazutkin
 
RAD CRUD
RAD CRUDRAD CRUD
RAD CRUD
Eugene Lazutkin
 
Exciting JavaScript - Part I
Exciting JavaScript - Part IExciting JavaScript - Part I
Exciting JavaScript - Part I
Eugene Lazutkin
 
CRUD with Dojo
CRUD with DojoCRUD with Dojo
CRUD with Dojo
Eugene Lazutkin
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slides
Eugene Lazutkin
 
Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real world
Eugene Lazutkin
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
Eugene Lazutkin
 

More from Eugene Lazutkin (19)

Service workers
Service workersService workers
Service workers
 
Advanced I/O in browser
Advanced I/O in browserAdvanced I/O in browser
Advanced I/O in browser
 
Streams
StreamsStreams
Streams
 
Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScript
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.js
 
TXJS 2013 in 10 minutes
TXJS 2013 in 10 minutesTXJS 2013 in 10 minutes
TXJS 2013 in 10 minutes
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
 
Pulsar
PulsarPulsar
Pulsar
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
RAD CRUD
RAD CRUDRAD CRUD
RAD CRUD
 
Exciting JavaScript - Part I
Exciting JavaScript - Part IExciting JavaScript - Part I
Exciting JavaScript - Part I
 
CRUD with Dojo
CRUD with DojoCRUD with Dojo
CRUD with Dojo
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slides
 
Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real world
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
 

Recently uploaded

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 

Recently uploaded (20)

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 

DojoX GFX Session Eugene Lazutkin SVG Open 2007

  • 1. DojoX GFX Eugene Lazutkin Dojo Toolkit/Sun Microsystems SVG Open 2007, Tokyo, Japan
  • 2. Welcome to Dojo Dojo consists of three sub-projects: ● Dojo Core (a.k.a. Dojo) – Includes Dojo Base — always available basic ● functionality. Dijit – Set of core widgets aimed at simplification of UI ● creation. DojoX (a.k.a. Dojo eXtended/eXperimental) – Advanced functionality, experimental code. ● DojoX GFX is part of DojoX. ●
  • 3. Intro I GFX loosely follows the SVG model. ● The length unit is pixel. ● Point definition: ● {x: 0, y: 0} – JavaScript-specific features: ● Duck-typing is used where possible. – All setters are chained. –
  • 4. Intro II At present time following backends are ● supported: SVG. – VML. – Silverlight. – We strive to be as portable as possible, ● but restricted (mostly by VML). Always test your program in target – environments!
  • 5. Intro III GFX defines six classes of objects: ● Shape. – Important shape: group. ● Fill. – Stroke. – Font. – Matrix. – Surface. – Serves as a top-level group. ●
  • 6. Colors I GFX includes dojo.Color() by default. ● dojo.Color (part of Dojo Base): ● Defines common color names, – representations (hex, rgb/rgba, array). dojo.colors module adds the CSS3 support – and extended set of color names. GFX accepts a large set of color ● definitions directly.
  • 7. Colors II Examples of color “red”: ● Strings: – “red”, “#F00”, “#FF0000”, “rgb(255, 0, 0)”, ● “rgba(255, 0, 0, 1)”. Arrays: – [255, 0, 0], [255, 0, 0, 1] ● CSS3 strings (needs dojo.colors): – “rgb(100%, 0%, 0%)”, “rgba(100%, 0%, 0%, 1)”, ● “hsl(0, 100%, 50%)”, “hsla(0, 100%, 50%, 1)” ● new dojo.Color(255, 0, 0) –
  • 8. Shapes I Following shapes are defined: ● Basic shapes: rectangle, ellipse, – polyline/polygon, path, image, text. Convenient shapes: circle, line. – Experimental shapes: textpath. – Cheatsheet for all definition objects: ● dojox/gfx/_base.js (right after utility – definitions).
  • 9. Shapes II Each shape is made up of two objects: ● Shape definition. – Describes a geometry. ● Simple JSON object. ● Can be serialized, and streamed. – Full support for duck-typing. ● No need to specify default values. – Shape object. – Represents an instantiated shape. ● Provides an OO-based interface. ● Keeps a shape definition object. ●
  • 10. Shapes III Every shape supports following methods: ● getShape/setShape. – Access to the underlying shape definition. ● Each shape accepts only shape-specific ● definitions. getFill/setFill, getStroke/setStroke. – Access to current fill and stroke definitions. ● getTransform/setTransform, – applyRightTransform/applyLeftTransform. Transformation manipulations. ● applyTransform == applyRightTransform. ●
  • 11. Shapes IV Every shape supports following methods: ● moveToFront/moveToBack. – Z-order manipulations. ● getParent, remove. – Parent-related manipulations. ● connect/disconnect. – Event processing. ● Experimental introspection methods. – Shape objects are defined by renderers. ●
  • 12. Events Supported events: ● onclick – onmousedown – onmouseup – onmousemove – onmouseenter – onmouseleave – onkeydown – onkeyup –
  • 13. Surface I Defines a drawing area. ● Serves as a top-level group object. ● Defines shape creators: ● createPath, createRect, createCircle, – createEllipse,createLine, createPolyline, createImage, createText, createTextPath. Shape's type is implied. ● createShape. – You should specify a type. ● createGroup. –
  • 14. Surface II Surface is a renderer-specific object. ● It supports the same event interface as ● shapes. Surface creation: ● dojox.gfx.createSurface(domNode, width, – height).
  • 15. Rectangle Definition with defaults: ● {type: quot;rectquot;, x: 0, y: 0, width: 100, height: – 100, r: 0}. As always you can skip any default values. – What is “r”? It is a radius of rounded corners. – Creator method: ● createRect(rect). –
  • 16. Stroke I Definition with defaults: ● {type: quot;strokequot;, color: quot;blackquot;, style: quot;solidquot;, – width: 1, cap: quot;buttquot;, join: 4}. Styles: – “Solid”, “ShortDash”, “ShortDot”, “ShortDashDot”, ● “ShortDashDotDot”, “Dot”, “Dash”, “LongDash”, “DashDot”, “LongDashDot”, “LongDashDotDot”. Caps: – “Butt”, “Round”, “Square”. ●
  • 17. Stroke II Definition with defaults: ● {type: quot;strokequot;, color: quot;blackquot;, style: quot;solidquot;, – width: 1, cap: quot;buttquot;, join: 4}. Joins: – “Round”, “Square”. ● If number, miter-type join is used. ● “null” means “use default”, which is “no ● stroke” at the moment. A string is interpreted as a solid color ● stroke.
  • 18. Fill I There are four types of fill: ● Solid fill (specified by a color object). – Shortcuts are okay. ● Linear gradient. – Radial gradient. – Tiled pattern. – null — use default (“no fill”). –
  • 19. Fill II Linear gradient definition with defaults: ● {type: quot;linearquot;, x1: 0, y1: 0, x2: 100, y2: 100, – colors: [{offset: 0, color: quot;blackquot;}, {offset: 1, color: quot;whitequot;}]} colors member defines an array of color – stops. Be careful: ● VML renderer doesn't support opacity for – color stops.
  • 20. Fill III Radial gradient definition with defaults: ● {type: quot;radialquot;, cx: 0, cy: 0, r: 100, colors: – [{offset: 0, color: quot;blackquot;}, {offset: 1, color: quot;whitequot;}]} Very similar to the linear gradient. – Be careful: ● VML uses very peculiar (and visually – incompatible) algorithm to render the radial gradient.
  • 21. Fill IV Pattern definition with defaults: ● {type: quot;patternquot;, x: 0, y: 0, width: 0, height: – 0, src: quot;quot;} Similar to the image shape definition. – Be careful: ● Firefox SVG does not implement this fill style – yet.
  • 22. Line Definition with defaults: ● {type: quot;linequot;, x1: 0, y1: 0, x2: 100, y2: 100} – Creator method: ● createLine(line). – This is a redundant shape. ● Can be easily simulated by polyline. – Yet frequently asked for especially by – novices. Obviously it doesn't support setFill(). ●
  • 23. Group I Defines all creators just like Surface. ● Used to group other shapes. ● Can have other groups as children. – Propagates events, and transformations. – Propagation for fill/stroke/font is planned. – No shape definition. ● Creator method: ● createGroup(). –
  • 24. Group II Group-specific API: ● add(shape) – Adds a shape to the group removing it from the ● previous parent. remove(shape) – Removes a shape from the group making it stand- ● alone. clear() – Removes all shapes. ●
  • 25. Circle Definition with defaults: ● {type: quot;circlequot;, cx: 0, cy: 0, r: 100} – Creator method: ● createCircle(circle). – This is a redundant shape. ● Can be easily simulated by ellipse. – Yet frequently asked for especially by – novices.
  • 26. Ellipse Definition with defaults: ● {type: quot;ellipsequot;, cx: 0, cy: 0, rx: 200, ry: 100} – Creator method: ● createEllipse(ellipse). –
  • 27. Polyline Definition with defaults: ● {type: quot;polylinequot;, points: []} – points is an array of points. – Array of numbers is permitted. ● In this case numbers should go in pairs in [x, y] ● order. Doubles for polygon. ● If you want a closed polygon, do it explicitly. – Creator method: ● createPolyline(polyline) –
  • 28. Path I Definition with defaults: ● {type: quot;pathquot;, path: quot;quot;} – path uses the SVG notation. – Path is a super-shape: ● It can emulate all other geometric shapes. – Exceptions: image, text, textpath. – Creator method: ● createPath(path) –
  • 29. Path II Path-specific API: ● getAbsoluteMode/setAbsoluteMode – true for absolute mode, and false for relative ● mode. getLastPosition – Returns a point in absolute coordinates. ● moveTo, lineTo, hLineTo, vLineTo, closePath – curveTo, smoothCurveTo, qCurveTo, – qSmoothCurveTo arcTo –
  • 30. Path III Shortcut: ● If you specify a string, creator assumes it is a – path definition. Be careful: ● VML doesn't support sub-pixel coordinates. –
  • 31. Image I Definition with defaults: ● {type: quot;imagequot;, x: 0, y: 0, width: 0, height: 0, – src: quot;quot;} By specifying different width/height, you can – stretch the image. Obviously setFill/setStroke are not ● supported.
  • 32. Image II Be careful: ● VML has problems displaying PNG files with – opacity. Silverlight doesn't support GIF. –
  • 33. Text I Definition with defaults: ● {type: quot;textquot;, x: 0, y: 0, text: quot;quot;, align: quot;startquot;, – decoration: quot;nonequot;, rotated: false, kerning: true} Alignment: – “start”, “end”, “middle” relative to the anchor ● point. Decoration: – “underline”, “none”. ● Rotated: – If true, rotates each character 90 degrees CCW. ●
  • 34. Text II Text-specific methods: ● getFont/setFont – Assigns a font definition to the shape. – Be careful: ● Kerning is not supported by some renderers. – Safari 3 beta doesn't support rotation. –
  • 35. Font I Definition with defaults: ● {type: quot;fontquot;, style: quot;normalquot;, variant: – quot;normalquot;, weight: quot;normalquot;, size: quot;10ptquot;, family: quot;serifquot;} Styles: – “normal”, “italic”, “oblique”. ● Variants: – “normal”, “small-caps”. ● Weights: – “normal”, “bold”, numeric weight 100-900. ●
  • 36. Font II family is a font name. ● Predefined names: “serif”, “sans-serif”, – “times”, “helvetica”, “monotone”. This fonts are mapped to platform-specific ● equivalents. VML on IE7 ignores family and always uses – Arial. SVG on Firefox ignores family in many cases. – Silverlight supports only predefined fonts. –
  • 37. TextPath Be careful: ● Highly experimental. – Inconsistent support. – API is unfinished. – Definition with defaults: ● {type: quot;textpathquot;, text: quot;quot;, align: quot;startquot;, – decoration: quot;nonequot;, rotated: false, kerning: true } Supports a subset of the text definition. –
  • 38. Matrix I Standard 2D matrix: ● {xx: 1, xy: 0, yx: 0, yy: 1, dx: 0, dy: 0} – You can use duck-typing skipping defaults. – Defined in dojox.gfx.matrix as Matrix2D. – Propagated up to dojo.gfx.Matrix2D. –
  • 39. Matrix II Supports all common operations: ● Predefined constants: – identity, flipX, flipY, flipXY. ● Translation: – translate(x, y) ● Scaling: – scale(sx, sy) ● Rotation: – rotate(rad) — accepts radians. ● rotateg(deg) — accepts degrees. ●
  • 40. Matrix III Supports all common operations: ● Skewing: – skewX(rad) ● skewXg(deg) ● skewY(rad) ● skewYg(deg) ●
  • 41. Matrix IV Supports all common operations: ● General transformations: – invert(matrix) ● reflect(a, b) — forms a reflection matrix. ● project(a, b) — forms an orthogonal projection ● matrix. normalize(matrix) — produces Matrix2D, if ● necessary. clone(matrix) — creates a copy. ● multiply(m1, m2, ...) ● multiplyPoint(matrix, x, y) ●
  • 42. Matrix V Provides “at” versions for some ● transformations. “At” implements the “transform at the point” – operation: xxxAt(arg, x, y) is equivalent to: ● translate(x, y) * xxx(arg) * translate(-x, -y) ● Provided methods: – scaleAt, rotateAt, rotategAt, skewXAt, skewXgAt, ● skewYAt, skewYgAt.
  • 43. Matrix VI Shortcuts: ● Array of matrices is normalized by – multiplying its elements sequentially left to right. By default all incoming matrices are – normalized in GFX.
  • 44. Questions ? ? ? ? ? ? ? ? ? ? ? ?