Exemple #1
0
        int PrepareShowData()
        {
            data = new byte[300];

            int        index  = 21;
            Brightness br     = Brightness.Percent100;
            TextAction action = TextAction.ContinusLeft;
            Speed      stay   = (Speed)speed;

            Border border = Border.NoBorder;

            data[index++] = (byte)br;
            data[index++] = 0x00;
            data[index++] = (byte)action;
            data[index++] = (byte)0x04; //speed;
            data[index++] = (byte)0x00; //stay;
            data[index++] = (byte)border;

            for (int i = 0; i < text.Length; i++)
            {
                data[index++] = (byte)color;
                data[index++] = 0x00;
                data[index++] = (byte)((char)text[i]);
            }

            data[index++] = 0xFF;

            return(index);
        }
Exemple #2
0
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(CurrentLevel.Equals(other.CurrentLevel) &&
                   CurrentArea.Equals(other.CurrentArea) &&
                   Language.Equals(other.Language) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   GameClockSeconds.Equals(other.GameClockSeconds) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   WeatherInterpolationValue.Equals(other.WeatherInterpolationValue) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   CameraModeInCar.Equals(other.CameraModeInCar) &&
                   CameraModeOnFoot.Equals(other.CameraModeOnFoot) &&
                   ExtraColor.Equals(other.ExtraColor) &&
                   IsExtraColorOn.Equals(other.IsExtraColorOn) &&
                   ExtraColorInterpolation.Equals(other.ExtraColorInterpolation) &&
                   Brightness.Equals(other.Brightness) &&
                   DisplayHud.Equals(other.DisplayHud) &&
                   ShowSubtitles.Equals(other.ShowSubtitles) &&
                   RadarMode.Equals(other.RadarMode) &&
                   BlurOn.Equals(other.BlurOn) &&
                   UseWideScreen.Equals(other.UseWideScreen) &&
                   MusicVolume.Equals(other.MusicVolume) &&
                   SfxVolume.Equals(other.SfxVolume) &&
                   RadioStation.Equals(other.RadioStation) &&
                   StereoOutput.Equals(other.StereoOutput) &&
                   PadMode.Equals(other.PadMode) &&
                   InvertLook.Equals(other.InvertLook) &&
                   UseVibration.Equals(other.UseVibration) &&
                   SwapNippleAndDPad.Equals(other.SwapNippleAndDPad) &&
                   HasPlayerCheated.Equals(other.HasPlayerCheated) &&
                   AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) &&
                   TargetIsOn.Equals(other.TargetIsOn) &&
                   TargetPosition.Equals(other.TargetPosition) &&
                   PlayerPosition.Equals(other.PlayerPosition) &&
                   TrailsOn.Equals(other.TrailsOn) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   Unknown78hPS2.Equals(other.Unknown78hPS2) &&
                   Unknown7ChPS2.Equals(other.Unknown7ChPS2) &&
                   Unknown90hPS2.Equals(other.Unknown90hPS2) &&
                   UnknownB8hPSP.Equals(other.UnknownB8hPSP) &&
                   UnknownD8hPS2.Equals(other.UnknownD8hPS2) &&
                   UnknownD9hPS2.Equals(other.UnknownD9hPS2));
        }
Exemple #3
0
 public bool Equals(HueLight obj)
 {
     if (!Id.Equals(obj.Id))
     {
         return(false);
     }
     if (!Name.Equals(obj.Name))
     {
         return(false);
     }
     if (!IsReachable.Equals(obj.IsReachable))
     {
         return(false);
     }
     if (!IsOn.Equals(obj.IsOn))
     {
         return(false);
     }
     if (!IsOn.Equals(obj.IsOn))
     {
         return(false);
     }
     if (!Brightness.Equals(obj.Brightness))
     {
         return(false);
     }
     if (!Color.Equals(obj.Color))
     {
         return(false);
     }
     return(true);
 }
Exemple #4
0
        private void apply()
        {
            // 1.获取亮度调整参数
            Common.Config.Alpha = (byte)this.tbAlpha.Value;

            // 2.获取多屏设置参数:自动更新

            // 3.获取软件设置参数
            Common.Config.AutoHidden    = this.ckxAutoHidden.Checked;
            Common.Config.AutoShowShade = this.ckxAutoShowShade.Checked;
            Common.Config.AutoAdjust    = this.ckxAutoAdjust.Checked;

            // 4.持久化配置
            Common.Config.UpdateTime = DateTime.Now;
            Common.Config.Save();

            /*
             * 5.调整屏幕亮度
             */
            if (this.tabMain.SelectedIndex == 1)
            {
                if (!this.ckxAlpha.Checked)
                {
                    this.ckxAlpha.Checked = true;
                }
                else
                {
                    this.showShade(this.ckxAlpha.Checked);
                }
            }

            // 6.收集屏幕亮度
            Brightness.Save(this.ckxAlpha.Checked ? Common.Config.Alpha : (byte)0, true);
        }
