cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone briefly explain LTDC layering?

michaelm000
Associate II
Posted on February 20, 2018 at 17:36

I want graphic primitives like text on layer 2 to be superimposed on top of the image in layer 1. I want to do this will full alpha values of 255 for both layers.

I wrote the text against a color I made transparent using the colorkeying function which works great. But layer 1 is still never exposed unless I blend the images. I thought using black as a default layer color made it transparent to layers below? So I thought all alpha=0 graphic elements on layer 2 would allow layer 1 to show fully, while alpha=255 graphic element on layer 2 would completely obscure layer 1?

Can this be done? Does it require the use of the the Chrome-Art Accelerator? I've attached my config code.

Thanks!

hltdc.Instance = LTDC;

hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;

hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;

hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;

hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;

hltdc.Init.HorizontalSync = 47;

hltdc.Init.VerticalSync = 2;

hltdc.Init.AccumulatedHBP = 135;

hltdc.Init.AccumulatedVBP = 34;

hltdc.Init.AccumulatedActiveW = 935;

hltdc.Init.AccumulatedActiveH = 514;

hltdc.Init.TotalWidth = 975;

hltdc.Init.TotalHeigh = 527;

hltdc.Init.Backcolor.Blue = 0;

hltdc.Init.Backcolor.Green = 0;

hltdc.Init.Backcolor.Red = 0;

if (HAL_LTDC_Init(&hltdc) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

pLayerCfg.WindowX0 = 0;

pLayerCfg.WindowX1 = 771;

pLayerCfg.WindowY0 = 0;

pLayerCfg.WindowY1 = 467;

pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_L8;

pLayerCfg.Alpha = 255;

pLayerCfg.Alpha0 = 0;

pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg.FBStartAdress = (uint32_t)&pic1;

pLayerCfg.ImageWidth = 771;

pLayerCfg.ImageHeight = 467;

pLayerCfg.Backcolor.Blue = 0;

pLayerCfg.Backcolor.Green = 0;

pLayerCfg.Backcolor.Red = 0;

if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

pLayerCfg1.WindowX0 = 0;

pLayerCfg1.WindowX1 = 670;

pLayerCfg1.WindowY0 = 0;

pLayerCfg1.WindowY1 = 445;

pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_L8;

pLayerCfg1.Alpha = 128;

pLayerCfg1.Alpha0 = 0;

pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg1.FBStartAdress = (uint32_t)&field;

pLayerCfg1.ImageWidth = 670;

pLayerCfg1.ImageHeight = 445;

pLayerCfg1.Backcolor.Blue = 0;

pLayerCfg1.Backcolor.Green = 0;

pLayerCfg1.Backcolor.Red = 0;

if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

HAL_LTDC_ConfigColorKeying(&hltdc,0,1);

HAL_LTDC_EnableColorKeying(&hltdc,1);&sharpLT

#lcd #ltdc #graphics
1 REPLY 1
michaelm000
Associate II
Posted on February 20, 2018 at 18:10

SOLVED

Set BlendingFactor2 = 255 (alpha * pixel) = 255