Пример #1
0
        private void SetTextStyle(TextView view)
        {
            if (view.Handle == IntPtr.Zero)
            {
                return;
            }
            if (Font.Size > 0)
            {
                view.SetTextSize(ComplexUnitType.Sp, (float)Font.Size);
            }

            if (!string.IsNullOrEmpty(Font.Name))
            {
                var format = (Android.Graphics.TypefaceStyle)Font.Formatting;
                view.SetTypeface(Android.Graphics.Typeface.Create(Font.Name, format), format);
            }

            if (!ForegroundColor.IsDefaultColor)
            {
                view.SetTextColor(ForegroundColor.ToColor());
            }

            if (!BackgroundColor.IsDefaultColor)
            {
                view.SetBackgroundColor(BackgroundColor.ToColor());
            }
        }
Пример #2
0
        public void Deselect()
        {
            SetBackgroundColor(BackgroundColor.ToColor());
            var labels = Children.OfType <ILabel>().Select(f => DroidFactory.GetNativeObject <Label>(f, "label"));

            foreach (var label in labels)
            {
                label.SetTextColor(label.ForegroundColor.ToColor());
            }
        }
Пример #3
0
        /// <summary>
        /// Reads the specified string as HTML and loads the result in the browser.
        /// </summary>
        /// <param name="htmlContent">The HTML content to load into an empty DOM.</param>
        public void LoadContent(string htmlContent)
        {
            ErrorOccured = false;
            if (htmlContent == null)
            {
                return;
            }
            var          backgroundColor = BackgroundColor.IsDefaultColor ? "background:transparent;" : "background:" + "#" + BackgroundColor.HexCode.Substring(3) + ";";
            var          textColor       = ";color:" + (ForegroundColor.IsDefaultColor ? "#000" : "#" + ForegroundColor.HexCode.Substring(3));
            const string body            = "<html><head><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\"/></head><body style=\"-webkit-text-size-adjust:none;{0}margin:10px 15px 15px;font-family:helvetica,arial,sans-serif;font-size:16{1}\">{2}</body></html>";

            LoadDataWithBaseURL(iApp.Factory.ApplicationPath, string.Format(body, backgroundColor, textColor, htmlContent), "text/html", "utf-8", null);
            SetBackgroundColor(BackgroundColor.ToColor());
        }
Пример #4
0
        private void UpdateColors()
        {
            if (BackgroundColor != Colors.Transparent)
            {
                Renderer.BackgroundColor = BackgroundColor.ToColor();
            }
            else
            {
                OnPropertyChanged(nameof(BackgroundColor));
            }

            if (LightColor != Colors.Transparent)
            {
                Renderer.LightColor = LightColor.ToColor();
            }
            else
            {
                OnPropertyChanged(nameof(LightColor));
            }

            if (AmbientDownColor != Colors.Transparent)
            {
                Renderer.AmbientDown = AmbientDownColor.ToColor();
            }
            else
            {
                OnPropertyChanged(nameof(AmbientDownColor));
            }

            if (AmbientUpColor != Colors.Transparent)
            {
                Renderer.AmbientUp = AmbientUpColor.ToColor();
            }
            else
            {
                OnPropertyChanged(nameof(AmbientUpColor));
            }
        }
