コード例 #1
0
 /// <summary>
 /// Applies a radial glow effect to an image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options effecting things like blending.</param>
 /// <param name="color">The color to set as the glow.</param>
 /// <param name="radius">The the radius.</param>
 /// <param name="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 private static IImageProcessingContext Glow(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Color color,
     ValueSize radius,
     Rectangle rectangle) =>
 source.ApplyProcessor(new GlowProcessor(color, radius, options), rectangle);
コード例 #2
0
 /// <summary>
 /// Applies a radial glow effect to an image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options effecting things like blending.</param>
 /// <param name="color">The color to set as the glow.</param>
 /// <param name="radius">The the radius.</param>
 /// <param name="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Glow(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Color color,
     float radius,
     Rectangle rectangle) =>
 source.Glow(options, color, ValueSize.Absolute(radius), rectangle);
コード例 #3
0
 private static IImageProcessingContext VignetteInternal(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Color color,
     ValueSize radiusX,
     ValueSize radiusY) =>
 source.ApplyProcessor(new VignetteProcessor(options, color, radiusX, radiusY));
コード例 #4
0
ファイル: GlowProcessor.cs プロジェクト: Latency/ImageSharp
 /// <summary>
 /// Initializes a new instance of the <see cref="GlowProcessor{TPixel}" /> class.
 /// </summary>
 /// <param name="color">The color or the glow.</param>
 /// <param name="radius">The radius of the glow.</param>
 /// <param name="options">The options effecting blending and composition.</param>
 public GlowProcessor(TPixel color, ValueSize radius, GraphicsOptions options)
 {
     this.options   = options;
     this.GlowColor = color;
     this.Radius    = radius;
     this.blender   = PixelOperations <TPixel> .Instance.GetPixelBlender(this.options.BlenderMode);
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VignetteProcessor" /> class.
 /// </summary>
 /// <param name="options">The options effecting blending and composition.</param>
 /// <param name="color">The color of the vignette.</param>
 /// <param name="radiusX">The x-radius.</param>
 /// <param name="radiusY">The y-radius.</param>
 internal VignetteProcessor(GraphicsOptions options, Color color, ValueSize radiusX, ValueSize radiusY)
 {
     this.VignetteColor   = color;
     this.RadiusX         = radiusX;
     this.RadiusY         = radiusY;
     this.GraphicsOptions = options;
 }
コード例 #6
0
 public CCConditionalLessOrEqual(uint addr, uint val, ValueSize valSize, bool isPtr)
 {
     ValueSize = valSize;
     Address   = addr;
     Value     = val;
     IsPointer = isPtr;
 }
コード例 #7
0
        public override ValueSize Measure <TRenderSize>(TRenderSize availableSpace,
                                                        IMeasureContext measureContext)
        {
            if (!TryGetCamera(out var camera))
            {
                return(ValueSize.Empty);
            }

            if (availableSpace.Height.AreEqualEnough(0))
            {
                return(availableSpace.ToValueSize());
            }

            var aspect = availableSpace.Width / availableSpace.Height;

            if (aspect.AreEqualEnough(camera.AspectRatio))
            {
                return(availableSpace.ToValueSize());
            }
            if (aspect > camera.AspectRatio) //available is wider
            {
                var sz = new ValueSize(availableSpace.Height * camera.AspectRatio,
                                       availableSpace.Height);
                return(sz);
            }
            else //taller
            {
                var sz = new ValueSize(availableSpace.Width / camera.AspectRatio,
                                       availableSpace.Width);
                return(sz);
            }
        }
コード例 #8
0
 private void cboSize_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboSize.SelectedItem != null)
     {
         string    sizeDescription = cboSize.SelectedValue.ToString();
         ValueSize size            = GetEnumValue <ValueSize>(sizeDescription);
         if (size == Nestopia.ValueSize.Manual)
         {
             txtValue.Tag       = txtValue.Visible;
             txtValue.Visible   = false;
             cboType.Visible    = false;
             txtOffset.Visible  = false;
             chkSplit.Visible   = false;
             chkSplit.Checked   = true;
             btnRemove.Location = new System.Drawing.Point(154, 2);
         }
         else
         {
             bool visible = txtValue.Tag == null ? true : (bool)txtValue.Tag;
             btnRemove.Location = new System.Drawing.Point(visible ? 419 : 333, 2);
             txtValue.Visible   = visible;
             cboType.Visible    = true;
             txtOffset.Visible  = true;
             chkSplit.Visible   = true;
         }
     }
 }