//    int selected = 4;
    public override void OnInspectorGUI()
    {
        Brightness obj = (Brightness)target;

        GUILayout.BeginHorizontal();
        if (obj.GetComponent <Renderer>().lightmapIndex < LightmapSettings.lightmaps.Length && obj.GetComponent <Renderer>().lightmapIndex >= 0)
        {
            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor))
            {
                if (GUILayout.Button("Make Readable (Far)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor);
                }
            }

            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir))
            {
                if (GUILayout.Button("Make Readable (Near)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir);
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("Brightness Level");
        obj.level = EditorGUILayout.Slider(obj.level, -1, 1);
        GUILayout.Label("Operate on (GPU/CPU)");
        obj.operateOn = (Brightness.OperateON)EditorGUILayout.EnumPopup(obj.operateOn);
        GUILayout.Label("Lightmap Options");
        obj.options = (Brightness.AdjustLightmap)EditorGUILayout.EnumPopup(obj.options);
        GUILayout.Label("Execute ON");
        obj.executeTrigger     = (Brightness.ExecuteON)EditorGUILayout.EnumPopup(obj.executeTrigger);
        obj.useSharedMaterials = EditorGUILayout.Toggle("Use Shared Materials", obj.useSharedMaterials);
        obj.timeScale          = EditorGUILayout.FloatField("Time Scale", obj.timeScale);
        obj.useCurve           = EditorGUILayout.Toggle("Use Curve", obj.useCurve);
        if (obj.useCurve)
        {
            obj.curve           = EditorGUILayout.CurveField("Curve", obj.curve);
            obj.loopCurve       = EditorGUILayout.Toggle("Loop Curve", obj.loopCurve);
            obj.startOnFirstKey = EditorGUILayout.Toggle("Start On 1st Key", obj.startOnFirstKey);

            if (obj.timeScale < 0)
            {
                obj.timeScale = 0;
            }
        }
        else
        {
            GUILayout.Label("Minimum Brightness");
            obj.Min = EditorGUILayout.Slider(obj.Min, -1, 1);
            GUILayout.Label("Maximum Brightness");
            obj.Max = EditorGUILayout.Slider(obj.Max, -1, 1);
        }
        //	if(GUILayout.Button("Write EXR"))
        //	{
        //		SaveExr.Save(LightmapSettings.lightmaps[obj.renderer.lightmapIndex].lightmapFar,"D:\test2.exr");

        //EXRWriter.writeEXR(LightmapSettings.lightmaps[obj.renderer.lightmapIndex].lightmapFar,"D:\\Test.exr");
        //	}
    }
Exemple #6
0
        private void UpdateControls()
        {
            DotSize.Update(_previewStyle.DotSize);
            DotRounding.Update(_previewStyle.DotRounding);
            DotSharpness.Update(_previewStyle.DotSharpness);
            Brightness.Update(_previewStyle.Brightness);
            Gamma.Update(_previewStyle.Gamma);
            DotGlow.Update(_previewStyle.DotGlow);
            BackLevel.Update(_previewStyle.BackGlow);

            TintAmount.Value = _previewStyle.Tint.ScA;
            Color tintColor = _previewStyle.Tint;

            tintColor.A             = 255;
            TintColor.SelectedColor = tintColor;

            Color unlitColor = _previewStyle.UnlitDot;

            unlitColor.A = 255;
            UnlitDotColor.SelectedColor = unlitColor;

            GlassDMDLightingValue.Text   = DoubleToString2(_previewStyle.GlassLighting);
            GlassDMDLightingSlider.Value = _previewStyle.GlassLighting;

            Color glassColor = _previewStyle.GlassColor;

            glassColor.A             = 255;
            GlassColor.SelectedColor = glassColor;

            GlassPath.Text   = _previewStyle.GlassTexture;
            GlassPadding.Pad = _previewStyle.GlassPadding;

            FramePath.Text   = _previewStyle.FrameTexture;
            FramePadding.Pad = _previewStyle.FramePadding;
        }
Exemple #7
0
 public MediaQueryData(
     Size size = null,
     float devicePixelRatio        = 1.0f,
     float textScaleFactor         = 1.0f,
     Brightness platformBrightness = Brightness.light,
     EdgeInsets viewInsets         = null,
     EdgeInsets padding            = null,
     bool alwaysUse24HourFormat    = false,
     bool accessibleNavigation     = false,
     bool invertColors             = false,
     bool disableAnimations        = false,
     bool boldText = false
     )
 {
     this.size                  = size ?? Size.zero;
     this.devicePixelRatio      = devicePixelRatio;
     this.textScaleFactor       = textScaleFactor;
     this.platformBrightness    = platformBrightness;
     this.viewInsets            = viewInsets ?? EdgeInsets.zero;
     this.padding               = padding ?? EdgeInsets.zero;
     this.alwaysUse24HourFormat = alwaysUse24HourFormat;
     this.accessibleNavigation  = accessibleNavigation;
     this.invertColors          = invertColors;
     this.disableAnimations     = disableAnimations;
     this.boldText              = boldText;
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (FileId != null)
         {
             hashCode = hashCode * 59 + FileId.GetHashCode();
         }
         if (PageRange != null)
         {
             hashCode = hashCode * 59 + PageRange.GetHashCode();
         }
         hashCode = hashCode * 59 + RoiLeft.GetHashCode();
         hashCode = hashCode * 59 + RoiTop.GetHashCode();
         hashCode = hashCode * 59 + RoiWidth.GetHashCode();
         hashCode = hashCode * 59 + RoiHeight.GetHashCode();
         hashCode = hashCode * 59 + GammaCorrection.GetHashCode();
         hashCode = hashCode * 59 + Brightness.GetHashCode();
         hashCode = hashCode * 59 + Contrast.GetHashCode();
         hashCode = hashCode * 59 + Saturation.GetHashCode();
         hashCode = hashCode * 59 + AutoContrastEnhancement.GetHashCode();
         hashCode = hashCode * 59 + ContrastHistogramStretch.GetHashCode();
         return(hashCode);
     }
 }
Exemple #9
0
        /// <summary>
        /// Finalizes the color by appliing the overall brightness and opacity.<br/>
        /// This method should always be the last call of a <see cref="GetColorAtPoint" /> implementation.
        /// </summary>
        /// <param name="color">The color to finalize.</param>
        /// <returns>The finalized color.</returns>
        protected virtual Color FinalizeColor(Color color)
        {
            if (ColorCorrections.Count > 0)
            {
                foreach (IColorCorrection colorCorrection in ColorCorrections)
                {
                    color = colorCorrection.ApplyTo(color);
                }
            }

            // Since we use HSV to calculate there is no way to make a color 'brighter' than 100%
            // Be carefull with the naming: Since we use HSV the correct term is 'value' but outside we call it 'brightness'
            // THIS IS NOT A HSB CALCULATION!!!
            if (Brightness < 1)
            {
                color = color.MultiplyHSV(value: Brightness.Clamp(0, 1));
            }

            if (Opacity < 1)
            {
                color = color.MultiplyA(Opacity.Clamp(0, 1));
            }

            return(color);
        }
Exemple #10
0
        private void Update(EvaluationContext context)
        {
            var hue = (Hue.GetValue(context) % 1) * 360f;  // + Saturation.GetValue(context);

            var sat        = Saturation.GetValue(context); // + Saturation.GetValue(context);
            var brightness = Brightness.GetValue(context); // + Saturation.GetValue(context);

            float fSatR = 1;
            float fSatG = 1;
            float fSatB = 1;

            if (hue < 120.0f)
            {
                fSatR = (120.0f - hue) / 60.0f;
                fSatG = hue / 60.0f;
                fSatB = 0.0f;
            }
            else if (hue < 240.0f)
            {
                fSatR = 0.0f;
                fSatG = (240.0f - hue) / 60.0f;
                fSatB = (hue - 120.0f) / 60.0f;
            }
            else
            {
                fSatR = (hue - 240.0f) / 60.0f;
                fSatG = 0.0f;
                fSatB = (360.0f - hue) / 60.0f;
            }

            fSatR = (fSatR < 1.0f) ? fSatR : 1.0f;
            fSatG = (fSatG < 1.0f) ? fSatG : 1.0f;
            fSatB = (fSatB < 1.0f) ? fSatB : 1.0f;

            var fTmpR = 2.0f * sat * fSatR + (1.0f - sat);
            var fTmpG = 2.0f * sat * fSatG + (1.0f - sat);
            var fTmpB = 2.0f * sat * fSatB + (1.0f - sat);

            float fR, fG, fB;

            if (brightness < 0.5f)
            {
                fR = brightness * fTmpR;
                fG = brightness * fTmpG;
                fB = brightness * fTmpB;
            }
            else
            {
                fR = (1.0f - brightness) * fTmpR + 2.0f * brightness - 1.0f;
                fG = (1.0f - brightness) * fTmpG + 2.0f * brightness - 1.0f;
                fB = (1.0f - brightness) * fTmpB + 2.0f * brightness - 1.0f;
            }
            //
            // Color.Value.X = brightness;
            // Color.Value.Y = fG;
            // Color.Value.Z = fB;
            Color.Value = new Vector4(fR, fG, fB, Alpha.GetValue(context));
            //Color.Value = new Vector4(hue, sat, brightness, Alpha.GetValue(context));
        }
        /// <summary>
        /// Returns true if ImageAdjustParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of ImageAdjustParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ImageAdjustParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     FileId == input.FileId ||
                     (FileId != null &&
                      FileId.Equals(input.FileId))
                     ) &&
                 (
                     PageRange == input.PageRange ||
                     (PageRange != null &&
                      PageRange.Equals(input.PageRange))
                 ) &&
                 (
                     RoiLeft == input.RoiLeft ||
                     RoiLeft.Equals(input.RoiLeft)
                 ) &&
                 (
                     RoiTop == input.RoiTop ||
                     RoiTop.Equals(input.RoiTop)
                 ) &&
                 (
                     RoiWidth == input.RoiWidth ||
                     RoiWidth.Equals(input.RoiWidth)
                 ) &&
                 (
                     RoiHeight == input.RoiHeight ||
                     RoiHeight.Equals(input.RoiHeight)
                 ) &&
                 (
                     GammaCorrection == input.GammaCorrection ||
                     GammaCorrection.Equals(input.GammaCorrection)
                 ) &&
                 (
                     Brightness == input.Brightness ||
                     Brightness.Equals(input.Brightness)
                 ) &&
                 (
                     Contrast == input.Contrast ||
                     Contrast.Equals(input.Contrast)
                 ) &&
                 (
                     Saturation == input.Saturation ||
                     Saturation.Equals(input.Saturation)
                 ) &&
                 (
                     AutoContrastEnhancement == input.AutoContrastEnhancement ||
                     AutoContrastEnhancement.Equals(input.AutoContrastEnhancement)
                 ) &&
                 (
                     ContrastHistogramStretch == input.ContrastHistogramStretch ||
                     ContrastHistogramStretch.Equals(input.ContrastHistogramStretch)
                 ));
        }
