Repository: flex-asjs Updated Branches: refs/heads/develop 4803c83ca -> 97d438c32
Move BlendBead to Graphics and use Shader Classes Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/97d438c3 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/97d438c3 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/97d438c3 Branch: refs/heads/develop Commit: 97d438c32a678b1f2f9cdd805044ec8104a5f41e Parents: 4803c83 Author: yishayw <[email protected]> Authored: Wed Mar 8 05:38:22 2017 +0200 Committer: yishayw <[email protected]> Committed: Wed Mar 8 05:38:22 2017 +0200 ---------------------------------------------------------------------- .../Graphics/src/main/flex/GraphicsClasses.as | 9 -- .../org/apache/flex/graphics/beads/BlendBead.as | 142 +++++++++++++++++++ .../src/main/resources/basic-manifest.xml | 1 + .../org/apache/flex/html/beads/BlendBead.as | 97 ------------- .../HTML/src/main/resources/basic-manifest.xml | 1 - 5 files changed, 143 insertions(+), 107 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/97d438c3/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as index 5836c9e..3b87a56 100644 --- a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as +++ b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as @@ -41,15 +41,6 @@ internal class GraphicsClasses COMPILE::SWF { import org.apache.flex.graphics.utils.PathHelper; PathHelper; - import org.apache.flex.graphics.utils.shaderClasses.ColorBurnShader; ColorBurnShader; - import org.apache.flex.graphics.utils.shaderClasses.ColorDodgeShader; ColorDodgeShader; - import org.apache.flex.graphics.utils.shaderClasses.ColorShader; ColorShader; - import org.apache.flex.graphics.utils.shaderClasses.ExclusionShader; ExclusionShader; - import org.apache.flex.graphics.utils.shaderClasses.HueShader; HueShader; - import org.apache.flex.graphics.utils.shaderClasses.LuminosityMaskShader; LuminosityMaskShader; - import org.apache.flex.graphics.utils.shaderClasses.LuminosityShader; LuminosityShader; - import org.apache.flex.graphics.utils.shaderClasses.SaturationShader; SaturationShader; - import org.apache.flex.graphics.utils.shaderClasses.SoftLightShader; SoftLightShader; } import org.apache.flex.graphics.QuadraticCurve; QuadraticCurve; import org.apache.flex.graphics.ICircle; ICircle; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/97d438c3/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/beads/BlendBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/beads/BlendBead.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/beads/BlendBead.as new file mode 100644 index 0000000..e45c428 --- /dev/null +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/beads/BlendBead.as @@ -0,0 +1,142 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.graphics.beads +{ + import flash.display.Shader; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.graphics.utils.shaderClasses.ColorBurnShader; + import org.apache.flex.graphics.utils.shaderClasses.ColorDodgeShader; + import org.apache.flex.graphics.utils.shaderClasses.ColorShader; + import org.apache.flex.graphics.utils.shaderClasses.ExclusionShader; + import org.apache.flex.graphics.utils.shaderClasses.HueShader; + import org.apache.flex.graphics.utils.shaderClasses.LuminosityShader; + import org.apache.flex.graphics.utils.shaderClasses.SaturationShader; + import org.apache.flex.graphics.utils.shaderClasses.SoftLightShader; + + COMPILE::SWF + { + import flash.display.BlendMode; + import org.apache.flex.core.IRenderedObject; + import org.apache.flex.core.IStyleableObject; + import org.apache.flex.core.ValuesManager; + } + + /** + * The BlendBead class translates HTML mixBlendMode CSS values to flash. + * The JS implementation is degenerated and exists only to enable output + * agnostic compilation. + * + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + + + public class BlendBead implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function BlendBead() + { + } + + COMPILE::SWF + private static var MAP:Object = { + normal: BlendMode.NORMAL, + multiply : BlendMode.MULTIPLY, + screen: BlendMode.SCREEN, + overlay: BlendMode.OVERLAY, + darken: BlendMode.DARKEN, + lighten: BlendMode.LIGHTEN, + 'hard-light': BlendMode.HARDLIGHT, + difference: BlendMode.DIFFERENCE + } + + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + COMPILE::SWF + { + var host:IRenderedObject = value as IRenderedObject; + var blendModeValue:String = ValuesManager.valuesImpl.getValue(IStyleableObject(value), "mix-blend-mode") as String; + var simpleBlendModeValue:String = MAP[blendModeValue]; + if (!simpleBlendModeValue) + { + getBlendMode(blendModeValue, host); + } else + { + host.$displayObject.blendMode = simpleBlendModeValue; + } + } + } + + COMPILE::SWF + private function getBlendMode(blendModeValue:String, host:IRenderedObject):void + { + var shader:Shader = null; + switch (blendModeValue) + { + case 'hue': + shader = new HueShader(); + break; + case 'saturation': + shader = new SaturationShader(); + break; + case 'color': + shader = new ColorShader(); + break; + case 'luminosity': + shader = new LuminosityShader(); + break; + case 'exclusion': + shader = new ExclusionShader(); + break; + case 'color-dodge': + shader = new ColorDodgeShader(); + break; + case 'color-burn': + shader = new ColorBurnShader(); + break; + case 'soft-light': + shader = new SoftLightShader(); + break; + } + host.$displayObject.blendMode = "normal"; + host.$displayObject.blendShader = shader; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/97d438c3/frameworks/projects/Graphics/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/resources/basic-manifest.xml b/frameworks/projects/Graphics/src/main/resources/basic-manifest.xml index a1496b2..d5c4f04 100644 --- a/frameworks/projects/Graphics/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/Graphics/src/main/resources/basic-manifest.xml @@ -23,4 +23,5 @@ <component id="GradientEntry" class="org.apache.flex.graphics.GradientEntry" /> <component id="SolidColor" class="org.apache.flex.graphics.SolidColor" /> <component id="SolidColorStroke" class="org.apache.flex.graphics.SolidColorStroke" /> + <component id="BlendBead" class="org.apache.flex.graphics.beads.BlendBead"/> </componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/97d438c3/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as deleted file mode 100644 index 8a93661..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as +++ /dev/null @@ -1,97 +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.html.beads -{ - import org.apache.flex.core.IBead; - import org.apache.flex.core.IStrand; - COMPILE::SWF - { - import flash.display.BlendMode; - import org.apache.flex.core.IRenderedObject; - import org.apache.flex.core.IStyleableObject; - import org.apache.flex.core.ValuesManager; - } - - /** - * The BlendBead class translates HTML mixBlendMode CSS values to flash. - * The JS implementation is degenerated and exists only to enable output - * agnostic compilation. - * - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - - - public class BlendBead implements IBead - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function BlendBead() - { - } - - COMPILE::SWF - private static var MAP:Object = { - normal: BlendMode.NORMAL, - multiply : BlendMode.MULTIPLY, - screen: BlendMode.SCREEN, - overlay: BlendMode.OVERLAY, - darken: BlendMode.DARKEN, - lighten: BlendMode.LIGHTEN, - 'color-dodge': 'colordodge', - 'color-burn': 'colorburn', - 'hard-light': BlendMode.HARDLIGHT, - 'soft-light': 'softlight', - difference: BlendMode.DIFFERENCE, - exclusion: BlendMode.DIFFERENCE, // TODO write custom blend - hue: 'hue', - saturation: 'saturation', - color: 'color', - luminosity: 'luminosity' - } - - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - COMPILE::SWF - { - var host:IRenderedObject = value as IRenderedObject; - var blendModeValue:String = ValuesManager.valuesImpl.getValue(IStyleableObject(value), "mix-blend-mode") as String; - host.$displayObject.blendMode = MAP[blendModeValue]; - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/97d438c3/frameworks/projects/HTML/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml index bfaa723..7356316 100644 --- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml @@ -83,7 +83,6 @@ <component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer"/> <component id="AccordionItemRenderer" class="org.apache.flex.html.supportClasses.AccordionItemRenderer"/> <component id="AccordionCollapseBead" class="org.apache.flex.html.beads.AccordionCollapseBead"/> - <component id="BlendBead" class="org.apache.flex.html.beads.BlendBead"/> <component id="DispatchInputFinishedBead" class="org.apache.flex.html.beads.DispatchInputFinishedBead"/> <component id="TreeItemRenderer" class="org.apache.flex.html.supportClasses.TreeItemRenderer"/> <component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer"/>
