Comments (3)
Setting opacity on a Stage in Monocle on Raspberry Pi 3 is no-op because there is no a window which is drawn on a desktop.
Monocle draws a scene directly to the screen: MonocleWindow._setAlpha()
I wrote a simple sample where toggle buttons are used to set VBox and Stage opacity and run in on Rasperry Pi 3B+.
sudo java -Dprism.verbose=true -Djavafx.platform=monocle -Dprism.verbose=es2 JavaFXSample
Setting opacity for VBox where all components are placed makes all components transparent.
Could the workaround where opacity is set not to the stage but to a pane which contains all components work for your application?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.ToggleButton;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class JavaFXSample extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Sample");
Label label = new Label("Set opacity:");
ToggleButton noneOpacity = new ToggleButton("None");
ToggleButton vboxOpacity = new ToggleButton("VBox");
ToggleButton stageOpacity = new ToggleButton("Stage");
ToggleGroup toggleGroup = new ToggleGroup();
noneOpacity.setToggleGroup(toggleGroup);
vboxOpacity.setToggleGroup(toggleGroup);
stageOpacity.setToggleGroup(toggleGroup);
noneOpacity.setSelected(true);
VBox vbox = new VBox(10, label, noneOpacity, vboxOpacity, stageOpacity);
noneOpacity.setOnAction(event -> {
vbox.setOpacity(1.0);
primaryStage.setOpacity(1.0);
});
vboxOpacity.setOnAction(event -> {
primaryStage.setOpacity(1.0);
vbox.setOpacity(0.3);
});
stageOpacity.setOnAction(event -> {
vbox.setOpacity(1.0);
primaryStage.setOpacity(0.3);
});
Scene scene = new Scene(vbox, 400, 300);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
from liberica.
Thanks Alex,
your example gave me good hints to get the transparency working for my use case.
:-)
This what worked for me:
` @OverRide
public void start(Stage primaryStage) throws IOException {
// Even in direct frame buffer mode we need to set this in addition to setting the background-color style of the stackPane
primaryStage.initStyle(StageStyle.TRANSPARENT);
StackPane pane = new StackPane();
// This only seems to work when combined with stage.initStyle(StageStyle.TRANSPARENT)
pane.setStyle("-fx-background-color: transparent;");
ImageView imageView = getTestImage();
pane.getChildren().add(imageView);
`
from liberica.
Oops, I may have spoken too soon - I realised that my test was using the default (software) pipeline .. as soon as I switched to hardware accelerated I got the opaque black rectangle again.
I will distill the app down to the simplest possible example and get back to you.
from liberica.
Related Issues (20)
- cannot be opened because the developer cannot be verified HOT 4
- Alpine image causes core dump. HOT 1
- JDK crushed during unit test under IDEA
- ARM M2: JavaFX crashes when second scene opened. HOT 2
- Fix CVE-2023-2650 in Alpine Docker images HOT 3
- Upgrade to Alpine 3.18.2 to address OpenSSL CVEs HOT 2
- libprism_es2.so: undefined symbol: glXQueryExtension HOT 3
- Add curl in liberica-runtime-container image HOT 3
- Upgrade liberica-openjdk-alpine:20 to Alpine 3.18.3 to address OpenSSL CVEs HOT 3
- Buildpacks with Java 21 HOT 3
- Release 21.0.1+15 HOT 2
- Question HOT 2
- Upgrade liberica-openjdk-alpine:21 to Alpine 3.18.5 to address OpenSSL CVEs HOT 4
- apk missing in images HOT 2
- Upgrade liberica-openjdk-alpine:21 to Alpine 3.19.1 to address OpenSSL CVEs HOT 4
- Crash when using native library embedded in a jar. HOT 2
- [FR] For slim images remove docs, mans and other irrelevant files HOT 2
- Status of ParallelGC HOT 1
- API: Java 22 release marked as EOL HOT 1
- "Fontconfig head is null, check your fonts or fonts configuration" with liberica-openjdk-alpine:17.0.10 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liberica.