Exemple #12
0
 public PicBACWindow(BitmapSource bs)
 {
     InitializeComponent();
     this.bs             = bs;
     Content.DataContext = picBACControl;
     Brightness.AddHandler(Slider.MouseLeftButtonUpEvent, new MouseButtonEventHandler(Slider_MouseLeftButtonUp), true);
     Contrast.AddHandler(Slider.MouseLeftButtonUpEvent, new MouseButtonEventHandler(Slider_MouseLeftButtonUp), true);
 }
Exemple #13
0
        public async Task <Brightness> GetBrightnessInfo()
        {
            var response = await _nanoleafHttpClient.SendGetRequest("state/brightness");

            Brightness brightnessInfo = JsonConvert.DeserializeObject <Brightness>(response);

            return(brightnessInfo);
        }
Exemple #14
0
        //*************************
        //       Initiazlier
        //*************************
        //Initalizer
        //Generate Initial Values
        private void ValueIntializer()
        {
            short value = (short)brightnessTrack.Value;

            Brightness.SetBrightness((byte)value);
            brightnessLabel.Text = value.ToString();
            systemTime.Text      = DateTime.Now.ToString("hh:mm:ss tt");
        }
Exemple #15
0
        private IActionResult CreateRandomBrightnessLikeMessage(int min, int max)
        {
            var message = new Brightness {
                Value = _faker.Random.Int(min, max), Max = max, Min = min
            };

            return(Ok(message));
        }
        public override XmlNode SerializeToXML(XmlDocument xdoc)
        {
            XmlNode xn = base.SerializeToXML(xdoc);

            xn.Attributes.Append(xdoc.CreateAttribute("Brightness")).Value = Brightness.ToString(nfi);
            xn.Attributes.Append(xdoc.CreateAttribute("Normalize")).Value  = Normalize.ToString();
            return(xn);
        }
    void Start()
    {
        _controllerManager     = GameManager.controllerManager;
        _brightness            = GameManager.brightness;
        _postProcessingManager = GameManager.postProcessingManager;

        CreateSupportedResolutionOptions();
        SetIndexValues();
    }
 /// <summary>
 /// Adjusts brightness modifying all channels of RGB color space
 /// </summary>
 private static void AdjustLightnessRgb()
 {
     using (var reader = ImageReader.Create("../../../../_Input/Chicago.jpg"))
         using (var brightness = new Brightness(brightnessAmount))
             using (var writer = ImageWriter.Create("../../../../_Output/AdjustLightnessRgb.jpg"))
             {
                 Pipeline.Run(reader + brightness + writer);
             }
 }