Пример #5
0
            public DarkPreviewsOptions ToPreviewsOptions(bool keepChecksum)
            {
                var light = MathF.ToVector3Deg(Lightθ, Lightφ);

                return(new DarkPreviewsOptions {
                    AmbientDown = AmbientDownColor.ToColor(),
                    AmbientUp = AmbientUpColor.ToColor(),
                    BackgroundColor = BackgroundColor.ToColor(),
                    LightColor = LightColor.ToColor(),
                    UseMsaa = MsaaMode != 0,
                    MsaaSampleCount = MsaaMode,
                    SsaaMultiplier = Math.Sqrt(SsaaMode),
                    ShadowMapSize = ShadowMapSize,
                    Showroom = ShowroomId,
                    ColorGradingData = UseColorGrading ? ColorGradingData : null,
                    UseCustomReflectionCubemap = UseCustomReflectionCubemap,
                    CustomReflectionCubemapData = UseCustomReflectionCubemap ? CustomReflectionCubemapData : null,
                    CustomReflectionBrightness = CustomReflectionBrightness,
                    CubemapAmbient = CubemapAmbient,
                    CubemapAmbientWhite = CubemapAmbientWhite,
                    EnableShadows = EnableShadows,
                    AnyGround = AnyGround,
                    FlatMirror = FlatMirror,
                    UseBloom = UseBloom,
                    FlatMirrorBlurred = FlatMirrorBlurred,
                    FlatMirrorBlurMuiltiplier = FlatMirrorBlurMuiltiplier,
                    UseDither = UseDither,
                    UseColorGrading = UseColorGrading,
                    UseFxaa = UseFxaa,
                    UseSmaa = UseSmaa,
                    UsePcss = UsePcss,
                    UseAo = UseAo,
                    AoType = AoType,
                    UseSslr = UseSslr,
                    ToneMapping = ToneMapping,
                    ReflectionCubemapAtCamera = ReflectionCubemapAtCamera,
                    ReflectionsWithShadows = ReflectionsWithShadows,
                    ReflectionsWithMultipleLights = ReflectionsWithMultipleLights,
                    AmbientBrightness = AmbientBrightness,
                    BackgroundBrightness = BackgroundBrightness,
                    FlatMirrorReflectiveness = FlatMirrorReflectiveness,
                    FlatMirrorReflectedLight = FlatMirrorReflectedLight,
                    LightBrightness = LightBrightness,
                    LightDirection = new double[] { light.X, light.Y, light.Z },
                    MaterialsReflectiveness = MaterialsReflectiveness,
                    CarShadowsOpacity = CarShadowsOpacity,
                    ToneExposure = ToneExposure,
                    ToneGamma = ToneGamma,
                    ToneWhitePoint = ToneWhitePoint,
                    PcssSceneScale = PcssSceneScale,
                    PcssLightScale = PcssLightScale,
                    BloomRadiusMultiplier = BloomRadiusMultiplier,
                    AoOpacity = AoOpacity,
                    AoRadius = AoRadius,
                    UseDof = UseDof,
                    DofFocusPlane = DofFocusPlane,
                    DofScale = DofScale,
                    UseAccumulationDof = UseAccumulationDof,
                    AccumulationDofBokeh = AccumulationDofBokeh,
                    AccumulationDofIterations = AccumulationDofIterations,
                    AccumulationDofApertureSize = AccumulationDofApertureSize,
                    PreviewWidth = Width,
                    PreviewHeight = Height,
                    SoftwareDownsize = SoftwareDownsize,
                    AlignCar = AlignCar,
                    AlignCameraHorizontally = AlignCameraHorizontally,
                    AlignCameraVertically = AlignCameraVertically,
                    AlignCameraHorizontallyOffsetRelative = AlignCameraHorizontallyOffsetRelative,
                    AlignCameraVerticallyOffsetRelative = AlignCameraVerticallyOffsetRelative,
                    HeadlightsEnabled = HeadlightsEnabled,
                    BrakeLightsEnabled = BrakeLightsEnabled,
                    LeftDoorOpen = LeftDoorOpen,
                    RightDoorOpen = RightDoorOpen,
                    ShowDriver = ShowDriver,
                    CameraPosition = CameraPosition,
                    CameraLookAt = CameraLookAt,
                    CameraTilt = CameraTilt,
                    CameraFov = CameraFov,
                    AlignCameraHorizontallyOffset = AlignCameraHorizontallyOffset,
                    AlignCameraVerticallyOffset = AlignCameraVerticallyOffset,
                    SteerDeg = SteerDeg,
                    TryToGuessCarLights = TryToGuessCarLights,
                    LoadCarLights = LoadCarLights,
                    LoadShowroomLights = LoadShowroomLights,
                    DelayedConvertation = false,
                    MeshDebugMode = false,
                    SuspensionDebugMode = false,
                    PreviewName = FileName,
                    WireframeMode = false,
                    SerializedLights = ExtraLights != null ? new JArray(ExtraLights.OfType <object>()).ToString() : null,
                    ExtraActiveAnimations = ExtraActiveAnimations,
                    // FixedChecksum = keepChecksum ? Checksum : null
                });
            }
