new folders for Graphics
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a95bd7a0 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a95bd7a0 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a95bd7a0 Branch: refs/heads/develop Commit: a95bd7a0b2b4cdbe6469331df7bd5c2f1ddaeb62 Parents: ae593ef Author: Alex Harui <[email protected]> Authored: Tue Feb 2 21:16:51 2016 -0800 Committer: Alex Harui <[email protected]> Committed: Wed Feb 3 10:01:52 2016 -0800 ---------------------------------------------------------------------- .../projects/Graphics/as/src/GraphicsClasses.as | 44 - .../src/org/apache/flex/core/graphics/Circle.as | 98 - .../org/apache/flex/core/graphics/Ellipse.as | 91 - .../apache/flex/core/graphics/GradientBase.as | 229 --- .../apache/flex/core/graphics/GradientEntry.as | 133 -- .../apache/flex/core/graphics/GraphicShape.as | 213 --- .../flex/core/graphics/GraphicsContainer.as | 302 --- .../src/org/apache/flex/core/graphics/IFill.as | 32 - .../org/apache/flex/core/graphics/IStroke.as | 29 - .../apache/flex/core/graphics/LinearGradient.as | 123 -- .../src/org/apache/flex/core/graphics/Path.as | 103 -- .../src/org/apache/flex/core/graphics/Rect.as | 87 - .../org/apache/flex/core/graphics/SolidColor.as | 112 -- .../flex/core/graphics/SolidColorStroke.as | 130 -- .../src/org/apache/flex/core/graphics/Text.as | 140 -- .../graphics/utils/AdvancedLayoutFeatures.as | 1140 ------------ .../core/graphics/utils/CompoundTransform.as | 777 -------- .../core/graphics/utils/IAssetLayoutFeatures.as | 371 ---- .../flex/core/graphics/utils/MatrixUtil.as | 1605 ---------------- .../flex/core/graphics/utils/PathHelper.as | 1712 ------------------ .../core/graphics/utils/TransformOffsets.as | 367 ---- frameworks/projects/Graphics/basic-manifest.xml | 34 - .../projects/Graphics/compile-asjs-config.xml | 82 - frameworks/projects/Graphics/compile-config.xml | 78 - .../Graphics/src/main/flex/GraphicsClasses.as | 44 + .../org/apache/flex/core/graphics/Circle.as | 98 + .../org/apache/flex/core/graphics/Ellipse.as | 91 + .../apache/flex/core/graphics/GradientBase.as | 229 +++ .../apache/flex/core/graphics/GradientEntry.as | 133 ++ .../apache/flex/core/graphics/GraphicShape.as | 213 +++ .../flex/core/graphics/GraphicsContainer.as | 302 +++ .../flex/org/apache/flex/core/graphics/IFill.as | 32 + .../org/apache/flex/core/graphics/IStroke.as | 29 + .../apache/flex/core/graphics/LinearGradient.as | 123 ++ .../flex/org/apache/flex/core/graphics/Path.as | 103 ++ .../flex/org/apache/flex/core/graphics/Rect.as | 87 + .../org/apache/flex/core/graphics/SolidColor.as | 112 ++ .../flex/core/graphics/SolidColorStroke.as | 130 ++ .../flex/org/apache/flex/core/graphics/Text.as | 140 ++ .../graphics/utils/AdvancedLayoutFeatures.as | 1140 ++++++++++++ .../core/graphics/utils/CompoundTransform.as | 777 ++++++++ .../core/graphics/utils/IAssetLayoutFeatures.as | 371 ++++ .../flex/core/graphics/utils/MatrixUtil.as | 1605 ++++++++++++++++ .../flex/core/graphics/utils/PathHelper.as | 1712 ++++++++++++++++++ .../core/graphics/utils/TransformOffsets.as | 367 ++++ .../src/main/resources/basic-manifest.xml | 34 + .../src/main/resources/compile-asjs-config.xml | 82 + .../src/main/resources/compile-config.xml | 78 + 48 files changed, 8032 insertions(+), 8032 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/GraphicsClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/GraphicsClasses.as b/frameworks/projects/Graphics/as/src/GraphicsClasses.as deleted file mode 100644 index c463f04..0000000 --- a/frameworks/projects/Graphics/as/src/GraphicsClasses.as +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package -{ - -/** - * @private - * This class is used to link additional classes into rpc.swc - * beyond those that are found by dependecy analysis starting - * from the classes specified in manifest.xml. - */ -internal class GraphicsClasses -{ - - import org.apache.flex.core.graphics.GraphicShape; GraphicShape; - import org.apache.flex.core.graphics.Rect; Rect; - import org.apache.flex.core.graphics.Ellipse; Ellipse; - import org.apache.flex.core.graphics.Circle; Circle; - import org.apache.flex.core.graphics.Path; Path; - import org.apache.flex.core.graphics.SolidColor; SolidColor; - import org.apache.flex.core.graphics.SolidColorStroke; SolidColorStroke; - import org.apache.flex.core.graphics.Text; Text; - import org.apache.flex.core.graphics.GraphicsContainer; GraphicsContainer; - import org.apache.flex.core.graphics.LinearGradient; LinearGradient; -} - -} - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as deleted file mode 100644 index 8868bec..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.geom.Point; - import flash.geom.Rectangle; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - public class Circle extends GraphicShape - { - private var _radius:Number; - - public function get radius():Number - { - return _radius; - } - - public function set radius(value:Number):void - { - _radius = value; - } - - /** - * Draw the circle. - * @param x The x location of the center of the circle - * @param y The y location of the center of the circle. - * @param radius The radius of the circle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion SVGCircleElement - */ - public function drawCircle(x:Number, y:Number, radius:Number):void - { - COMPILE::AS3 - { - graphics.clear(); - applyStroke(); - beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius)); - graphics.drawCircle(x,y,radius); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement; - circle.flexjs_wrapper = this; - circle.setAttribute('style', style); - if (stroke) - { - circle.setAttribute('cx', String(radius + stroke.weight)); - circle.setAttribute('cy', String(radius + stroke.weight)); - setPosition(x - radius, y - radius, stroke.weight, stroke.weight); - } - else - { - circle.setAttribute('cx', String(radius)); - circle.setAttribute('cy', String(radius)); - setPosition(x - radius, y - radius, 0, 0); - } - - circle.setAttribute('rx', String(radius)); - circle.setAttribute('ry', String(radius)); - element.appendChild(circle); - - resize(x, y, (circle as SVGCircleElement).getBBox()); - - } - } - - override public function addedToParent():void - { - drawCircle(0, 0, radius); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as deleted file mode 100644 index f22161f..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as +++ /dev/null @@ -1,91 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.geom.Point; - import flash.geom.Rectangle; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - public class Ellipse extends GraphicShape - { - - /** - * Draw the ellipse. - * @param x The x position of the top-left corner of the bounding box of the ellipse. - * @param y The y position of the top-left corner of the bounding box of the ellipse. - * @param width The width of the ellipse. - * @param height The height of the ellipse. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion SVGEllipseElement - */ - public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void - { - COMPILE::AS3 - { - graphics.clear(); - applyStroke(); - beginFill(new Rectangle(x, y, width, height), new Point(x,y)); - graphics.drawEllipse(x,y,width,height); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement; - ellipse.flexjs_wrapper = this; - ellipse.setAttribute('style', style); - if (stroke) - { - ellipse.setAttribute('cx', String(width / 2 + stroke.weight)); - ellipse.setAttribute('cy', String(height / 2 + stroke.weight)); - setPosition(x, y, stroke.weight * 2, stroke.weight * 2); - } - else - { - ellipse.setAttribute('cx', String(width / 2)); - ellipse.setAttribute('cy', String(height / 2)); - setPosition(x, y, 0, 0); - } - ellipse.setAttribute('rx', String(width / 2)); - ellipse.setAttribute('ry', String(height / 2)); - element.appendChild(ellipse); - - resize(x, y, (ellipse as SVGEllipseElement).getBBox()); - - } - } - - override protected function draw():void - { - drawEllipse(0, 0, width, height); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as deleted file mode 100644 index 58d417a..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - import org.apache.flex.core.graphics.utils.CompoundTransform; - - public class GradientBase - { - - protected var colors:Array /* of uint */ = []; - - protected var ratios:Array /* of Number */ = []; - - protected var alphas:Array /* of Number */ = []; - - /** - * Holds the matrix and the convenience transform properties (<code>x</code>, <code>y</code>, and <code>rotation</code>). - * The compoundTransform is only created when the <code>matrix</code> property is set. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - */ - COMPILE::AS3 - protected var compoundTransform:CompoundTransform; - - /** - * Value of the width and height of the untransformed gradient - * - * @langversion 3.0 - * @playerversion Flash 10 - * @playerversion AIR 1.5 - */ - public static const GRADIENT_DIMENSION:Number = 1638.4; - - /** - * generate uid - */ - public function get newId():String - { - return 'gradient' + String(Math.floor((Math.random() * 100000) + 1)); - } - - /** - * Storage for the entries property. - */ - private var _entries:Array = []; - - /** - * @private - * Storage for the rotation property. - */ - private var _rotation:Number = 0.0; - - /** - * An Array of GradientEntry objects - * defining the fill patterns for the gradient fill. - * - */ - public function get entries():Array - { - return _entries; - } - - /** - * @private - */ - public function set entries(value:Array):void - { - _entries = value; - COMPILE::AS3 - { - processEntries(); - } - } - - /** - * By default, the LinearGradientStroke defines a transition - * from left to right across the control. - * Use the <code>rotation</code> property to control the transition direction. - * For example, a value of 180.0 causes the transition - * to occur from right to left, rather than from left to right. - * - * @default 0.0 - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function get rotation():Number - { - return _rotation; - } - - /** - * @private - */ - public function set rotation(value:Number):void - { - _rotation = value; - } - - - private var _x:Number = 0; - - /** - * The distance by which to translate each point along the x axis. - */ - public function get x():Number - { - return _x; - } - - /** - * @private - */ - public function set x(value:Number):void - { - _x = value; - } - - private var _y:Number = 0; - - /** - * The distance by which to translate each point along the y axis. - */ - public function get y():Number - { - return _y; - } - - /** - * @private - */ - public function set y(value:Number):void - { - _y = value; - } - - COMPILE::AS3 - protected function toRad(a:Number):Number { - return a*Math.PI/180; - } - - COMPILE::AS3 - protected function get rotationInRadians():Number - { - return rotation / 180 * Math.PI; - } - - /** - * @private - * Extract the gradient information in the public <code>entries</code> - * Array into the internal <code>colors</code>, <code>ratios</code>, - * and <code>alphas</code> arrays. - */ - COMPILE::AS3 - private function processEntries():void - { - colors = []; - ratios = []; - alphas = []; - - if (!_entries || _entries.length == 0) - return; - - var ratioConvert:Number = 255; - - var i:int; - - var n:int = _entries.length; - for (i = 0; i < n; i++) - { - var e:GradientEntry = _entries[i]; - colors.push(e.color); - alphas.push(e.alpha); - ratios.push(e.ratio * ratioConvert); - } - - if (isNaN(ratios[0])) - ratios[0] = 0; - - if (isNaN(ratios[n - 1])) - ratios[n - 1] = 255; - - i = 1; - - while (true) - { - while (i < n && !isNaN(ratios[i])) - { - i++; - } - - if (i == n) - break; - - var start:int = i - 1; - - while (i < n && isNaN(ratios[i])) - { - i++; - } - - var br:Number = ratios[start]; - var tr:Number = ratios[i]; - - for (var j:int = 1; j < i - start; j++) - { - ratios[j] = br + j * (tr - br) / (i - start); - } - } - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as deleted file mode 100644 index cbcdb3f..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - public class GradientEntry - { - - //---------------------------------- - // alpha - //---------------------------------- - - private var _alpha:Number = 1.0; - //---------------------------------- - // color - //---------------------------------- - - private var _color:uint = 0x000000; - //---------------------------------- - // ratio - //---------------------------------- - - private var _ratio:Number = 0x000000; - - - public function GradientEntry(alpha:Number = 1.0, color:uint = 0x000000, ratio:Number = 1.0) - { - _alpha = alpha; - _color = color; - _ratio = ratio; - } - - /** - * The transparency of a color. - * Possible values are 0.0 (invisible) through 1.0 (opaque). - * - * @default 1.0 - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.3 - */ - public function get alpha():Number - { - return _alpha; - } - - public function set alpha(value:Number):void - { - var oldValue:Number = _alpha; - if (value != oldValue) - { - _alpha = value; - } - } - - /** - * A color value. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.3 - */ - public function get color():uint - { - return _color; - } - - public function set color(value:uint):void - { - var oldValue:uint = _color; - if (value != oldValue) - { - _color = value; - } - } - - /** - * Where in the graphical element, as a percentage from 0.0 to 1.0, - * Flex samples the associated color at 100%. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.3 - */ - public function get ratio():Number - { - return _ratio; - } - - public function set ratio(value:Number):void - { - _ratio = value; - } - - /** - * Begin drawing the fill on the given shape's graphic object - */ - public function begin(s:GraphicShape):void - { - COMPILE::AS3 - { - s.graphics.beginFill(color,alpha); - } - } - - /** - * End the fill - */ - public function end(s:GraphicShape):void - { - COMPILE::AS3 - { - s.graphics.endFill(); - } - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as deleted file mode 100644 index 7e0391e..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.geom.Point; - import flash.geom.Rectangle; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - import org.apache.flex.core.UIBase; - - public class GraphicShape extends UIBase - { - private var _fill:IFill; - private var _stroke:IStroke; - - public function get stroke():IStroke - { - return _stroke; - } - - /** - * A solid color fill. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.0 - */ - public function set stroke(value:IStroke):void - { - _stroke = value; - } - - public function get fill():IFill - { - return _fill; - } - /** - * A solid color fill. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.0 - */ - public function set fill(value:IFill):void - { - _fill = value; - } - - /** - * Constructor - * - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function GraphicShape() - { - COMPILE::JS - { - element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement; - element.flexjs_wrapper = this; - element.style.left = 0; - element.style.top = 0; - //element.offsetParent = null; - positioner = element; - positioner.style.position = 'relative'; - } - } - - COMPILE::AS3 - protected function applyStroke():void - { - if(stroke) - { - stroke.apply(this); - } - } - - COMPILE::AS3 - protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void - { - if(fill) - { - fill.begin(this, targetBounds,targetOrigin); - } - } - - COMPILE::AS3 - protected function endFill():void - { - if(fill) - { - fill.end(this); - } - } - - /** - * This is where the drawing methods get called from - */ - protected function draw():void - { - //Overwrite in subclass - } - - override public function addedToParent():void - { - COMPILE::AS3 - { - super.addedToParent(); - } - draw(); - COMPILE::JS - { - element.style.overflow = 'visible'; - } - } - - /** - * @return {string} The style attribute. - */ - COMPILE::JS - public function getStyleStr():String - { - var fillStr:String; - if (fill) - { - fillStr = fill.addFillAttrib(this); - } - else - { - fillStr = 'fill:none'; - } - - var strokeStr:String; - if (stroke) - { - strokeStr = stroke.addStrokeAttrib(this); - } - else - { - strokeStr = 'stroke:none'; - } - - - return fillStr + ';' + strokeStr; - } - - - /** - * @param x X position. - * @param y Y position. - * @param bbox The bounding box of the svg element. - */ - COMPILE::JS - public function resize(x:Number, y:Number, bbox:SVGRect):void - { - var useWidth:Number = Math.max(this.width, bbox.width); - var useHeight:Number = Math.max(this.height, bbox.height); - - element.style.position = 'absolute'; - if (!isNaN(x)) element.style.top = String(x) + 'px'; - if (!isNaN(y)) element.style.left = String(y) + 'px'; - element.style.width = String(useWidth) + 'px'; - element.style.height = String(useHeight) + 'px'; - element.style.left = x; - element.style.top = y; - } - - COMPILE::JS - private var _x:Number; - COMPILE::JS - private var _y:Number; - COMPILE::JS - private var _xOffset:Number; - COMPILE::JS - private var _yOffset:Number; - - /** - * @param x X position. - * @param y Y position. - * @param xOffset offset from x position. - * @param yOffset offset from y position. - */ - COMPILE::JS - public function setPosition(x:Number, y:Number, xOffset:Number, yOffset:Number):void - { - _x = x; - _y = y; - _xOffset = xOffset; - _yOffset = yOffset; - element.style.left = xOffset; - element.style.top = yOffset; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as deleted file mode 100644 index 4927eb9..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.display.GraphicsPath; - import flash.display.Shape; - import flash.display.Sprite; - import flash.geom.Point; - import flash.geom.Rectangle; - import flash.text.TextFieldType; - - import org.apache.flex.core.CSSTextField; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - import org.apache.flex.core.graphics.utils.PathHelper; - - /** - * GraphicsContainer is a surface on which you can - * draw various graphic elements such as Rect, Circle, - * Ellipse, Path etc. - * Use this class if you want to draw multiple graphic - * shapes on a single container. - * - */ - public class GraphicsContainer extends GraphicShape - { - /** - * Removes all of the drawn elements of the container. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0.3 - */ - public function removeAllElements():void - { - COMPILE::AS3 - { - graphics.clear(); - } - COMPILE::JS - { - var svg:HTMLElement = element; - while (svg.lastChild) { - svg.removeChild(svg.lastChild); - } - } - } - - /** - * Draw the rectangle. - * @param x The x position of the top-left corner of the rectangle. - * @param y The y position of the top-left corner. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0.3 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawRect(x:Number, y:Number, width:Number, height:Number):void - { - COMPILE::AS3 - { - applyStroke(); - beginFill(new Rectangle(x, y, width, height), new Point(x,y) ); - graphics.drawRect(x, y, width, height); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement; - rect.flexjs_wrapper = this; - rect.style.left = x; - rect.style.top = y; - rect.setAttribute('style', style); - rect.setAttribute('x', String(x) + 'px'); - rect.setAttribute('y', String(y) + 'px'); - rect.setAttribute('width', String(width) + 'px'); - rect.setAttribute('height', String(height) + 'px'); - element.appendChild(rect); - } - } - - COMPILE::AS3 - public function createRect(x:Number, y:Number, width:Number, height:Number):void - { - var color:uint = (fill as SolidColor).color; - var alpha:uint = (fill as SolidColor).alpha; - - var shape:Sprite = new Sprite(); - shape.graphics.beginFill(color,alpha); - shape.graphics.drawRect(0, 0, width, height); - shape.graphics.endFill(); - shape.x = x; - shape.y = y; - addChild(shape); - } - - /** - * Draw the ellipse. - * @param x The x position of the top-left corner of the bounding box of the ellipse. - * @param y The y position of the top-left corner of the bounding box of the ellipse. - * @param width The width of the ellipse. - * @param height The height of the ellipse. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0.3 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void - { - COMPILE::AS3 - { - applyStroke(); - beginFill(new Rectangle(x,y,width,height), new Point(x,y)); - graphics.drawEllipse(x,y,width,height); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement; - ellipse.flexjs_wrapper = this; - ellipse.style.left = x; - ellipse.style.top = y; - ellipse.setAttribute('style', style); - ellipse.setAttribute('cx', String(x + width / 2)); - ellipse.setAttribute('cy', String(y + height / 2)); - ellipse.setAttribute('rx', String(width / 2)); - ellipse.setAttribute('ry', String(height / 2)); - element.appendChild(ellipse); - } - } - - /** - * Draw the circle. - * @param x The x location of the center of the circle - * @param y The y location of the center of the circle. - * @param radius The radius of the circle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawCircle(x:Number, y:Number, radius:Number):void - { - COMPILE::AS3 - { - applyStroke(); - beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius)); - graphics.drawCircle(x,y,radius); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement; - circle.flexjs_wrapper = this; - circle.style.left = x; - circle.style.top = y; - circle.setAttribute('style', style); - circle.setAttribute('cx', String(x)); - circle.setAttribute('cy', String(y)); - circle.setAttribute('rx', String(radius)); - circle.setAttribute('ry', String(radius)); - element.appendChild(circle); - - } - } - - /** - * Draw the path. - * @param data A string containing a compact represention of the path segments. - * The value is a space-delimited string describing each path segment. Each - * segment entry has a single character which denotes the segment type and - * two or more segment parameters. - * - * If the segment command is upper-case, the parameters are absolute values. - * If the segment command is lower-case, the parameters are relative values. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawPath(data:String):void - { - COMPILE::AS3 - { - applyStroke(); - var bounds:Rectangle = PathHelper.getBounds(data); - beginFill(bounds,bounds.topLeft); - var graphicsPath:GraphicsPath = PathHelper.getSegments(data); - graphics.drawPath(graphicsPath.commands, graphicsPath.data); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement; - path.flexjs_wrapper = this; - path.style.left = 0; - path.style.top = 0; - path.setAttribute('style', style); - path.setAttribute('d', data); - element.appendChild(path); - } - } - - public function drawLine():void - { - - } - - public function drawPolygon():void - { - - } - - /** - * Draw a string of characters. - * @param value The string to draw. - * @param x The x location of the center of the circle - * @param y The y location of the center of the circle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion Text - * @flexjsignorecoercion Node - */ - public function drawText(value:String, x:Number, y:Number):Object - { - COMPILE::AS3 - { - var textField:CSSTextField = new CSSTextField(); - addChild(textField); - - textField.selectable = false; - textField.type = TextFieldType.DYNAMIC; - textField.mouseEnabled = false; - textField.autoSize = "left"; - textField.text = value; - - var lineColor:SolidColorStroke = stroke as SolidColorStroke; - if (lineColor) { - textField.textColor = lineColor.color; - textField.alpha = lineColor.alpha; - } - - textField.x = x; - textField.y = y + textField.textHeight/4; - - return textField; - - } - COMPILE::JS - { - var style:String = getStyleStr(); - var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement; - text.flexjs_wrapper = this; - text.style.left = x; - text.style.top = y; - text.setAttribute('style', style); - text.setAttribute('x', String(x) + 'px'); - text.setAttribute('y', String(y + 15) + 'px'); - var textNode:Text = document.createTextNode(value) as Text; - text.appendChild(textNode as Node); - element.appendChild(text); - return text; - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as deleted file mode 100644 index f0101ab..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.geom.Point; - import flash.geom.Rectangle; - } - - public interface IFill - { - COMPILE::AS3 - function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void; - COMPILE::AS3 - function end(s:GraphicShape):void; - COMPILE::JS - function addFillAttrib(s:GraphicShape):String; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as deleted file mode 100644 index be3f022..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - public interface IStroke - { - COMPILE::AS3 - function apply(s:GraphicShape):void; - - COMPILE::JS - function get weight():Number; - - COMPILE::JS - function addStrokeAttrib(s:GraphicShape):String; - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as deleted file mode 100644 index c36a37b..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.display.GradientType; - import flash.display.InterpolationMethod; - import flash.display.SpreadMethod; - import flash.geom.Matrix; - import flash.geom.Point; - import flash.geom.Rectangle; - } - - public class LinearGradient extends GradientBase implements IFill - { - COMPILE::AS3 - private static var commonMatrix:Matrix = new Matrix(); - - private var _scaleX:Number; - - /** - * The horizontal scale of the gradient transform, which defines the width of the (unrotated) gradient - */ - public function get scaleX():Number - { - return _scaleX; - } - - public function set scaleX(value:Number):void - { - _scaleX = value; - } - - COMPILE::AS3 - public function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void - { - commonMatrix.identity(); - commonMatrix.createGradientBox(targetBounds.width,targetBounds.height,toRad(this.rotation),targetOrigin.x, targetOrigin.y); - - s.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, - commonMatrix, SpreadMethod.PAD, InterpolationMethod.RGB); - - } - - COMPILE::AS3 - public function end(s:GraphicShape):void - { - s.graphics.endFill(); - } - - /** - * addFillAttrib() - * - * @param value The GraphicShape object on which the fill must be added. - * @return {string} - * @flexjsignorecoercion Node - */ - COMPILE::JS - public function addFillAttrib(value:GraphicShape):String - { - //Create and add a linear gradient def - var svgNS:String = value.element.namespaceURI; - var grad:HTMLElement = document.createElementNS(svgNS, 'linearGradient') as HTMLElement; - var gradientId:String = this.newId; - grad.setAttribute('id', gradientId); - - //Set x1, y1, x2, y2 of gradient - grad.setAttribute('x1', '0%'); - grad.setAttribute('y1', '0%'); - grad.setAttribute('x2', '100%'); - grad.setAttribute('y2', '0%'); - - //Apply rotation to the gradient if rotation is a number - if (rotation) - { - grad.setAttribute('gradientTransform', 'rotate(' + rotation + ' 0.5 0.5)'); - } - - //Process gradient entries and create a stop for each entry - var entries:Array = this.entries; - for (var i:int = 0; i < entries.length; i++) - { - var gradientEntry:GradientEntry = entries[i]; - var stop:HTMLElement = document.createElementNS(svgNS, 'stop') as HTMLElement; - //Set Offset - stop.setAttribute('offset', String(gradientEntry.ratio * 100) + '%'); - //Set Color - var color:String = Number(gradientEntry.color).toString(16); - if (color.length == 1) color = '00' + color; - if (color.length == 2) color = '00' + color; - if (color.length == 4) color = '00' + color; - stop.setAttribute('stop-color', '#' + String(color)); - //Set Alpha - stop.setAttribute('stop-opacity', String(gradientEntry.alpha)); - - grad.appendChild(stop); - } - - //Add defs element if not available already - //Add newly created gradient to defs element - var defs:Node = value.element.querySelector('defs') || - value.element.insertBefore(document.createElementNS(svgNS, 'defs'), value.element.firstChild); - defs.appendChild(grad); - - //Return the fill attribute - return 'fill:url(#' + gradientId + ')'; - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as deleted file mode 100644 index 2d69364..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.display.GraphicsPath; - import flash.geom.Point; - import flash.geom.Rectangle; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - import org.apache.flex.core.graphics.utils.PathHelper; - - public class Path extends GraphicShape - { - - private var _data:String; - - public function get data():String - { - return _data; - } - - public function set data(value:String):void - { - _data = value; - } - - /** - * Draw the path. - * @param data A string containing a compact represention of the path segments. - * The value is a space-delimited string describing each path segment. Each - * segment entry has a single character which denotes the segment type and - * two or more segment parameters. - * - * If the segment command is upper-case, the parameters are absolute values. - * If the segment command is lower-case, the parameters are relative values. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawPath(x:Number,y:Number,data:String):void - { - COMPILE::AS3 - { - graphics.clear(); - applyStroke(); - var bounds:Rectangle = PathHelper.getBounds(data); - this.width = bounds.width; - this.height = bounds.height; - beginFill(bounds,new Point(bounds.left + x, bounds.top + y) ); - var graphicsPath:GraphicsPath = PathHelper.getSegments(data,x,y); - graphics.drawPath(graphicsPath.commands, graphicsPath.data); - endFill(); - } - COMPILE::JS - { - if (data == null || data.length === 0) return; - var style:String = getStyleStr(); - var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement; - path.flexjs_wrapper = this; - path.setAttribute('style', style); - path.setAttribute('d', data); - element.appendChild(path); - if (stroke) - { - setPosition(x, y, stroke.weight, stroke.weight); - } - else - { - setPosition(x, y, 0, 0); - } - - resize(x, y, path['getBBox']()); - - } - } - - override protected function draw():void - { - drawPath(0, 0, data); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as deleted file mode 100644 index fd1daa8..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.display.CapsStyle; - import flash.display.JointStyle; - import flash.geom.Point; - import flash.geom.Rectangle; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - public class Rect extends GraphicShape - { - - /** - * Draw the rectangle. - * @param x The x position of the top-left corner of the rectangle. - * @param y The y position of the top-left corner. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawRect(x:Number, y:Number, width:Number, height:Number):void - { - COMPILE::AS3 - { - graphics.clear(); - applyStroke(); - beginFill(new Rectangle(x, y, width, height), new Point(x,y)); - graphics.drawRect(x, y, width, height); - endFill(); - } - COMPILE::JS - { - var style:String = this.getStyleStr(); - var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement; - rect.flexjs_wrapper = this; - rect.setAttribute('style', style); - if (stroke) - { - rect.setAttribute('x', String(stroke.weight / 2) + 'px'); - rect.setAttribute('y', String(stroke.weight / 2) + 'px'); - setPosition(x, y, stroke.weight, stroke.weight); - } - else - { - rect.setAttribute('x', '0' + 'px'); - rect.setAttribute('y', '0' + 'px'); - setPosition(x, y, 0, 0); - } - rect.setAttribute('width', String(width) + 'px'); - rect.setAttribute('height', String(height) + 'px'); - element.appendChild(rect); - - resize(x, y, rect['getBBox']()); - } - } - - override protected function draw():void - { - drawRect(0,0,width,height); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as deleted file mode 100644 index 73e99b0..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.geom.Point; - import flash.geom.Rectangle; - } - - public class SolidColor implements IFill - { - - //---------------------------------- - // alpha - //---------------------------------- - - private var _alpha:Number = 1.0; - //---------------------------------- - // color - //---------------------------------- - - private var _color:uint = 0x000000; - - /** - * The transparency of a color. - * Possible values are 0.0 (invisible) through 1.0 (opaque). - * - * @default 1.0 - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.3 - */ - public function get alpha():Number - { - return _alpha; - } - - public function set alpha(value:Number):void - { - var oldValue:Number = _alpha; - if (value != oldValue) - { - _alpha = value; - } - } - - /** - * A color value. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.3 - */ - public function get color():uint - { - return _color; - } - - public function set color(value:uint):void - { - var oldValue:uint = _color; - if (value != oldValue) - { - _color = value; - } - } - - COMPILE::AS3 - public function begin(s:GraphicShape,targetBounds:Rectangle,targetOrigin:Point):void - { - s.graphics.beginFill(color,alpha); - } - - COMPILE::AS3 - public function end(s:GraphicShape):void - { - s.graphics.endFill(); - } - - /** - * addFillAttrib() - * - * @param value The GraphicShape object on which the fill must be added. - * @return {string} - */ - COMPILE::JS - public function addFillAttrib(value:GraphicShape):String - { - var color:String = Number(this.color).toString(16); - if (color.length == 1) color = '00' + color; - if (color.length == 2) color = '00' + color; - if (color.length == 4) color = '00' + color; - return 'fill:#' + String(color) + ';fill-opacity:' + String(alpha); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as deleted file mode 100644 index 9535cdc..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.display.CapsStyle; - import flash.display.JointStyle; - } - - public class SolidColorStroke implements IStroke - { - - //---------------------------------- - // alpha - //---------------------------------- - private var _alpha:Number = 1.0; - - //---------------------------------- - // color - //---------------------------------- - private var _color:uint = 0x000000; - - //---------------------------------- - // weight - //---------------------------------- - private var _weight:Number = 1; - - /** - * The transparency of a color. - * Possible values are 0.0 (invisible) through 1.0 (opaque). - * - * @default 1.0 - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.3 - */ - public function get alpha():Number - { - return _alpha; - } - - public function set alpha(value:Number):void - { - var oldValue:Number = _alpha; - if (value != oldValue) - { - _alpha = value; - } - } - - /** - * A color value. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.3 - */ - public function get color():uint - { - return _color; - } - - public function set color(value:uint):void - { - var oldValue:uint = _color; - if (value != oldValue) - { - _color = value; - } - } - - public function get weight():Number - { - return _weight; - } - - /** - * A color value. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion FlexJS 0.3 - */ - public function set weight(value:Number):void - { - _weight = value; - } - - COMPILE::AS3 - public function apply(s:GraphicShape):void - { - s.graphics.lineStyle(weight,color,alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER); - } - - /** - * addStrokeAttrib() - * - * @param value The GraphicShape object on which the stroke must be added. - * @return {string} - */ - COMPILE::JS - public function addStrokeAttrib(value:GraphicShape):String - { - var strokeColor:String = Number(color).toString(16); - if (strokeColor.length == 1) strokeColor = '00' + strokeColor; - if (strokeColor.length == 2) strokeColor = '00' + strokeColor; - if (strokeColor.length == 4) strokeColor = '00' + strokeColor; - return 'stroke:#' + String(strokeColor) + ';stroke-width:' + - String(weight) + ';stroke-opacity:' + String(alpha); - }; - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a95bd7a0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as deleted file mode 100644 index 24dd840..0000000 --- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as +++ /dev/null @@ -1,140 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.core.graphics -{ - COMPILE::AS3 - { - import flash.text.TextFieldType; - import org.apache.flex.core.CSSTextField; - } - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - /** - * Draws a string of characters at a specific location using the stroke - * value of color and alpha. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * // TODO (aharui) ignore imports of external linkage interfaces? - * @flexjsignoreimport SVGLocatable - */ - public class Text extends GraphicShape - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function Text() - { - super(); - - COMPILE::AS3 - { - _textField = new CSSTextField(); - addChild(_textField); - } - } - - - COMPILE::AS3 - private var _textField:CSSTextField; - - /** - * @copy org.apache.flex.core.ITextModel#textField - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::AS3 - public function get textField() : CSSTextField - { - return _textField; - } - - /** - * Draws text at the given point. - * @param value The string to draw. - * @param x The x position of the top-left corner of the rectangle. - * @param y The y position of the top-left corner. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion Text - * @flexjsignorecoercion Node - * @flexjsignorecoercion SVGLocatable - */ - public function drawText(value:String, x:Number, y:Number):void - { - COMPILE::AS3 - { - textField.selectable = false; - textField.type = TextFieldType.DYNAMIC; - textField.mouseEnabled = false; - textField.autoSize = "left"; - textField.text = value; - - var color:SolidColorStroke = stroke as SolidColorStroke; - if (color) { - textField.textColor = color.color; - textField.alpha = color.alpha; - } - - textField.x = x; - textField.y = y; - } - COMPILE::JS - { - var style:String = this.getStyleStr(); - var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement; - text.flexjs_wrapper = this; - text.setAttribute('style', style); - text.setAttribute('x', String(x) + 'px'); - text.setAttribute('y', String(y) + 'px'); - setPosition(x, y, 0, 0); - var textNode:Text = document.createTextNode(value) as Text; - text.appendChild(textNode as Node); - element.appendChild(text); - - resize(x, y, (text as SVGLocatable).getBBox()); - - } - } - - COMPILE::JS - override protected function draw():void - { - - } - - } -} \ No newline at end of file
