标签: opacity

Firefox Opacity(Transparancy)Gradient - 淡出图像

我有一个内容元素.

元素 - 包含其内容 - 应在左侧完全不透明,在右侧完全透明.从右到左均匀分级.

由于它合并的内容和背景不固定,因此无法提前制作图像.

我知道渐变可以用作背景(-moz-linear-gradient),但这对我没有帮助 - 在这里,我需要元素本身的内容淡出.

我已经能够在IE(Alpha Mask)和Webkit(图像掩码)中做到这一点,但已经完全陷入了FF.

如果有办法,我不介意使用SVG.

请帮忙?

css firefox transparency gradient opacity

6
推荐指数
1
解决办法
3073
查看次数

Graphics.DrawString指定文本的不透明度

是否可以指定使用该Graphics.DrawString方法编写的文本的不透明度?

我正在做这样的事情,但如果可能的话,我希望我的文字是半透明的.

目前我这样做:

Graphics graphics = Graphics.FromImage(image);
graphics.DrawString("This is a watermark", 
    new Font("Arial", 40), 
    new SolidBrush(Color.Red), 
    0, 
    0);
Run Code Online (Sandbox Code Playgroud)

c# graphics drawing opacity

6
推荐指数
1
解决办法
1万
查看次数

TextBlock画笔给出不正确的颜色

我有一个TextBlock和一个Rectangle,它们都位于一个空的WPF4窗口中.TextBlock的Foreground和Rectangle的Fill都设置为值为#80800000的SolidColorBrush.

这就是它的样子:

在此输入图像描述

Rectangle的颜色是正确的(50%透明栗色),但TextBlock呈现平坦的灰色.这是怎么回事?

编辑:这是XAML:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBlock Foreground="#80800000" Height="100" HorizontalAlignment="Left" Margin="47,39,0,0" Text="TextBlock" VerticalAlignment="Top" Width="266" FontFamily="Arial" FontWeight="Bold" FontSize="56" />
        <Rectangle Fill="#80800000" Height="100" HorizontalAlignment="Left" Margin="71,174,0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="200" />
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

wpf alpha brush textblock opacity

6
推荐指数
1
解决办法
816
查看次数

如何在透明div上设置html输入字段透明?

我有一个div设置透明与rgba并希望在该div上输入字段也具有透明背景.问题是输入字段背景不呈现透明.如果我opacity:0.8;在div上使用它,但是文本是透明的,那么它是有效的,所以我需要rgba.对于透明div rgba工作之外的第二个输入字段.

这是我的示例代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Insert title here</title>

<style type="text/css">

.term {
background-color: rgba(0,0,0,0.8);
color: #5fba3d;
width: 200px;
height: 100px;
}

input {
background-color: rgba(0,0,0,0.8);
color: #FFF;
border: none;
}

</style>

</head>

<body>

<div style="background-color:yellow; width:300px;">

   <div class="term">
      Input 1 <input type="text" value="Test" />
   </div>

   <br />

   <input type="text" value="Input 2" />

</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

谢谢!

拿但业

css html-input opacity css3 rgba

6
推荐指数
2
解决办法
4万
查看次数

想要改变NSPopover的不透明度 - 是否可能?

我有NSPopover一个Cocoa应用程序,并且自狮子 - 它呈现为半透明,所以它覆盖的任何文本字段,表格等 - 这些现在显示在它下面,它看起来很奇怪.我检查了Apple的类引用文档,但似乎没有办法将其更改为不透明.似乎可用于指定外观的唯一两个属性值是NSPopoverAppearanceMinimal,和NSPopoverAppearanceHUD- 但这些值似乎都与alpha或不透明度无关.NSPopover通过覆盖drawRect 来制作不透明的唯一方法是什么?还是有人知道更好的方法吗?它似乎适用UIPopover于iOS,但不适NSPopover用于Cocoa ......

cocoa opacity nspopover

6
推荐指数
1
解决办法
1912
查看次数

C#中的衰落控制

我想构建一个Control支持Opcacity属性的派生类.
这个控件既可以托管文本也可以托管图像,并且可以将它们淡出和放入.
这是我的代码:

internal class FadeControl : Control
{
    private int opacity = 100;