コード例 #9
0
        public Boolean OnScroll(MotionEvent?e1,
                                MotionEvent?e2,
                                Single distanceX,
                                Single distanceY)
        {
            //System.Diagnostics.Debug.WriteLine("[OKYN] ANDROID REPORTS SCROLL.");


            if (e1 == null || e2 == null)
            {
                return(false);
            }

            var start = GetPosition(e1);
            var last  = GetPosition(e2);

            var x = (0 - distanceX) * _dpiRatio;
            var y = (0 - distanceY) * _dpiRatio;

            var delta = new ValueSize(x, y);


            var dragArgs = new DragEventArgs(start, last, delta,
                                             _leftButtonWentDown != null ? MouseButtons.Left : MouseButtons.Right,
                                             this);

            _inputHandler.OnMouseInput(dragArgs, InputAction.MouseDrag);


            return(true);
        }
コード例 #10
0
 private void ValueSizeCalculation(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (a_cargo_characteristic == "Тарно-штучные")
         {
             CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
             ci.NumberFormat.CurrencyDecimalSeparator = ".";
             float ValueSize;
             var   ValueSumSeits = int.Parse(s_length.Text, NumberStyles.Any, ci);
             if (ValueSumSeits > 100 || ValueSumSeits < 0)
             {
                 throw new Exception("Количество мест ограничено до 100 шт.");
             }
             var ValueWidth  = float.Parse(s_width.Text, NumberStyles.Any, ci);
             var ValueLenght = float.Parse(s_height.Text, NumberStyles.Any, ci);
             var ValueHeight = float.Parse(s_sum_seats.Text, NumberStyles.Any, ci);
             //double ValueSumSeits, ValueWidth, ValueLenght, ValueHeight, ValueSize;
             //bool TryParseSumSeats = Double.TryParse(s_sum_seats.Text, out ValueSumSeits);
             //bool TryParseWidth = Double.TryParse(s_width.Text, out ValueWidth);
             //bool TryParseLenght = Double.TryParse(s_length.Text, out ValueLenght);
             //bool TryParseHeight = Double.TryParse(s_height.Text, out ValueHeight);
             ValueSize   = ValueSumSeits * ValueWidth * ValueLenght * ValueHeight;
             s_size.Text = ValueSize.ToString();
         }
     }
     catch (Exception ex)
     {
         //Toast.MakeText(Activity,"Некорректный ввод. Введите правильное значение" /*+ ex.Message*/, ToastLength.Long).Show();
     }
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VignetteProcessor{TPixel}" /> class.
 /// </summary>
 /// <param name="color">The color of the vignette.</param>
 /// <param name="radiusX">The x-radius.</param>
 /// <param name="radiusY">The y-radius.</param>
 /// <param name="options">The options effecting blending and composition.</param>
 public VignetteProcessor(TPixel color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options)
 {
     this.VignetteColor = color;
     this.RadiusX       = radiusX;
     this.RadiusY       = radiusY;
     this.options       = options;
     this.blender       = PixelOperations <TPixel> .Instance.GetPixelBlender(this.options.BlenderMode);
 }
コード例 #12
0
 /// <summary>
 /// Applies a radial vignette effect to an image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <param name="color">The color to set as the vignette.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Vignette(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Color color) =>
 source.VignetteInternal(
     options,
     color,
     ValueSize.PercentageOfWidth(.5f),
     ValueSize.PercentageOfHeight(.5f));
コード例 #13
0
ファイル: GlowTest.cs プロジェクト: miss-bug/ImageSharp
        public void Glow_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow();
            GlowProcessor p = this.Verify <GlowProcessor>();

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, GraphicsOptionsComparer);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
コード例 #14
0
ファイル: GlowTest.cs プロジェクト: xiawei666/ImageSharp
        public void Glow_Color_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow(Rgba32.Aquamarine);
            var p = this.Verify <GlowProcessor>();

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Color.Aquamarine, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
コード例 #15
0
ファイル: GlowTest.cs プロジェクト: xiawei666/ImageSharp
        public void Glow_Radux_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow(3.5f);
            var p = this.Verify <GlowProcessor>();

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.Absolute(3.5f), p.Radius);
        }