Exemple #19
0
        public static async Task Main(string[] args)
        {
            configService.Init();
            ConfigOptions options = configService.GetConfig();

            Console.WriteLine("# SMART Led Lights Controller");
            Console.WriteLine("  - Base URL: " + options.LightsUrl);
            Console.WriteLine();

            // Login
            Authentication auth         = new Authentication(options.LightsUrl);
            LoginResponse  authResponse = auth.Login();

            if (!auth.Verify(authResponse))
            {
                Console.WriteLine(Environment.NewLine + "Press Any Key to exit!");
                Console.Read();
            }

            // Setup Mode
            Mode modeService = new Mode(options.LightsUrl);

            modeService.GetMode(authResponse);
            modeService.SetMode(authResponse, "rt");
            RealTime realTimeMode = new RealTime(options.LightsUrl, 7777, options.LedCount, options.IsRGBWSet);

            // Setup Brightness
            Brightness brightness = new Brightness(options.LightsUrl);

            brightness.GetBrightness(authResponse);
            brightness.SetBrightness(authResponse, 100);

            switch (options.Mode)
            {
            case 1:     // A Demo Mode
                CarolDemoMode carolDemoMode = new CarolDemoMode(options.LedCount, options.IsRGBWSet, realTimeMode);
                Console.Read();
                Task t = carolDemoMode.Run(authResponse);
                t.Wait();
                break;

            case 2:     // Flash each LED to allow mapping
                MapLinesMode mapTreeLightsMode = new MapLinesMode(options.LedCount, realTimeMode);
                Console.Read();
                Task t2 = mapTreeLightsMode.Run(authResponse);
                t2.Wait();
                break;
            }

            // Reset when done.
            modeService.SetMode(authResponse, "movie");
            brightness.SetBrightness(authResponse, 80);

            Console.WriteLine(Environment.NewLine + "Press Any Key to exit!");

            Console.Read();
        }
