LinearGradient bug

When I try LinearGradientBrush with:

window.Background = new LinearGradientBrush(Colors.Blue, Colors.Red, 0, 0, window.Width, 0);

Gradient start at 0 (for x) but end to width/2 and not at width as expected.
Tested on SC20260D Dev with UD435 Rev A.

@Dat_Tran is it wrong it we have a bug?

Take a picture of your screen, please. It looks OK to me.

I will try to have a picture with camera as I’m very lucky to have one, but for now, I just use my phone ! :wink:
As You can see gradient is correct at left (blue to red, but right is red only).

1 Like

For comparison, it looks OK with the same settings on my display.

2 Likes

What is display configuration for UD700 ? and there is a touchscreen ?

Width = 800,
Height = 480,
DataFormat = DisplayDataFormat.Rgb565,
PixelClockRate = 24000000,
PixelPolarity = false,
DataEnablePolarity = false,
DataEnableIsFixed = false,
HorizontalFrontPorch = 16,
HorizontalBackPorch = 46,
HorizontalSyncPulseWidth = 1,
HorizontalSyncPolarity = false,
VerticalFrontPorch = 7,
VerticalBackPorch = 23,
VerticalSyncPulseWidth = 1,
VerticalSyncPolarity = false,

1 Like

Yes, both the 4.3 inch and 7 inch displays have capacitive touch. The 1.8" display on the SC20100 Dev Board is not touch.

2 Likes

I try on SC20100 and N18 Display, gradient is good with (but why 1024 ? Screen is 160x128):

window.Background = new LinearGradientBrush(
        Colors.Blue, Colors.Red, 0, 0, 1024, 1024);


If I try with:

            window.Background = new LinearGradientBrush(
            Colors.Blue, Colors.Red, 0, 0, window.Width, window.Height);

Gradient is not ok:

@ Bauland :The life is easier for me with your second example (1024). Thanks

1 Like

I’m happy if I can help ! :wink:

try this:

 window.Background = new LinearGradientBrush(Colors.Blue, Colors.Red, 0, 0,
              window.Width, window.Height)
            {
                MappingMode = BrushMappingMode.Absolute  // added this line
            };

it will work;

1 Like