    public FadeControl()
    {
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);
    }

    public int Opacity
    {
        get
        {
            return opacity;
        }
        set
        {
            if (value > 100) opacity = 100;
            else if (value < 1) opacity = 1;
            else opacity = value;

            if (Parent != null)
                Parent.Invalidate(Bounds, true);
        }
    }

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle = cp.ExStyle | 0x20;
            return cp; …
Run Code Online (Sandbox Code Playgroud)

c# controls opacity fading

6
推荐指数
1
解决办法
3429
查看次数

如何使文字最终淡出渐变背景?

我已经有了一个以图像为背景的元素.是否有可能使文本最终淡出,就像在这个例子中一样

问题是背景图像已经有了渐变,我需要它上面的文字才能变得透明而不需要在后台进行任何修改.

css opacity fadeout

6
推荐指数
1
解决办法
5202
查看次数

如何制作::选择背景不透明度:1?

这可能吗?我希望所选文本具有纯色背景,而不是透明背景.opacity: 1不这样做是因为必须有来自浏览器的标准覆盖(或类似的东西).

::-moz-selection {
  background: #fff;
  color: #000;
}

::selection {
  background: #fff;
  color: #000;
}

body {
  color: #fff;
  font-family: sans-serif;
  line-height: 2em;
}

div {
  padding: 2em;
  background: #F8372A;
  text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
<div>
  <h1>HEY!</h1>
  <p>why is my background not<br/><strong>STARK WHITE</strong><br/>when selected?</p>
</div>
Run Code Online (Sandbox Code Playgroud)

html css background selection opacity

6
推荐指数
1
解决办法
2310
查看次数

jquery用页面滚动淡出div

我试图在页面向下滚动时淡出div(页面滚动 - 不仅仅是fadeOut效果).我正在使用这段代码在页面向下滚动时调整div的不透明度:

$(window).scroll(function() {    
    var scroll = $(window).scrollTop();
        $('.logo_container').css({'opacity':( 100-scroll )/100});
});
Run Code Online (Sandbox Code Playgroud)

我的问题是,对我来说,它消失得太快,我想在用户滚动时更加微妙的淡入淡出.任何人都可以想到一个更好的逻辑来做出更慢,更微妙的淡出.

这是一个显示我的代码的JSFIDDLE

css jquery opacity scrolltop

6
推荐指数
2
解决办法
2万
查看次数

WPF字体中不可预知的不透明行为

我在理解WPF中的不透明度时遇到了问题.我在下面发布了代码.我的问题是:

  • 为什么矩形和字体会有不同的颜色?
  • 当我更改字体大小时,为什么两个TextBlock都会得到不同的颜色?

我希望,当我用颜色选择器窥探颜色时,黑色和50%的不透明度会渲染#7F7F7F,但我会得到#C2C2C2用于较小的TextBlock,而预期的#7F7F7F用于较大的字体和矩形.

问题已在https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/408部分询问,但未得到妥善解答.

任何帮助表示赞赏!

代码是:

<Window x:Class="WpfPlay.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfPlay"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="800" Background="White">

    <Window.Resources>
        <SolidColorBrush x:Key="ForeBrush" Color="Black" Opacity="0.5"/>
        <SolidColorBrush x:Key="BackBrush" Color="White" Opacity="1.0"/>
        <Style TargetType="TextBlock" x:Key="TextBlockStyle">
            <Setter Property="Foreground" Value="{StaticResource ForeBrush}"/>
            <Setter Property="Background" Value="{StaticResource BackBrush}"/>
            <Setter Property="FontSize" Value="48"/>
            <Setter Property="FontWeight" Value="Bold"/>
        </Style>

        <Style TargetType="TextBlock" x:Key="TextBlockLargeStyle">
            <Setter Property="Foreground" Value="{StaticResource ForeBrush}"/>
            <Setter Property="Background" Value="{StaticResource BackBrush}"/>
            <Setter Property="FontSize" Value="100"/>
            <Setter Property="FontWeight" Value="Bold"/>
        </Style>
    </Window.Resources>

    <StackPanel Orientation="Vertical" Background="White">
        <TextBlock Text="Click me" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Margin="20"/>
        <TextBlock Text="Click me" …
Run Code Online (Sandbox Code Playgroud)

wpf rendering colors opacity

6
推荐指数
1
解决办法
252
查看次数