float fReference; // clamped between [0,1] #region Constructor public AlphaState() : base(StateType.Alpha) { fBlendEnabled = false; fTestEnabled = false; fAlphaFunction = AlphaFunction.Always; fSrcBlendFactor = SrcBlendFactor.SrcAlpha; fDstBlendFactor = DstBlendFactor.OneMinusSrcAlpha; fReference = 0.0f; }
public void Draw(AlphaFunction func, float value) { //GL.Disable(EnableCap.DepthTest); //GL.Enable(EnableCap.CullFace); //GL.CullFace(CullFaceMode.Back); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, // BlendingFactorDest.OneMinusSrcAlpha); //GL.Enable(EnableCap.AlphaTest); //GL.AlphaFunc(func, value); float alpha = 0.25f; //this.DrawCube(alpha * 4, Color.Red, Vector3D.Zero); //this.DrawCube(alpha * 3, Color.Blue, new Vector3D(0.1, 0.1, 0.2)); //this.DrawCube(alpha * 2, Color.Green, new Vector3D(0.2, 0.2, 0.4)); //this.DrawCube(alpha * 1, Color.Yellow, new Vector3D(0.3, 0.3, 0.6)); //GL.Disable(EnableCap.AlphaTest); //GL.Disable(EnableCap.Blend); }
/// <summary> /// Creates and initializes a new instance of the AnimateKeyframes class. /// </summary> /// <param name="inTarget">target string</param> /// <param name="inProperty">property string</param> /// <param name="inKeyframes">key frames</param> /// <param name="inInterpolation">Interpolation</param> /// <param name="inAlphaFunction">alpha function</param> /// <param name="inStartTime">start time, default value is 0</param> /// <param name="inEndTime">end time, default value is -1</param> public AnimateKeyframes(String inTarget, String inProperty, KeyFrames inKeyframes, Animation.Interpolation inInterpolation, AlphaFunction inAlphaFunction, int inStartTime = 0, int inEndTime = -1) : base(ElementType.AnimateBetween, inTarget, inProperty, null, inAlphaFunction, inStartTime, inEndTime) { keyframes = inKeyframes; interpolation = inInterpolation; }
public abstract void ScrollTo(float position, uint durationMs = 0, AlphaFunction alphaFunction = null);
public static void AlphaFunc(AlphaFunction func, IntPtr @ref) { Debug.Assert(Delegates.pglAlphaFuncx != null, "pglAlphaFuncx not implemented"); Delegates.pglAlphaFuncx((int)func, @ref); DebugCheckErrors(null); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AlphaFunction obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public void AlphaFunc(AlphaFunction func, float reference) { gl.glAlphaFunc((int)func, reference); CheckException(); }
internal static extern void glAlphaFunc(AlphaFunction func, Single @ref);
public static void GetSamplerParameteri(uint sampler, SamplerParameterName pname, out AlphaFunction param) { int p; _GetSamplerParameteri(sampler, pname, out p); param = (AlphaFunction)p; }
/// <summary> /// Alpha test function /// </summary> /// <param name="function">Comparison function</param> /// <param name="reference">Reference value</param> public static void AlphaFunction(AlphaFunction function, float reference) { TK.GL.AlphaFunc((TK.AlphaFunction)function, reference); }
public static void glAlphaFunc(AlphaFunction func, Single @ref) { i_OpenGL1_1.glAlphaFunc(func, @ref); }
// Initialisation private void OnInitialize() { // Initialize menus. TVConfiguration tvConfiguration = new TVConfiguration(); _configuration = tvConfiguration.GetConfiguration(); _window = Window.Instance; _window.SetOpaqueState(false); _windowSize = _window.Size; _resourcePath = Constants.ResourcePath; _posterMenuHideStack = new List <int>(); // Precalculations for re-use: // The poster-menu height is based on factors for scalability. // The height of the poster-menu is increased to take into account the amount revealed by the lower-menu animation. _posterMenuHeight = _windowSize.Height * (Constants.TopContainerHeightFactor + (Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor)); // Y position is the % of the screen occupied by the menu, minus the amount of the screen that the menu hides by. // This is so when the menu is partially hidden, all of the posters can be seen exactly. // We increase the Hide factor to give more overlap as the hide animation overshoots when it bounces. _posterMenuY = _windowSize.Height * (Constants.MenuContainerHeightFactor - (Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor * 1.5f)); if (!Constants.TransparentWindow) { ImageView backgroundImage = new ImageView(_resourcePath + "/images/Backgrounds/source_bg.png"); backgroundImage.Name = "backgroundImage"; backgroundImage.WidthResizePolicy = ResizePolicyType.FillToParent; backgroundImage.HeightResizePolicy = ResizePolicyType.Fixed; backgroundImage.Size2D = new Size2D(0, _windowSize.Height - (int)(_posterMenuHeight - _posterMenuY)); backgroundImage.ParentOrigin = ParentOrigin.TopCenter; backgroundImage.PivotPoint = PivotPoint.TopCenter; backgroundImage.PositionUsesPivotPoint = true; _window.Add(backgroundImage); } // Create a SpotLight for items / images of both Poster and Menu ScrollContainers ImageView spotLight = new ImageView(_resourcePath + "/images/HighlightEffect/highlight-spotlight.png"); spotLight.Name = "spotLight"; spotLight.WidthResizePolicy = ResizePolicyType.UseNaturalSize; spotLight.HeightResizePolicy = ResizePolicyType.UseNaturalSize; spotLight.ParentOrigin = ParentOrigin.Center; spotLight.PivotPoint = PivotPoint.Center; spotLight.PositionUsesPivotPoint = true; // Create the poster menu in the middle of the screen _posterMenuContainer = new ImageView(_resourcePath + "/images/Backgrounds/background.png"); _posterMenuContainer.WidthResizePolicy = ResizePolicyType.FillToParent; _posterMenuContainer.HeightResizePolicy = ResizePolicyType.Fixed; _posterMenuContainer.Size2D = new Size2D(0, (int)_posterMenuHeight); _posterMenuContainer.PositionUsesPivotPoint = true; _posterMenuContainer.ParentOrigin = ParentOrigin.BottomCenter; _posterMenuContainer.PivotPoint = PivotPoint.BottomCenter; _posterMenuContainer.Position = new Position(0.0f, -_posterMenuY, 0.0f); _window.Add(_posterMenuContainer); CreatePosterMenus(spotLight); _posterMenuContainer.Add(_posterMenus[0].ScrollMenu()); _currentMenuIndex = 1; UpdateActivePosterMenu(0); _menuContainer = new ImageView(_resourcePath + "/images/Backgrounds/background.png"); _menuContainer.Name = "menuContainer"; _menuContainer.WidthResizePolicy = ResizePolicyType.FillToParent; _menuContainer.HeightResizePolicy = ResizePolicyType.Fixed; _menuContainer.Size2D = new Size2D(0, (int)(_windowSize.Height * Constants.MenuContainerHeightFactor)); _menuContainer.PositionUsesPivotPoint = true; _menuContainer.ParentOrigin = ParentOrigin.BottomRight; _menuContainer.PivotPoint = PivotPoint.BottomRight; _window.Add(_menuContainer); // Create the lower menu and items. Size2D sourceMenuSize = new Size2D(Convert.ToInt32(_windowSize.Width - Constants.SystemMenuWidth), Convert.ToInt32(_windowSize.Height * Constants.MenuContainerHeightFactor)); Size2D sourceMenuItemSize = new Size2D(Convert.ToInt32((_windowSize.Width * Constants.MenuItemWidthFactor) - Constants.SourceMenuPadding), Convert.ToInt32(_windowSize.Height * Constants.MenuItemHeightFactor)); _menu = new SourceMenu(sourceMenuSize, sourceMenuItemSize); // Create the showing and hiding menu effects. _menu.ShowMenuEffect = new Effect(_menuContainer, Constants.ShowMenuDuration); _menu.ShowMenuEffect.EndAction = Animation.EndActions.Cancel; _menu.ShowMenuEffect.AddAction(new Effect.AnimateTo("menuContainer", "Position", new Position(0.0f, 0.0f, 0.0f), new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSine))); // Hide animation bounces away. _menu.HideMenuEffect = new Effect(_menuContainer, Constants.ShowMenuDuration); _menu.HideMenuEffect.EndAction = Animation.EndActions.Cancel; float yPosition = _windowSize.Height * Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor; AlphaFunction hideAlphaFunction = new AlphaFunction(new Vector2(0.32f, 0.08f), new Vector2(0.38f, 1.72f)); _menu.HideMenuEffect.AddAction(new Effect.AnimateTo("menuContainer", "Position", new Position(0.0f, yPosition, 0.0f), hideAlphaFunction)); CreateMenuHighlightEffects(_menu.ScrollMenu(), "SourceMenu", spotLight); _menuContainer.Add(_menu.ScrollMenu()); _moveSourceMenuAnimation = new Animation(Constants.ShowMenuDuration); _moveSourceMenuAnimation.EndAction = Animation.EndActions.Cancel; // Create the system menu on the bottom left of the screen. _systemMenu = new SystemMenu(new Size2D(Convert.ToInt32(Constants.SystemMenuWidth), Convert.ToInt32(_windowSize.Height * Constants.MenuContainerHeightFactor)), new Position2D(-_windowSize.Width / 2, _windowSize.Height / 2)); _menuContainer.Add(_systemMenu.GetView()); // Initialize PreFocusChange event of KeyboardFocusManager _keyboardFocusManager = FocusManager.Instance; _keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChangeSignal; _keyboardFocusManager.FocusIndicator = new View(); //todor _keyboardFocusManager.SetAsFocusGroup(_systemMenu.GetView(), true); _keyboardFocusManager.SetAsFocusGroup(_menu.ScrollMenu(), true); for (int i = 0; i < _posterMenus.Count; ++i) { _keyboardFocusManager.SetAsFocusGroup(_posterMenus[i].ScrollMenu(), true); } _keyboardFocusManager.FocusGroupLoop = false; // Set up automation if in benchmarking mode. if (_benchmarkMode) { _automation = new Automation(); _automation.EventSignal += AutomationHandler; AutomationConfiguration automationConfiguration = new AutomationConfiguration(); automationConfiguration.Configure(_automation, _menu.Count); _automation.Start(); } //todor comment _actionReminder = new ActionReminder(_posterMenuContainer); _actionReminder.GetView().ParentOrigin = new Position(0.07f, -0.25f, 0.5f); _actionReminderTickCounter = 0; _actionReminderTimePeriod = Constants.ActionReminderTimePeriod; _actionReminderRemoteShowTicks = Constants.ActionReminderRemoteShowTicks; _actionReminderTimer = new Timer(_actionReminderTimePeriod); _actionReminderTimer.Tick += ActionReminderTimerHandler; // Start the timer that will fire the animation sequence when triggered. _actionReminderTimer.Start(); // Move Focus to Bottom Container (Menu ScrollContainer) _menu.ScrollMenu().SetActive(true); _keyboardFocusManager.SetCurrentFocusView(_menu.ScrollMenu().GetCurrentFocusedItem()); Window.Instance.KeyEvent += AppBack; }
public static void AlphaFunc (AlphaFunction alpha, ref Single @ref) { #warning NOT IMPLEMENTED YET }
/// <summary> /// Creates and initializes a new instance of the EffectElementBase class. /// </summary> /// <param name="inAnimationMode">element type</param> /// <param name="inTarget">target</param> /// <param name="inProperty">property</param> /// <param name="inTargetValue">target value</param> /// <param name="inAlphaFunction">alpha function</param> /// <param name="inStartTime">start time</param> /// <param name="inEndTime">end time</param> public EffectElementBase(ElementType inAnimationMode, String inTarget, String inProperty, object inTargetValue, AlphaFunction inAlphaFunction, int inStartTime = 0, int inEndTime = -1) { elementType = inAnimationMode; target = inTarget; property = inProperty; targetValue = inTargetValue; startTime = inStartTime; endTime = inEndTime; alphaFunction = inAlphaFunction; }
/// <summary> /// Creates and initializes a new instance of the AnimatePath class. /// </summary> /// <param name="inTarget">target string</param> /// <param name="inPath">path</param> /// <param name="forward">forward</param> /// <param name="inAlphaFunction">alpha function</param> /// <param name="inStartTime">start time, default value is 0</param> /// <param name="inEndTime">end time, default value is -1</param> public AnimatePath(String inTarget, Path inPath, Vector3 forward, AlphaFunction inAlphaFunction, int inStartTime = 0, int inEndTime = -1) : base(ElementType.AnimatePath, inTarget, "Position", forward, inAlphaFunction, inStartTime, inEndTime) { path = inPath; }
public static void SamplerParameteri(uint sampler, SamplerParameterName pname, AlphaFunction param) { _SamplerParameteri(sampler, pname, (int)param); }
public static extern void AlphaFunc( AlphaFunction func, float @ref );
// set alpha func private static void SetAlphaFunc(AlphaFunction Comparison, float Value) { AlphaTestEnabled = true; AlphaFuncComparison = Comparison; AlphaFuncValue = Value; GL.AlphaFunc(Comparison, Value); GL.Enable(EnableCap.AlphaTest); }
// set alpha func private static void SetAlphaFunc(AlphaFunction Comparison, float Value) { AlphaFuncComparison = Comparison; AlphaFuncValue = Value; GL.AlphaFunc(Comparison, Value); }
public void AlphaFunctionBuiltinToPropertyKey() { tlog.Debug(tag, $"AlphaFunctionBuiltinToPropertyKey START"); PropertyValue pvAlpha = null; string result = null; pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Linear)); pvAlpha.Get(out result); Assert.AreEqual("LINEAR", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Reverse)); pvAlpha.Get(out result); Assert.AreEqual("REVERSE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInSquare)); pvAlpha.Get(out result); Assert.AreEqual("EASE_IN_SQUARE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutSquare)); pvAlpha.Get(out result); Assert.AreEqual("EASE_OUT_SQUARE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseIn)); pvAlpha.Get(out result); Assert.AreEqual("EASE_IN", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOut)); pvAlpha.Get(out result); Assert.AreEqual("EASE_OUT", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInOut)); pvAlpha.Get(out result); Assert.AreEqual("EASE_IN_OUT", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInSine)); pvAlpha.Get(out result); Assert.AreEqual("EASE_IN_SINE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutSine)); pvAlpha.Get(out result); Assert.AreEqual("EASE_OUT_SINE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInOutSine)); pvAlpha.Get(out result); Assert.AreEqual("EASE_IN_OUT_SINE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Bounce)); pvAlpha.Get(out result); Assert.AreEqual("BOUNCE", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Sin)); pvAlpha.Get(out result); Assert.AreEqual("SIN", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutBack)); pvAlpha.Get(out result); Assert.AreEqual("EASE_OUT_BACK", result, "Should be equal!"); pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Default)); pvAlpha.Get(out result); Assert.AreEqual("DEFAULT", result, "Should be equal!"); result = null; pvAlpha.Dispose(); tlog.Debug(tag, $"AlphaFunctionBuiltinToPropertyKey END (OK)"); }
public AlphaCompare(EndianBinaryReader er) { AlphaFunc = (AlphaFunction)er.ReadUInt32(); Reference = er.ReadSingle(); }
public void SetAlphaFunction(AlphaFunction alphaFunction, float alphaComparison) { GL.ProgramUniform2(handle, UniformLayout.AlphaFunction, (int)alphaFunction, alphaComparison); }
/// <summary> /// Creates an animation to animate the mixColor of the named visual. /// </summary> /// <since_tizen> 3 </since_tizen> public Animation AnimateColor(string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions?alphaFunction = null, object initialColor = null) { Animation animation = null; using (PropertyMap animator = new PropertyMap()) using (PropertyMap timePeriod = new PropertyMap()) using (PropertyValue pvDuration = new PropertyValue((endTime - startTime) / 1000.0f)) using (PropertyValue pvDelay = new PropertyValue(startTime / 1000.0f)) using (PropertyMap transition = new PropertyMap()) using (PropertyValue pvTarget = new PropertyValue(targetVisual)) using (PropertyValue pvProperty = new PropertyValue("mixColor")) using (PropertyValue destValue = PropertyValue.CreateFromObject(destinationColor)) { if (alphaFunction != null) { using (PropertyValue pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction))) { animator.Add("alphaFunction", pvAlpha); } } timePeriod.Add("duration", pvDuration); timePeriod.Add("delay", pvDelay); using (PropertyValue pvTimePeriod = new PropertyValue(timePeriod)) { animator.Add("timePeriod", pvTimePeriod); } using (PropertyValue pvAnimator = new PropertyValue(animator)) { transition.Add("animator", pvAnimator); } transition.Add("target", pvTarget); transition.Add("property", pvProperty); if (initialColor != null) { using (PropertyValue initValue = PropertyValue.CreateFromObject(initialColor)) { transition.Add("initialValue", initValue); } } transition.Add("targetValue", destValue); using (TransitionData transitionData = new TransitionData(transition)) { animation = new Animation(Interop.View.CreateTransition(SwigCPtr, TransitionData.getCPtr(transitionData)), true); } if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } return(animation); }
public static void AlphaFunc(AlphaFunction func, float reference) { gl.glAlphaFunc((int)func, reference); }
public abstract void Update(float contentLength, float position, uint durationMs = 0, AlphaFunction alphaFunction = null);
static extern void depthFunc(AlphaFunction func);
public void DepthFunc(AlphaFunction func) => depthFunc(func);
public static void AlphaFunc(AlphaFunction func, float @ref) { Debug.Assert(Delegates.pglAlphaFunc != null, "pglAlphaFunc not implemented"); Delegates.pglAlphaFunc((Int32)func, @ref); CallLog("glAlphaFunc({0}, {1})", func, @ref); DebugCheckErrors(); }
/// <summary> /// Creates and initializes a new instance of the AnimateBetween class. /// </summary> /// <param name="inTarget">target string</param> /// <param name="inProperty">property string</param> /// <param name="inStartValue">start value</param> /// <param name="inTargetValue">target value</param> /// <param name="inAlphaFunction">alpha function</param> /// <param name="inStartTime">start time, default value is 0</param> /// <param name="inEndTime">end time, default value is -1</param> public AnimateBetween(String inTarget, String inProperty, object inStartValue, object inTargetValue, AlphaFunction inAlphaFunction, int inStartTime = 0, int inEndTime = -1) : base(ElementType.AnimateBetween, inTarget, inProperty, inTargetValue, inAlphaFunction, inStartTime, inEndTime) { startValue = inStartValue; }