コード例 #16
0
        public void Vignette_Color_VignetteProcessorWithDefaultValues()
        {
            this.operations.Vignette(Color.Aquamarine);
            VignetteProcessor p = this.Verify <VignetteProcessor>();

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, graphicsOptionsComparer);
            Assert.Equal(Color.Aquamarine, p.VignetteColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.RadiusX);
            Assert.Equal(ValueSize.PercentageOfHeight(.5f), p.RadiusY);
        }
コード例 #17
0
ファイル: VignetteTest.cs プロジェクト: kks1234/ImageSharp
        public void Vignette_VignetteProcessorWithDefaultValues()
        {
            this.operations.Vignette();
            VignetteProcessor p = this.Verify <VignetteProcessor>();

            Assert.Equal(this.options, p.GraphicsOptions);
            Assert.Equal(Color.Black, p.VignetteColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.RadiusX);
            Assert.Equal(ValueSize.PercentageOfHeight(.5f), p.RadiusY);
        }
コード例 #18
0
        public void Vignette_Radux_VignetteProcessorWithDefaultValues()
        {
            this.operations.Vignette(3.5f, 12123f);
            VignetteProcessor p = this.Verify <VignetteProcessor>();

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, graphicsOptionsComparer);
            Assert.Equal(Color.Black, p.VignetteColor);
            Assert.Equal(ValueSize.Absolute(3.5f), p.RadiusX);
            Assert.Equal(ValueSize.Absolute(12123f), p.RadiusY);
        }
コード例 #19
0
ファイル: VignetteTest.cs プロジェクト: zone117x/ImageSharp
        public void Vignette_Color_VignetteProcessorWithDefaultValues()
        {
            this.operations.Vignette(Rgba32.Aquamarine);
            var p = this.Verify <VignetteProcessor <Rgba32> >();

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Rgba32.Aquamarine, p.VignetteColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.RadiusX);
            Assert.Equal(ValueSize.PercentageOfHeight(.5f), p.RadiusY);
        }
コード例 #20
0
 /// <summary>
 /// Applies a radial vignette effect to an image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <param name="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Vignette(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Rectangle rectangle) =>
 source.VignetteInternal(
     options,
     Color.Black,
     ValueSize.PercentageOfWidth(.5f),
     ValueSize.PercentageOfHeight(.5f),
     rectangle);
コード例 #21
0
ファイル: VignetteTest.cs プロジェクト: zone117x/ImageSharp
        public void Vignette_Radux_VignetteProcessorWithDefaultValues()
        {
            this.operations.Vignette(3.5f, 12123f);
            var p = this.Verify <VignetteProcessor <Rgba32> >();

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Rgba32.Black, p.VignetteColor);
            Assert.Equal(ValueSize.Absolute(3.5f), p.RadiusX);
            Assert.Equal(ValueSize.Absolute(12123f), p.RadiusY);
        }
