////////////////////////////////////////////////////////////////////////////////
//
// 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 mx.graphics
{
import flash.display.CapsStyle;
import flash.display.Graphics;
import flash.display.GraphicsGradientFill;
import flash.display.GraphicsStroke;
import flash.display.JointStyle;
import flash.geom.Point;
import flash.geom.Rectangle;
import mx.core.mx_internal;
use namespace mx_internal;
/**
* The GradientStroke class lets you specify a gradient filled stroke.
* You use the GradientStroke class, along with the GradientEntry class,
* to define a gradient stroke.
*
* @see mx.graphics.Stroke
* @see mx.graphics.GradientEntry
* @see flash.display.Graphics
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class GradientStroke extends GradientBase implements IStroke
{
/**
* Constructor.
*
* @param weight Specifies the line weight, in pixels.
* This parameter is optional,
* with a default value of 1
.
*
* @param pixelHinting A Boolean value that specifies
* whether to hint strokes to full pixels.
* This affects both the position of anchors of a curve
* and the line stroke size itself.
* With pixelHinting
set to true
,
* Flash Player and AIR hint line widths to full pixel widths.
* With pixelHinting
set to false
,
* disjoints can appear for curves and straight lines.
* This parameter is optional,
* with a default value of false
.
*
* @param scaleMode A value from the LineScaleMode class
* that specifies which scale mode to use.
* Valid values are LineScaleMode.HORIZONTAL
,
* LineScaleMode.NONE
, LineScaleMode.NORMAL
,
* and LineScaleMode.VERTICAL
.
* This parameter is optional,
* with a default value of LineScaleMode.NORMAL
.
*
* @param caps A value from the CapsStyle class
* that specifies the type of caps at the end of lines.
* Valid values are CapsStyle.NONE
,
* CapsStyle.ROUND
, and CapsStyle.SQUARE
.
* A null
value is equivalent to
* CapsStyle.ROUND
.
* This parameter is optional,
* with a default value of CapsStyle.ROUND
.
*
* @param joints A value from the JointStyle class
* that specifies the type of joint appearance used at angles.
* Valid values are JointStyle.BEVEL
,
* JointStyle.MITER
, and JointStyle.ROUND
.
* A null
value is equivalent to
* JointStyle.ROUND
.
* This parameter is optional,
* with a default value of JointStyle.ROUND
.
*
* @param miterLimit A number that indicates the limit
* at which a miter is cut off.
* Valid values range from 1 to 255
* (and values outside of that range are rounded to 1 or 255).
* This value is only used if the jointStyle
property
* is set to miter
.
* The miterLimit
value represents the length that a miter
* can extend beyond the point at which the lines meet to form a joint.
* The value expresses a factor of the line thickness
.
* For example, with a miterLimit
factor of 2.5 and a
* thickness
of 10 pixels, the miter is cut off at 25 pixels.
* This parameter is optional,
* with a default value of 3
.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function GradientStroke(weight:Number = 1,
pixelHinting:Boolean = false,
scaleMode:String = "normal",
caps:String = "round",
joints:String = "round",
miterLimit:Number = 3)
{
super();
this.weight = weight;
this.pixelHinting = pixelHinting;
this.scaleMode = scaleMode;
this.caps = caps;
this.joints = joints;
this.miterLimit = miterLimit;
}
//----------------------------------
// caps
//----------------------------------
/**
* @private
* Storage for the caps property.
*/
private var _caps:String = CapsStyle.ROUND;
[Bindable("propertyChange")]
[Inspectable(category="General", enumeration="round,square,none", defaultValue="round")]
/**
* Specifies the appearance of the ends of lines.
*
*
Valid values are CapsStyle.NONE
,
* CapsStyle.ROUND
, and CapsStyle.SQUARE
.
* A null
value is equivalent to
* CapsStyle.ROUND
.
Valid values are JointStyle.BEVEL
,
* JointStyle.MITER
, and JointStyle.ROUND
.
* A null
value is equivalent to
* JointStyle.ROUND
.
Valid values range from 1 to 255 * (and values outside of that range are rounded to 1 or 255).
* *This value is only used if the jointStyle
property
* is set to JointStyle.MITER
.
The value of the miterLimit
property represents the length that a miter
* can extend beyond the point at which the lines meet to form a joint.
* The value expresses a factor of the line thickness
.
* For example, with a miterLimit
factor of 2.5
* and a thickness
of 10 pixels,
* the miter is cut off at 25 pixels.
This affects both the position of anchors of a curve * and the line stroke size itself.
* *With pixelHinting
set to true
,
* Flash Player and AIR hint line widths to full pixel widths.
* With pixelHinting
set to false
,
* disjoints can appear for curves and straight lines.
LineScaleMode.NORMAL
* Always scale the line thickness when the object is scaled (the default).
* LineScaleMode.NONE
* Never scale the line thickness.
* LineScaleMode.VERTICAL
* Do not scale the line thickness if the object is scaled vertically
* only.
* LineScaleMode.HORIZONTAL
* Do not scale the line thickness if the object is scaled horizontally
* only.
*