Пример #6
0
            /// <summary>
            /// Convert to DarkPreviewsOptions.
            /// </summary>
            /// <param name="keepChecksum">Set to True if you’re loading existing preset and want checksum to be
            /// independent from any future format changes; otherwise, for actual checksum, set to False.</param>
            /// <returns>Instance of DarkPreviewsOptions.</returns>
            public DarkPreviewsOptions ToPreviewsOptions(bool keepChecksum)
            {
                var light = GetLightDirection(Lightθ, Lightφ);

                return(new DarkPreviewsOptions {
                    AmbientDown = AmbientDownColor.ToColor(),
                    AmbientUp = AmbientUpColor.ToColor(),
                    BackgroundColor = BackgroundColor.ToColor(),
                    LightColor = LightColor.ToColor(),

                    UseMsaa = MsaaMode != 0,
                    MsaaSampleCount = MsaaMode,
                    SsaaMultiplier = Math.Sqrt(SsaaMode),
                    ShadowMapSize = ShadowMapSize,

                    Showroom = ShowroomId,
                    ColorGradingData = UseColorGrading ? ColorGradingData : null,

                    CubemapAmbient = CubemapAmbient,
                    CubemapAmbientWhite = CubemapAmbientWhite,
                    EnableShadows = EnableShadows,
                    FlatMirror = FlatMirror,
                    UseBloom = UseBloom,
                    FlatMirrorBlurred = FlatMirrorBlurred,
                    UseColorGrading = UseColorGrading,
                    UseFxaa = UseFxaa,
                    UseSmaa = UseSmaa,
                    UsePcss = UsePcss,
                    UseAo = UseAo,
                    AoType = AoType,
                    UseSslr = UseSslr,
                    ToneMapping = ToneMapping,
                    ReflectionCubemapAtCamera = ReflectionCubemapAtCamera,
                    ReflectionsWithShadows = ReflectionsWithShadows,

                    AmbientBrightness = AmbientBrightness,
                    BackgroundBrightness = BackgroundBrightness,
                    FlatMirrorReflectiveness = FlatMirrorReflectiveness,
                    LightBrightness = LightBrightness,
                    LightDirection = new double[] { light.X, light.Y, light.Z },
                    MaterialsReflectiveness = MaterialsReflectiveness,
                    ToneExposure = ToneExposure,
                    ToneGamma = ToneGamma,
                    ToneWhitePoint = ToneWhitePoint,

                    PcssSceneScale = PcssSceneScale,
                    PcssLightScale = PcssLightScale,
                    BloomRadiusMultiplier = BloomRadiusMultiplier,
                    SsaoOpacity = SsaoOpacity,

                    PreviewWidth = Width,
                    PreviewHeight = Height,

                    SoftwareDownsize = SoftwareDownsize,
                    AlignCar = AlignCar,
                    AlignCameraHorizontally = AlignCameraHorizontally,
                    AlignCameraVertically = AlignCameraVertically,
                    AlignCameraHorizontallyOffsetRelative = AlignCameraHorizontallyOffsetRelative,
                    AlignCameraVerticallyOffsetRelative = AlignCameraVerticallyOffsetRelative,
                    HeadlightsEnabled = HeadlightsEnabled,
                    BrakeLightsEnabled = BrakeLightsEnabled,
                    LeftDoorOpen = LeftDoorOpen,
                    RightDoorOpen = RightDoorOpen,
                    ShowDriver = ShowDriver,

                    CameraPosition = CameraPosition,
                    CameraLookAt = CameraLookAt,

                    CameraFov = CameraFov,
                    AlignCameraHorizontallyOffset = AlignCameraHorizontallyOffset,
                    AlignCameraVerticallyOffset = AlignCameraVerticallyOffset,
                    SteerDeg = SteerDeg,

                    DelayedConvertation = false,
                    MeshDebugMode = false,
                    SuspensionDebugMode = false,
                    PreviewName = "preview.jpg",
                    WireframeMode = false,

                    FixedChecksum = keepChecksum ? Checksum : null
                });
            }