first commit

This commit is contained in:
Alejandro Guerrero 2026-09-27 17:21:39 +02:00
commit e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions

View file

@ -0,0 +1,34 @@
cmake_minimum_required (VERSION 3.8)
project(LGFXOpenCV)
add_definitions(-DLGFX_OPENCV)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")
# ビルド対象にするファイルを指定する;
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
*.cpp
../../../LovyanGFX/src/lgfx/Fonts/efont/*.c
../../../LovyanGFX/src/lgfx/Fonts/IPA/*.c
../../../LovyanGFX/src/lgfx/utility/*.c
../../../LovyanGFX/src/lgfx/v1/*.cpp
../../../LovyanGFX/src/lgfx/v1/misc/*.cpp
../../../LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
../../../LovyanGFX/src/lgfx/v1/platforms/opencv/*.cpp
)
add_executable (LGFXOpenCV ${Target_Files})
# includeするファイルのパスを指定する;
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
target_include_directories(LGFXOpenCV PUBLIC "../../../LovyanGFX/src")
# OpenCVを配置したパス内のincludeのパスを指定する;
target_include_directories(LGFXOpenCV PUBLIC "C:/opencv/build/include")
# OpenCVを配置したパス内の.libファイルのパスを指定する;
target_link_libraries(LGFXOpenCV PUBLIC "C:/opencv/build/x64/vc15/lib/opencv_world452d.lib" )
target_compile_features(LGFXOpenCV PUBLIC cxx_std_17)

View file

@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}

View file

@ -0,0 +1,30 @@
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <thread>
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <LGFX_AUTODETECT.hpp>
void setup(void);
void loop(void);
void loopThread(void)
{
setup();
for (;;)
{
std::this_thread::yield();
loop();
}
}
int main(int, char**)
{
std::thread sub_thread(loopThread);
for (;;)
{
std::this_thread::yield();
lgfx::Panel_OpenCV::imshowall();
}
}

View file

@ -0,0 +1,53 @@

// If you write this, you can use drawBmpFile / drawJpgFile / drawPngFile
// #include <stdio.h>
// If you write this, you can use drawBmpUrl / drawJpgUrl / drawPngUrl ( for Windows )
// #include <windows.h>
// #include <winhttp.h>
// #pragma comment (lib, "winhttp.lib")
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <LGFX_AUTODETECT.hpp>
LGFX lcd ( 320, 240 );
LGFX lcd2( 135, 240 );
int32_t target_x = 160 * 256;
int32_t target_y = 120 * 256;
int32_t current_x = 0;
int32_t current_y = 0;
int32_t add_x = 0;
int32_t add_y = 0;
void setup()
{
lcd.init();
lcd2.init();
// lcd.drawJpgFile("C:\\test.jpg", 0, 0);
// lcd.drawPngUrl("http://cyberjapandata.gsi.go.jp/xyz/pale/14/14550/6451.png", 0, 0);
}
void loop()
{
static int i;
++i;
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
current_x += add_x;
current_y += add_y;
add_x += (current_x < target_x) ? 1 : -1;
add_y += (current_y < target_y) ? 1 : -1;
lgfx::touch_point_t new_tp;
if (lcd.getTouch(&new_tp))
{
target_x = new_tp.x * 256;
target_y = new_tp.y * 256;
lcd.drawCircle(new_tp.x, new_tp.y, 5, TFT_WHITE);
}
lgfx::delay(1);
lcd2.fillRect(i & 127, i >> 7, 16, 16, i);
}