コード例 #22
0
ファイル: GlowTest.cs プロジェクト: xiawei666/ImageSharp
        public void Glow_Rect_GlowProcessorWithDefaultValues()
        {
            var rect = new Rectangle(12, 123, 43, 65);

            this.operations.Glow(rect);
            var p = this.Verify <GlowProcessor>(rect);

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
コード例 #23
0
ファイル: VignetteTest.cs プロジェクト: zone117x/ImageSharp
        public void Vignette_Rect_VignetteProcessorWithDefaultValues()
        {
            var rect = new Rectangle(12, 123, 43, 65);

            this.operations.Vignette(rect);
            var p = this.Verify <VignetteProcessor <Rgba32> >(rect);

            Assert.Equal(GraphicsOptions.Default, p.GraphicsOptions);
            Assert.Equal(Rgba32.Black, p.VignetteColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.RadiusX);
            Assert.Equal(ValueSize.PercentageOfHeight(.5f), p.RadiusY);
        }
コード例 #24
0
ファイル: AstBodyBuilder.cs プロジェクト: DustinCampbell/ifvm
        public AstLocal DeclareLocal(ValueSize size, AstExpression value = null)
        {
            var index = AstFactory.ConstantExpression(this.locals.Count);
            var local = AstFactory.Local(index, size);

            this.locals.Add(local);

            if (value != null)
            {
                WriteLocal(local, value);
            }

            return(local);
        }
コード例 #25
0
        public PieChart(IVisualBootstrapper templateResolver)
            : base(templateResolver)
        {
            _legendLock = new Object();

            _templateResolver = templateResolver;
            _desiredSize      = new ValueSize(1, 1);
            _defaultedColors  = new Dictionary <TKey, IBrush>();
            _random           = new Random();
            _outline          = new Pen(Color.DarkGray, 1);
            _legendOutline    = new Pen(new Color(203, 212, 225), 1);
            _legendItems      = new List <PieLegendItem>();
            _legendItemSizes  = new List <ISize>();
            _legendBackground = new SolidColorBrush(Color.White);
        }
コード例 #26
0
        public override ValueSize Measure <TRenderSize>(TRenderSize availableSpace,
                                                        IMeasureContext measureContext)
        {
            if (!_isStyleSet)
            {
                _isStyleSet = true;
            }

            var sz = _label.Measure(availableSpace, measureContext);

            _offsetX = sz.Height + 5;
            var res = new ValueSize(sz.Width + _offsetX, sz.Height);

            return(res);
        }
コード例 #27
0
        private void BindStoreOperand(Operand operand, AstExpression value, ValueSize size = ValueSize.DWord)
        {
            var operandValue = (int)operand.Value;

            switch (operand.Type)
            {
            case OperandType.Address:
                this.bodyBuilder.AddStatement(
                    AstFactory.WriteMemoryStatement(
                        address: AstFactory.ConstantExpression(operandValue),
                        value: value,
                        size: size));
                break;

            case OperandType.Constant:
                if (operandValue != 0)
                {
                    throw new InvalidOperationException("Store operand cannot be a non-zero constant.");
                }

                this.bodyBuilder.AddStatement(
                    AstFactory.ExpressionStatement(value));

                break;

            case OperandType.LocalAddress:
                var local = this.addressToLocalMap[operandValue];
                this.bodyBuilder.WriteLocal(local, value);
                break;

            case OperandType.RamAddress:
                this.bodyBuilder.AddStatement(
                    AstFactory.WriteMemoryStatement(
                        address: AstFactory.ConstantExpression(ramStart).Plus(operandValue),
                        value: value,
                        size: size));
                break;

            case OperandType.Stack:
                this.bodyBuilder.AddStatement(
                    AstFactory.StackPushStatement(value));
                break;

            default: throw new InvalidOperationException($"Invalid operand type for store operand: {operand.Type}");
            }
        }
コード例 #28
0
        private void SetLastMeasured(IVisualElement element,
                                     ValueSize size)
        {
            //   Debug.WriteLine("visual " + element + " measured: " + size);

            lock (_measureLock)
            {
                if (!_lastMeasurements.ContainsKey(element))
                {
                    element.Disposed += OnElementDisposed;
                    _lastMeasurements.Add(element, size);
                }
                else
                {
                    _lastMeasurements[element] = size;
                }
            }
        }
コード例 #29
0
        public virtual Boolean TryGetElementSize(IVisualElement visual,
                                                 ISize availableSize,
                                                 out ValueSize size)
        {
            if (!(visual.Width is {} vWidth) ||
                !(visual.Height is {} vHeight))
            {
                goto fail;
            }

            var w = vWidth.GetQuantity(availableSize.Width);
            var h = vHeight.GetQuantity(availableSize.Height);

            size = new ValueSize(w, h);
            return(true);

fail:
            size = ValueSize.Empty;
            return(false);
        }
コード例 #30
0
        protected override void OnMeasure(Int32 widthMeasureSpec,
                                          Int32 heightMeasureSpec)
        {
            base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
            var w = MeasuredWidth;
            var h = MeasuredHeight;

            var sz = new ValueRenderSize(w, h);

            _targetRect = new ValueRectangle(
                0, // X
                0, // Y
                sz.Width / ZoomLevel,
                sz.Height / ZoomLevel);

            var count = ChildCount;

            for (var c = 0; c < count; c++)
            {
                var current = GetChildAt(c);

                if (current is IVisualSurrogate)
                {
                    current.Measure(Convert.ToInt32(_targetRect.Width),
                                    Convert.ToInt32(_targetRect.Height));
                }
                else
                {
                    current?.Measure(widthMeasureSpec, heightMeasureSpec);
                }
            }

            _measured = new ValueSize(sz.Width, sz.Height);
            RenderKit.MeasureContext.MeasureMainView(_view, sz, _viewState);

            if (_refreshLoopCount == 0)
            {
                _refreshLoopCount++;
                var _ = RefreshLoop();
            }
        }