def _add_slate_legal_and_extended_patches()

in src/open_vp_cal/framework/generation.py [0:0]


    def _add_slate_legal_and_extended_patches(self, patch) -> Oiio.ImageBuf:
        """ Adds the legal and extended patches to the slate

        Args:
            patch: The patch to add the patches to

        Returns: The patch with the legal and extended patches added

        """
        nit_bar_height = 100
        nit_bar_steps = 4
        nit_bar_width = nit_bar_height * nit_bar_steps
        nit_bar_roi = Oiio.ROI(0, nit_bar_width, 0, nit_bar_height)
        rois = self.split_roi(nit_bar_roi, nit_bar_steps)
        img_buffers = self.create_image_buffers_from_rois(rois)

        minimum_legal, maximum_legal, minimum_extended, maximum_extended = utils.get_legal_and_extended_values(
            self.led_wall.target_max_lum_nits
        )

        Oiio.ImageBufAlgo.fill(
            img_buffers[0],
            [minimum_extended, minimum_extended, minimum_extended]
        )
        Oiio.ImageBufAlgo.fill(
            img_buffers[1],

            [minimum_legal, minimum_legal, minimum_legal]
        )
        Oiio.ImageBufAlgo.fill(
            img_buffers[2],

            [maximum_legal, maximum_legal, maximum_legal]
        )
        Oiio.ImageBufAlgo.fill(
            img_buffers[3],

            [maximum_extended, maximum_extended, maximum_extended]
        )

        target_gamut_only_cs_name, _ = ocio_config.OcioConfigWriter.target_gamut_only_cs_metadata(
            self.led_wall
        )
        transfer_function_only_cs_name, _ = ocio_config.OcioConfigWriter.transfer_function_only_cs_metadata(
            self.led_wall
        )
        color_converted_img_buffers = []
        for img_buf in img_buffers:
            output_img_buf = imaging_utils.apply_color_conversion(
                img_buf, transfer_function_only_cs_name,
                target_gamut_only_cs_name,
                color_config=self.generation_ocio_config_path
            )
            color_converted_img_buffers.append(output_img_buf)

        patch = self.insert_image_buffers(patch, color_converted_img_buffers[:2], x_pos=2900, y_pos=850)
        patch = self.insert_image_buffers(patch, color_converted_img_buffers[2:], x_pos=3200, y_pos=850)
        return patch