Skip to main content

Very strange LinearGradient bug(?)

4 replies [Last post]
dukke
Offline
Joined: 2006-03-12
Points: 0

Hi,

I'm having a very strange bug using LinearGradient.

I have Rectangle with a LinearGradient fill, but only the first stop color is being considered by the runtime and the rectangle displays with one filled solid color only.

Strangest thing is if I change the opacity level to a value other than 1 it all displays correct. But I don't want to have it opaque.

I'm using javafx1.1sdk

Here's the relevant part of the code (for simplicity sake I'm not submiting everything because it is part of a more complex scenario):

public class Pedal extends Rectangle{
def MARGIN = 3;
def DEFAULT_HEIGHT = 8;
public-init var levelIndicator: LevelIndicator;
override var translateY = bind levelIndicator.yValuePosition - DEFAULT_HEIGHT / 2;
override var width = bind levelIndicator.componentWidth + MARGIN * 2;
override var height = 8;
override var fill = bind LinearGradient{
startX: 0
startY: 0
endX: 0
endY: 1
proportional : true
stops: [
Stop {
offset: 0.0
color: Color.GRAY
},
Stop {
offset: 1.0
color: Color.WHITE
} ]
}
//override var opacity = 0.9; // uncomenting this makes it work

init{
translateX = -MARGIN;
stroke = Color.BLACK;
}
}

Thanks in advance.

Message was edited by: dukke

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dukke
Offline
Joined: 2006-03-12
Points: 0

Dmitri,

Is this info enough?

Or you need more?

Thanks.

P.S.: Sorry for duplicate answers but I was answering to myself

trembovetski
Offline
Joined: 2003-12-31
Points: 0

I can't reproduce this on Windows on 6u12. What's your environment?

Dmitri

dukke
Offline
Joined: 2006-03-12
Points: 0

I'm using java 1.6.012-b04. I'm running Windows Vista 32bit. Also I'm running javafx through java using the JXScene from Josh's blog.

dukke
Offline
Joined: 2006-03-12
Points: 0

Dmitri,

Is this info enough?