Exemple #20
0
 /// <summary>
 /// Adjusts brightness using memory-friendly Pipeline API
 /// </summary>
 private static void BrightnessMemoryFriendly()
 {
     using (var reader = ImageReader.Create("../../../../_Input/Chicago.jpg"))
         using (var brightness = new Brightness(0.1f))
             using (var writer = ImageWriter.Create("../../../../_Output/BrightnessMemoryFriendly.jpg"))
             {
                 Pipeline.Run(reader + brightness + writer);
             }
 }
Exemple #21
0
        private void defaultTimer_Tick(object sender, EventArgs e)
        {
            short  value             = (short)brightnessTrack.Value;
            string currentBrightness = value.ToString();

            Brightness.SetBrightness((byte)value);
            brightnessLabel.Text      = currentBrightness;
            currentBrightnessLbl.Text = "Current Brightness: " + brightnessLabel.Text;
        }
 void Start()
 {
     vignette         = Camera.main.GetComponent <VignetteAndChromaticAberration>();
     originalVignette = vignette.intensity;
     originalBlur     = vignette.blur;
     originalDistance = vignette.blurDistance;
     brightness       = Camera.main.GetComponent <Brightness>();
     //DoPause();
     UnPause();
 }
Exemple #23
0
        /// <summary>
        /// Processes the image.
        /// </summary>
        /// <param name="factory">
        /// The the current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class containing
        /// the image to process.
        /// </param>
        /// <param name="image">The current image to process</param>
        /// <param name="newImage">The new Image to return</param>
        /// <returns>
        /// The processed image from the current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public Image TransformImage(ImageFactory factory, Image image, Image newImage)
        {
            using (Graphics graphics = Graphics.FromImage(newImage))
            {
                using (ImageAttributes attributes = new ImageAttributes())
                {
                    attributes.SetColorMatrix(this.Matrix);

                    Rectangle rectangle = new Rectangle(0, 0, image.Width, image.Height);

                    graphics.DrawImage(image, rectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, attributes);

                    // Overlay the image with some semi-transparent colors to finish the effect.
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddRectangle(rectangle);

                        // Paint a burgundy rectangle with a transparency of ~30% over the image.
                        // Paint a blue rectangle with a transparency of 20% over the image.
                        using (SolidBrush brush = new SolidBrush(Color.FromArgb(77, 38, 14, 28)))
                        {
                            Region oldClip = graphics.Clip;
                            graphics.Clip = new Region(rectangle);
                            graphics.FillRectangle(brush, rectangle);

                            // Fill the blue.
                            brush.Color = Color.FromArgb(51, 29, 32, 59);
                            graphics.FillRectangle(brush, rectangle);
                            graphics.Clip = oldClip;
                        }
                    }
                }
            }

            // Add brightness and contrast to finish the effect.
            factory.Update(newImage);
            Brightness brightness = new Brightness {
                DynamicParameter = 5
            };

            newImage = (Bitmap)brightness.ProcessImage(factory);

            factory.Update(newImage);
            Contrast contrast = new Contrast {
                DynamicParameter = 85
            };

            newImage = (Bitmap)contrast.ProcessImage(factory);

            // Reassign the image.
            image.Dispose();
            image = newImage;

            return(image);
        }
