天道酬勤,学无止境

transparency

How to center image in FloatingActionButton behind transparent background?

问题 我有一个 FloatingActionButton,我想用一个居中的图标使它透明。 我添加了一个样式: <style name="ButtonTransparent"> <item name="colorAccent">@android:color/transparent</item> </style> 到目前为止有效。 FAB 变得透明了。 然后我添加了 FAB : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".activities.CameraActivity"> <TextureView android:id="@+id/texture" android:layout_width="match_parent" android:layout_height="wrap

2022-05-17 01:02:41    分类:技术分享    android   android-layout   transparency   floating-action-button

How do I add transparency to shape in python pptx?

问题 def new_presentation(): prs=Presentation() img="C:/Users/Dennis/Desktop/Tom-Hiddleston-4-1024x768.jpg" mainsld=new_slide(prs, 6) mainshp=mainsld.shapes mainshp.add_picture(img, 0,0, Inches(10)) titleshape=mainshp.add_shape(MSO_SHAPE.RECTANGLE, Inches(0), Inches(1), Inches(10), Inches(1)) titleshape.fill.solid() titleshape.fill.fore_color.rgb=RGBColor(0x00,0x64,0x00) titleshape.fill.transparency = 0.25 ##doesnt work???########################## titleshape.line.fill.background() titlebox=mainshp.add_textbox(Inches(1), Inches(0.8),Inches(1), Inches(1)).text_frame.add_paragraph() titlebox.text=

2022-05-14 14:01:14    分类:技术分享    python   python-2.7   transparency   presentation   python-pptx

Swing transparent background not being repainted

问题 我在 Swing 中使用透明背景时遇到问题。 由于 Swing 没有重新绘制更改的区域,因此产生了很多人工制品。 据我所知,有两种开箱即用的方式来使用透明背景: 将透明颜色设置为背景的不透明组件(左侧 txt 字段) 问题:背景的透明部分永远不会刷新-> Artefacts。 将透明颜色设置为背景的非透明组件(右侧 txt 字段) 问题:根本没有绘制背景。 我不想做的事情: 使用计时器自动重绘框架(超级糟糕) 覆盖paintComponent方法(实际上有效,但真的很糟糕) 我在 Win7 x64 上运行 Aaaand 这是我的 SSCCEEE: 更新 1:使用 invokeLater 初始化(仍然不起作用) public class OpacityBug { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new OpacityBug(); } }); } static final Color transparentBlue = new Color(0f, 1f, 0f, 0.5f); JFrame frame; JPanel content; JTextField txt1

2022-05-09 18:15:10    分类:技术分享    java   swing   transparency   repaint

Ugly Swing Button Background

问题 我有一个 GUI,主面板具有透明背景,因此可以通过它们看到背景图像。 问题是,单击其中一个面板上的按钮,在 Mac OS 上,按钮具有圆形边框,它们的背景变成不透明的颜色。 我怎么能避免这种情况? 这是一张图片: 回答1 只需使用setOpaque(false)使按钮透明。 永远不要使用 alpha 颜色作为背景颜色,Swing 只处理不透明或不透明的组件,它不知道如何处理基于 alpha 的颜色。 如果您使用基于 alpha 的背景颜色,Swing 不知道 1- 假设在绘制组件之前正确准备了Graphics上下文,以及 2- 组件下面的组件也需要在组件更改时进行更新。 随着 UI 复杂性的增加和变化开始发生(UI 已更新),使用 alpha 背景颜色将生成随机且令人讨厌的绘制伪影 有关更多详细信息,请参阅在 AWT 和 Swing 中绘画和执行自定义绘画 import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.image.BufferedImage

2022-05-09 13:06:09    分类:技术分享    java   swing   jpanel   jbutton   transparency

android- transparent RelativeLayout

问题 回答1 您可以创建具有shape内容的drawable 。 并把你的风格放进去。 样本: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#77ffffff"/> </shape> 在 res 路径的 drawable 文件夹中创建一个名称如sampleBackground.xml的文件。 并将面板的背景属性设置为它: android:background="@drawable/sampleBackground" 回答2 如果你想让它透明,你可以为你的布局使用 alpha 属性。 它可以通过以下方式使用:- <RelativeLayout android:id="@+id/yourRelativeLayoutID" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:alpha="0.7" android:gravity=

2022-05-06 09:32:09    分类:技术分享    java   android   transparency

Transparet pixels are being pasted as black in PIL

I paste an image with transparent pixels, but they are black in the final image img = Image.new('RGBA', (100, 100), "white") arbol16 = Image.open("arbol16.png") img.paste(arbol16,( 0, 0, 16, 16)) img.show() arbol16.png image file:

2022-05-03 00:28:58    分类:问答    python   python-imaging-library   transparency

How to determine if image is using transparency on Javascript?

I'd like to be able to detect if a logo type image has a transparent background or not, let's imagin that two similar images are .png files but one has a white background and another on has a transparent background, how would I be able to determine the one with transparency ? I've tried using colorthief but it doesn't take transparency into account, so I thought doing it by myself on canvas. A first solution would be to convert the png file into jpg and if the background color of the jpg after being converted appear to be black then it's a transparent logo, but this might be a problem for

2022-05-02 12:34:45    分类:问答    javascript   image   html5-canvas   transparency

Saving image with backgroundimage to file in C#

I have a picturebox on the form, with BackgroundImage property set to certain image. The rest of the image has certain transparent areas, so that background image is shown in those areas. I want to save it to the file, but there is no save method for picturebox. There is a save method for image property, but then it only saves the content of the image, and does not include the backgroundimage. Any hints on how I can save both, so that it looks in the file exactly as it looks on the picturebox?

2022-05-02 01:04:39    分类:问答    c#   image   transparency   background-image   picturebox

How do I add transparency to shape in python pptx?

def new_presentation(): prs=Presentation() img="C:/Users/Dennis/Desktop/Tom-Hiddleston-4-1024x768.jpg" mainsld=new_slide(prs, 6) mainshp=mainsld.shapes mainshp.add_picture(img, 0,0, Inches(10)) titleshape=mainshp.add_shape(MSO_SHAPE.RECTANGLE, Inches(0), Inches(1), Inches(10), Inches(1)) titleshape.fill.solid() titleshape.fill.fore_color.rgb=RGBColor(0x00,0x64,0x00) titleshape.fill.transparency = 0.25 ##doesnt work???########################## titleshape.line.fill.background() titlebox=mainshp.add_textbox(Inches(1), Inches(0.8),Inches(1), Inches(1)).text_frame.add_paragraph() titlebox.text=

2022-05-01 09:06:11    分类:问答    python   python-2.7   transparency   presentation   python-pptx

How to center image in FloatingActionButton behind transparent background?

I have a FloatingActionButton and I would like to make it transparent with a centered icon. I added a style: <style name="ButtonTransparent"> <item name="colorAccent">@android:color/transparent</item> </style> which works so far. THe FAB got transparent. Then I added the FAB : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".activities.CameraActivity"> <TextureView

2022-04-30 10:36:32    分类:问答    android   android-layout   transparency   floating-action-button