2019-10-30 12:56 PM
I'm being stupid but I've copied the various demos and tried every combination I can think off.
I want to have two layers that I can write to. If a pixel in layer 2 is set to zero then I want the pixel from layer 1 to show through otherwise I want the the layer 2 pixel to show as-is.
The overall LTDC set up is working to the extent in that if I set alpha for layer 2 to 100 then I can see images from both layers with the layer 2 information on top of layer 1 and the intensity of layer 1 reduced.
However, if I increase the alpha of layer 2 to 255 then layer 1 disappears completely rather than just the pixels that are non-blank in layer 2. If I set it to 0 then layer 2 doesn't show at all
Here is my layer set up. I've tried both variants of the blending factor
if(colours==16) pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
else pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_L8;
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
pLayerCfg.Backcolor.Blue = 0;
pLayerCfg.Backcolor.Green = 0;
pLayerCfg.Backcolor.Red = 0;
pLayerCfg.Alpha = 255;
pLayerCfg.Alpha0 = 0;
pLayerCfg.FBStartAdress = (uint32_t)WritePageAddress;
pLayerCfg.WindowX0 = 0;
pLayerCfg.WindowY0 = 0;
pLayerCfg.WindowX1 = x;
pLayerCfg.WindowY1 = y*yscale;
pLayerCfg.ImageWidth = x;
pLayerCfg.ImageHeight = y*yscale;
if(colours==16) pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
else pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_L8;
pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
pLayerCfg1.Backcolor.Blue = 0;
pLayerCfg1.Backcolor.Green = 0;
pLayerCfg1.Backcolor.Red = 0;
pLayerCfg1.Alpha = 200;
pLayerCfg1.Alpha0 = 0;
pLayerCfg1.FBStartAdress = (uint32_t)LayerPageAddress;
pLayerCfg1.WindowX0 = 0;
pLayerCfg1.WindowY0 = 0;
pLayerCfg1.WindowX1 = x;
pLayerCfg1.WindowY1 = y*yscale;
pLayerCfg1.ImageWidth = x;
pLayerCfg1.ImageHeight = y*yscale;
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
{
error("HAL_LTDC_ConfigLayer");
}
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)
{
error("HAL_LTDC_ConfigLayer1");
}
Solved! Go to Solution.
2019-10-31 12:09 AM
Hi. If you want set alpha for specific pixel use ARGB4444 pixel format instead RGB565.
2019-10-31 12:09 AM
Hi. If you want set alpha for specific pixel use ARGB4444 pixel format instead RGB565.
2019-11-01 3:14 AM
Thanks - that was the clue I needed - I'm using ARGB1555 and it is working perfectly. Now the only problem I have is switching back to single layer mode. Even stopping and restarting LTDC (Deinit/Init) doesn't seem to clean up properly
2019-11-01 12:45 PM
> Hi. If you want set alpha for specific pixel use ARGB4444 pixel format instead RGB565.
Not necessarily, see the Color keying paragraph in the LTDC chapter in RM.
JW
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.