Exemple #24
0
    private void Start()
    {
        _brightness           = GameManager.brightness;
        _controllerManager    = GameManager.controllerManager;
        _audioSettingsManager = GameManager.audioSettingsManager;

        _optionButtons     = _optionsPanel.GetComponentsInChildren <Button>();
        _audioSliders      = _audioPanel.GetComponentsInChildren <Slider>();
        _videoButtons      = _videoPanel.GetComponentsInChildren <Button>();
        _controlButton     = _controlsPanel.GetComponentInChildren <Button>();
        _instructionButton = _instructionsPanel.GetComponentInChildren <Button>();
    }
Exemple #25
0
        /// <summary>
        /// シークバーのプログレスチェンジイベント
        /// </summary>
        /// <param name="s">オブジェクト</param>
        /// <param name="e">イベントのデータ</param>
        private async void OnProgressChanged(object s, SeekBar.ProgressChangedEventArgs e)
        {
            var textViewAlphaValue = (TextView)FindViewById(Resource.Id.alpha_value);

            textViewAlphaValue.Text = e.Progress.ToString() + " %";
            var brightness    = new Brightness();
            var mutableBitmap = await Task.Run(() => brightness.GoImageProcessing(mBitmap, e.Progress));

            var imageView = (ImageView)FindViewById(Resource.Id.image);

            imageView.SetImageBitmap(mutableBitmap.Copy(Bitmap.Config.Argb8888, false));
        }
Exemple #26
0
        /// <summary>
        /// 设置遮罩亮度
        /// </summary>
        private void setBrightness()
        {
            for (var i = 0; i < this._shades.Count; i++)
            {
                this._shades[i].AdjustBrightness(Common.Config.Monitors[i].Alpha);
            }

            if (this.ckxAlpha.Checked) // TODO:收集屏幕亮度,未实现单屏亮度收集
            {
                Brightness.Save(Common.Config.Alpha);
            }
        }
Exemple #27
0
            /// <summary>
            /// Invokes the Lighting Brightness event.
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public static float InvokeBrightness(int x, int y)
            {
                var args = new LightingBrightnessEventArgs
                {
                    X          = x,
                    Y          = y,
                    Brightness = 0.0f
                };

                Brightness.Invoke(args);
                return(args.Handled ? args.Brightness : -1.0f);
            }
Exemple #28
0
 //Attempt to change brightness;
 private void Awake()
 {
     if (lights)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         lights = this;
     }
 }
