Draw on canvas a rect

Hello guys, I am getting better at lvgl, but still some challenges come around, now I cannot get to really understand the palette of the canvas.

I am initially loading an image to the screen which is being loaded correctly with this code:

void drawButtonnsLV(){
  lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL);
  lv_img_set_src(img1, &btns_menuv2);
  lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, 0);
}

Then, I am trying to place a canvas on top to draw on it and be displayed like part the of the first image I loaded, however this code, creates a red canvas with a hole, but I cannot get to really be transparent and only the “hole” be in the color of my choice, I guess part of the fault is the palette but that’s the part I dont understand

void lv_ex_canvas_2(void)
{
    /*Create a button to better see the transparency*/
    //lv_btn_create(lv_scr_act(), NULL);

    /*Create a buffer for the canvas*/
    static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(CANVAS_WIDTH, CANVAS_HEIGHT)];

    /*Create a canvas and initialize its the palette*/
    lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL);
    lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT);
    lv_canvas_set_palette(canvas, 0, LV_COLOR_TRANSP);
    lv_canvas_set_palette(canvas, 1, LV_COLOR_RED);

    /*Create colors with the indices of the palette*/
    lv_color_t c0;  
    lv_color_t c1;

    c0.full = 0;
    c1.full = 1;



    // /*Transparent background*/
    lv_canvas_fill_bg(canvas, c1, LV_OPA_TRANSP);

    // /*Create hole on the canvas*/
     uint32_t x;
     uint32_t y;
     for( y = 10; y < 30; y++) {
         for( x = 5; x < 20; x++) {
             lv_canvas_set_px(canvas, x, y, c0);
         }
     }

}

My goal in hierarchy should be something like this:

±–background-image
±–transparent-canvas
±–draw rectangles

or is there an example of drawing a rectangle over an image, that could give me a nice hint to continue

I ended up using pixels, in the case of a canvas, with 1bit and 2bit colors, I couldnt make the draw rect to show, so I used this one:

void mydrawRec(uint32_t x,uint32_t y,uint32_t w,uint32_t h){
    lv_color_t c0;  
    c0.full = 1;
    uint32_t mx;
    uint32_t my;
    for( my = y; my < y+h; my++) {
        for( mx = x; mx < x+w; mx++) {
            lv_canvas_set_px(canvas, mx, my, c0);
        }
    }
}