C

Qt Quick Ultralite imagedecoder Example

/****************************************************************************** ** ** Copyright (C) 2023 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
#include "board_config.h" #include "stmimagedecoder.h" #include "stm32_mcu_specific.h" #include <qul/application.h> #if defined(SUPPORT_FILESYSTEM) #include "fatfs/fatfsfilesystem.h" #include "ff.h" #include "ff_gen_drv.h" FIL JPEG_File; /* File object */ extern "C" const Diskio_drvTypeDef SD_Driver; extern "C" { void *ff_memalloc(UINT msize) { return Qul::Platform::qul_malloc(msize); } void ff_memfree(void *ptr) { Qul::Platform::qul_free(ptr); } } #endif JPEG_HandleTypeDef JPEG_Handle; extern "C" { void JPEG_InitColorTables(); } void ConfigureBoard() { /* Init The JPEG Look Up Tables used for YCbCr to RGB conversion*/ JPEG_InitColorTables(); /* Init the HAL JPEG driver */ JPEG_Handle.Instance = JPEG; if (HAL_JPEG_Init(&JPEG_Handle) != HAL_OK) Qul::PlatformInterface::log("HAL_JPEG_Init failed\n"); #if defined(SUPPORT_FILESYSTEM) static FatFsFilesystem filesystem; static FATFS sdFatFs; static char sdPath[4]; if (FATFS_LinkDriver(&SD_Driver, sdPath) != 0) { Qul::PlatformInterface::log("FATFS_LinkDriver failed\n"); return; } if (f_mount(&sdFatFs, sdPath, 0) != 0) { Qul::PlatformInterface::log("Mounting filesystem failed!\n"); return; } Qul::Application::addFilesystem(&filesystem); #endif static StmImageDecoder imagedecoder; Qul::Application::addImageDecoder(&imagedecoder); }