Exemple #29
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ColorInfo" /> struct.
        /// </summary>
        /// <param name="color">The color.</param>
        public ColorInfo(Color color) : this()
        {
            Color = color;
            Count = 1;

            Hue        = color.GetHue();
            Saturation = color.GetSaturation();
            Brightness = color.GetBrightness();

            HueHashCode        = Hue.GetHashCode();
            SaturationHashCode = Saturation.GetHashCode();
            BrightnessHashCode = Brightness.GetHashCode();
        }
        public void TestBrightnessRegex()
        {
            const string Querystring = "brightness=56";
            const int    Expected    = 56;

            Brightness brightness = new Brightness();

            brightness.MatchRegexIndex(Querystring);

            int actual = brightness.DynamicParameter;

            Assert.AreEqual(Expected, actual);
        }
 void BrightnessThread()
 {
     while (true)
     {
         myBrightnessSamples[myCurrentSample++] = GetLumens();
         myCurrentSample %= myBrightnessSamples.Length;
         Brightness currentBrightness = CalculateBrightness();
         if (currentBrightness != myBrightness)
         {
             myBrightness = currentBrightness;
             InvokeSensorMessage();
         }
         Thread.Sleep(1000);
     }
 }
	public static void ObjectSetup (GameObject go, VectorLine line, Visibility visibility, Brightness brightness) {
		if (visibility == Visibility.Dynamic) {
			VisibilityControl vc = go.AddComponent(typeof(VisibilityControl)) as VisibilityControl;
			vc.Setup(line);
		}
		else if (visibility == Visibility.Static) {
			VisibilityControlStatic vcs = go.AddComponent(typeof(VisibilityControlStatic)) as VisibilityControlStatic;
			vcs.Setup(line);
		}
		else if (visibility == Visibility.Always) {
			VisibilityControlAlways vca = go.AddComponent(typeof(VisibilityControlAlways)) as VisibilityControlAlways;
			vca.Setup(line);
		}
		if (brightness == Brightness.Fog) {
			BrightnessControl bc = go.AddComponent(typeof(BrightnessControl)) as BrightnessControl;
			bc.Setup(line);
		}
		if (visibility >= Visibility.NotControlled && brightness >= Brightness.Normal) {
			Debug.LogWarning ("VectorManager: Nothing to do for " + line.vectorObject.name + " in ObjectSetup");
		}
	}
 /// <summary>
 /// Sets the backlight brightness to the given level
 /// </summary>
 /// <param name="brightness">
 /// The level to set the backlight brightness
 /// </param>
 public virtual void SetBacklightBrightness(Brightness brightness)
 {
     DecoratedSerialLcd.SetBacklightBrightness(brightness);
 }
Exemple #34
0
 void Start()
 {
     vignette = Camera.main.GetComponent<VignetteAndChromaticAberration>();
     originalVignette = vignette.intensity;
     originalBlur = vignette.blur;
     originalDistance = vignette.blurDistance;
     brightness = Camera.main.GetComponent<Brightness>();
     DoPause();
 }
        public SPI_VFDisplay(SPI.SPI_module spiBus, Cpu.Pin latchPin, Brightness brightness)
        {
            var spiConfig = new SPI.Configuration(
                Cpu.Pin.GPIO_NONE, //latchPin,
                false, // active state
                0,     // setup time
                0,     // hold time
                false, // clock idle state
                true,  // clock edge
                1000,   // clock rate
                spiBus);

            _spi = new SPI(spiConfig);

            _latchPort = new OutputPort(latchPin, true);

            //default to 2x20 display (SAMSUNG 20T202DA2JA)
            begin(20, 2, brightness);
        }
        public void setBrightness(Brightness brightness)
        {
            // set the brightness (only if a valid value is passed
            if (brightness <= Brightness.VFD_BRIGHTNESS25)
            {
                _brightness = (byte)brightness;

                command((byte)(VFD_FUNCTIONSET | _brightness | _linemode));
            }
        }
        public void begin(byte columns, byte lines, Brightness brightness)
        {
            // set number of lines
            if (lines > 1)
                _linemode = VFD_2LINE;
            else
                _linemode = VFD_1LINE;
            // save off for address translation
            _numlines = lines;

            // turn the display on with no cursor or blinking default
            _displaycontrol = VFD_DISPLAYON;
            _cursormode = VFD_CURSOROFF;
            _blinkmode = VFD_BLINKOFF;
            _shiftmode = VFD_ENTRYLEFT;
            _incrementmode = VFD_ENTRYSHIFTDECREMENT;
            // init the display
            display();

            //catch bad values
            if (brightness > Brightness.VFD_BRIGHTNESS25)
                _brightness = (byte)Brightness.VFD_BRIGHTNESS100;
            else
                _brightness = (byte)brightness;
            // set the brightness and push the linecount with VFD_SETFUNCTION
            setBrightness(brightness);

            // set cursor shift for romance lnaguages
            leftToRight();

            // clear the display
            clear();
            // set starting address to column 0, row 0
            home();
        }
	void Awake()
	{
		message = GameObject.FindGameObjectWithTag ("UI").transform.GetChild(0).GetComponent<Text> ();
		inventory = GameObject.FindGameObjectWithTag ("UI").transform.GetChild (1).GetComponent<PlayerInventory> ();
		brightness = GameObject.FindGameObjectWithTag ("Light").GetComponent<Brightness> ();
	}
 /// <summary>
 /// Sets the backlight brightness to the given level
 /// </summary>
 /// <param name="brightness">
 /// The level to set the backlight brightness
 /// </param>
 public void SetBacklightBrightness(Brightness brightness)
 {
     SendCommand(Commands.SetBacklightBrightness, (byte)brightness);
 }
Exemple #40
0
 public void SetBrightnessLimit(Brightness brightness)
 {
     BrightnessLimit = m_brightnessValue[brightness];
 }
 public static void ObjectSetup(GameObject go, VectorLine line, Visibility visibility, Brightness brightness)
 {
     ObjectSetup (go, line, visibility, brightness, true);
 }
        /// <summary>
        /// Brightness algorithm. Here we create a new window from where we implement the algorithm.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void brightness_Click(object sender, RoutedEventArgs e) {
            if (m_data.M_inputFilename == string.Empty || m_data.M_bitmap == null) {
                MessageBox.Show("Open image first!", "ArgumentsNull", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            try {
                Brightness brightness1 = new Brightness(m_data, m_vm);
                brightness1.Owner = this;
                brightness1.Show();
            } catch (FileNotFoundException ex) {
                MessageBox.Show(ex.Message, "FileNotFoundException", MessageBoxButton.OK, MessageBoxImage.Error);
            } catch (ArgumentException ex) {
                MessageBox.Show(ex.Message, "ArgumentException", MessageBoxButton.OK, MessageBoxImage.Error);
            } catch (InvalidOperationException ex) {
                MessageBox.Show(ex.Message, "InvalidOperationException", MessageBoxButton.OK, MessageBoxImage.Error);
            } catch (IndexOutOfRangeException ex) {
                MessageBox.Show(ex.Message, "IndexOutOfRangeException", MessageBoxButton.OK, MessageBoxImage.Error);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 /// <summary>
 /// Sets the backlight brightness to the given level
 /// </summary>
 /// <param name="brightness">
 /// The level to set the backlight brightness
 /// </param>
 public void SetBacklightBrightness(Brightness brightness)
 {
 }
    public static void ObjectSetup(GameObject go, VectorLine line, Visibility visibility, Brightness brightness, bool makeBounds)
    {
        var vc = go.GetComponent(typeof(VisibilityControl)) as VisibilityControl;
        var vcs = go.GetComponent(typeof(VisibilityControlStatic)) as VisibilityControlStatic;
        var vca = go.GetComponent(typeof(VisibilityControlAlways)) as VisibilityControlAlways;
        var bc = go.GetComponent(typeof(BrightnessControl)) as BrightnessControl;

        if (visibility == Visibility.None) {
            if (vc) {
                MonoBehaviour.Destroy(vc);
            }
            if (vcs) {
                MonoBehaviour.Destroy(vcs);
            }
            if (vca) {
                MonoBehaviour.Destroy(vca);
            }
        }
        if (visibility == Visibility.Dynamic) {
            if (vc == null) {
                vc = go.AddComponent (typeof(VisibilityControl)) as VisibilityControl;
                vc.Setup (line, makeBounds);
                if (bc != null) {
                    bc.SetUseLine(false);
                }
            }
        }
        else if (visibility == Visibility.Static) {
            if (vcs == null) {
                vcs = go.AddComponent (typeof(VisibilityControlStatic)) as VisibilityControlStatic;
                vcs.Setup (line, makeBounds);
                if (bc != null) {
                    bc.SetUseLine(false);
                }
            }
        }
        else if (visibility == Visibility.Always) {
            if (vca == null) {
                vca = go.AddComponent (typeof(VisibilityControlAlways)) as VisibilityControlAlways;
                vca.Setup (line);
                if (bc != null) {
                    bc.SetUseLine(false);
                }
            }
        }
        if (brightness == Brightness.Fog) {
            if (bc == null) {
                bc = go.AddComponent (typeof(BrightnessControl)) as BrightnessControl;
                if (vc == null && vcs == null && vca == null) {
                    bc.Setup (line, true);
                }
                else {
                    bc.Setup (line, false);
                }
            }
        }
        else {
            if (bc) {
                MonoBehaviour.Destroy (bc);
            }
        }
    }
        /// <summary>
        /// Alters the brightness component of the image.
        /// </summary>
        /// <param name="source">The image this method extends.</param>
        /// <param name="amount">The new brightness of the image. Must be between -100 and 100.</param>
        /// <param name="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image"/>.</returns>
        public static Image Brightness(this Image source, int amount, Rectangle rectangle, ProgressEventHandler progressHandler = null)
        {
            Brightness processor = new Brightness(amount);
            processor.OnProgress += progressHandler;

            try
            {
                return source.Process(rectangle, processor);
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }