diff --git a/docs/src/details/libs/rle-compress-statistics.png b/docs/src/_static/images/rle-compress-statistics.png similarity index 100% rename from docs/src/details/libs/rle-compress-statistics.png rename to docs/src/_static/images/rle-compress-statistics.png diff --git a/docs/src/details/auxiliary-modules/index.rst b/docs/src/details/auxiliary-modules/index.rst index 90cda517f8..70fbfbb5b1 100644 --- a/docs/src/details/auxiliary-modules/index.rst +++ b/docs/src/details/auxiliary-modules/index.rst @@ -8,16 +8,6 @@ Auxiliary Modules :maxdepth: 2 file_explorer - font_manager fragment - gridnav - ime_pinyin - imgfont - monkey - obj_id obj_property - observer/index - snapshot - sysmon - test translation diff --git a/docs/src/details/debugging/index.rst b/docs/src/details/debugging/index.rst index 9bd52b10af..bb3fbbb09d 100644 --- a/docs/src/details/debugging/index.rst +++ b/docs/src/details/debugging/index.rst @@ -9,5 +9,9 @@ Debugging gdb_plugin log + monkey + obj_id profiler + sysmon + test vg_lite_tvg diff --git a/docs/src/details/auxiliary-modules/monkey.rst b/docs/src/details/debugging/monkey.rst similarity index 100% rename from docs/src/details/auxiliary-modules/monkey.rst rename to docs/src/details/debugging/monkey.rst diff --git a/docs/src/details/auxiliary-modules/obj_id.rst b/docs/src/details/debugging/obj_id.rst similarity index 100% rename from docs/src/details/auxiliary-modules/obj_id.rst rename to docs/src/details/debugging/obj_id.rst diff --git a/docs/src/details/auxiliary-modules/sysmon.rst b/docs/src/details/debugging/sysmon.rst similarity index 100% rename from docs/src/details/auxiliary-modules/sysmon.rst rename to docs/src/details/debugging/sysmon.rst diff --git a/docs/src/details/auxiliary-modules/test.rst b/docs/src/details/debugging/test.rst similarity index 100% rename from docs/src/details/auxiliary-modules/test.rst rename to docs/src/details/debugging/test.rst diff --git a/docs/src/details/libs/freetype.rst b/docs/src/details/libs/font_support/freetype.rst similarity index 96% rename from docs/src/details/libs/freetype.rst rename to docs/src/details/libs/font_support/freetype.rst index 7308bf4b9b..c23bbf01d1 100644 --- a/docs/src/details/libs/freetype.rst +++ b/docs/src/details/libs/font_support/freetype.rst @@ -122,8 +122,7 @@ please refer to the example code below. .. admonition:: Further Reading - - `FreeType tutorial `__ - - LVGL's :ref:`add_font` + `FreeType tutorial `__ Rendering vector fonts is supported with VGLite or ThorVG, when using vector fonts with ThorVG, it is possible to set a letter outline of a different color. @@ -148,7 +147,7 @@ See the :cpp:func:`lv_example_freetype_2_vector_font` function for a usage examp Examples ******** -.. include:: ../../examples/libs/freetype/index.rst +.. include:: ../../../examples/libs/freetype/index.rst diff --git a/docs/src/details/libs/font_support/index.rst b/docs/src/details/libs/font_support/index.rst new file mode 100644 index 0000000000..4c30725400 --- /dev/null +++ b/docs/src/details/libs/font_support/index.rst @@ -0,0 +1,13 @@ +.. _libs_font_support: + +============ +Font Support +============ + + +.. toctree:: + :maxdepth: 2 + + freetype + tiny_ttf + diff --git a/docs/src/details/libs/tiny_ttf.rst b/docs/src/details/libs/font_support/tiny_ttf.rst similarity index 96% rename from docs/src/details/libs/tiny_ttf.rst rename to docs/src/details/libs/font_support/tiny_ttf.rst index 3c3ba645af..a967f4ebe5 100644 --- a/docs/src/details/libs/tiny_ttf.rst +++ b/docs/src/details/libs/font_support/tiny_ttf.rst @@ -47,7 +47,7 @@ allow kerning, if supported, or disable. Example ******* -.. include:: ../../examples/libs/tiny_ttf/index.rst +.. include:: ../../../examples/libs/tiny_ttf/index.rst diff --git a/docs/src/details/libs/arduino_esp_littlefs.rst b/docs/src/details/libs/fs_support/arduino_esp_littlefs.rst similarity index 100% rename from docs/src/details/libs/arduino_esp_littlefs.rst rename to docs/src/details/libs/fs_support/arduino_esp_littlefs.rst diff --git a/docs/src/details/libs/arduino_sd.rst b/docs/src/details/libs/fs_support/arduino_sd.rst similarity index 100% rename from docs/src/details/libs/arduino_sd.rst rename to docs/src/details/libs/fs_support/arduino_sd.rst diff --git a/docs/src/details/libs/frogfs.rst b/docs/src/details/libs/fs_support/frogfs.rst similarity index 100% rename from docs/src/details/libs/frogfs.rst rename to docs/src/details/libs/fs_support/frogfs.rst diff --git a/docs/src/details/libs/fs.rst b/docs/src/details/libs/fs_support/fs.rst similarity index 100% rename from docs/src/details/libs/fs.rst rename to docs/src/details/libs/fs_support/fs.rst diff --git a/docs/src/details/libs/fs_support/index.rst b/docs/src/details/libs/fs_support/index.rst new file mode 100644 index 0000000000..6f068a2634 --- /dev/null +++ b/docs/src/details/libs/fs_support/index.rst @@ -0,0 +1,16 @@ +.. _libs_fs_support: + +=================== +File System Support +=================== + + +.. toctree:: + :maxdepth: 2 + + fs + arduino_esp_littlefs + arduino_sd + frogfs + lfs + diff --git a/docs/src/details/libs/lfs.rst b/docs/src/details/libs/fs_support/lfs.rst similarity index 100% rename from docs/src/details/libs/lfs.rst rename to docs/src/details/libs/fs_support/lfs.rst diff --git a/docs/src/details/libs/bmp.rst b/docs/src/details/libs/image_support/bmp.rst similarity index 97% rename from docs/src/details/libs/bmp.rst rename to docs/src/details/libs/image_support/bmp.rst index 3c7f2819cd..6396ef1c87 100644 --- a/docs/src/details/libs/bmp.rst +++ b/docs/src/details/libs/image_support/bmp.rst @@ -49,7 +49,7 @@ Limitations Example ******* -.. include:: ../../examples/libs/bmp/index.rst +.. include:: ../../../examples/libs/bmp/index.rst diff --git a/docs/src/details/libs/gif.rst b/docs/src/details/libs/image_support/gif.rst similarity index 98% rename from docs/src/details/libs/gif.rst rename to docs/src/details/libs/image_support/gif.rst index ce494d3cb1..4e9a79a7b9 100644 --- a/docs/src/details/libs/gif.rst +++ b/docs/src/details/libs/image_support/gif.rst @@ -90,7 +90,7 @@ ARGB8888 has a pixel size of 4. Example ******* -.. include:: ../../examples/libs/gif/index.rst +.. include:: ../../../examples/libs/gif/index.rst diff --git a/docs/src/details/libs/image_support/index.rst b/docs/src/details/libs/image_support/index.rst new file mode 100644 index 0000000000..4cfb42eb84 --- /dev/null +++ b/docs/src/details/libs/image_support/index.rst @@ -0,0 +1,19 @@ +.. _libs_image_support: + +============= +Image Support +============= + + +.. toctree:: + :maxdepth: 2 + + bmp + gif + libjpeg_turbo + libpng + lodepng + rle + rlottie + svg + tjpgd diff --git a/docs/src/details/libs/libjpeg_turbo.rst b/docs/src/details/libs/image_support/libjpeg_turbo.rst similarity index 96% rename from docs/src/details/libs/libjpeg_turbo.rst rename to docs/src/details/libs/image_support/libjpeg_turbo.rst index e338f040f4..ee6f797bb7 100644 --- a/docs/src/details/libs/libjpeg_turbo.rst +++ b/docs/src/details/libs/image_support/libjpeg_turbo.rst @@ -66,7 +66,7 @@ feature to ensure that the memory usage is within a reasonable range. Example ******* -.. include:: ../../examples/libs/libjpeg_turbo/index.rst +.. include:: ../../../examples/libs/libjpeg_turbo/index.rst diff --git a/docs/src/details/libs/libpng.rst b/docs/src/details/libs/image_support/libpng.rst similarity index 95% rename from docs/src/details/libs/libpng.rst rename to docs/src/details/libs/image_support/libpng.rst index 1f0e9bbed4..6af461d092 100644 --- a/docs/src/details/libs/libpng.rst +++ b/docs/src/details/libs/image_support/libpng.rst @@ -59,7 +59,7 @@ stored in RGBA pixel format. Example ******* -.. include:: ../../examples/libs/libpng/index.rst +.. include:: ../../../examples/libs/libpng/index.rst diff --git a/docs/src/details/libs/lodepng.rst b/docs/src/details/libs/image_support/lodepng.rst similarity index 96% rename from docs/src/details/libs/lodepng.rst rename to docs/src/details/libs/image_support/lodepng.rst index 13a4526b2c..67e45d83fb 100644 --- a/docs/src/details/libs/lodepng.rst +++ b/docs/src/details/libs/image_support/lodepng.rst @@ -52,7 +52,7 @@ for example Compress PNG: https://compresspng.com/ Example ******* -.. include:: ../../examples/libs/lodepng/index.rst +.. include:: ../../../examples/libs/lodepng/index.rst diff --git a/docs/src/details/libs/rle.rst b/docs/src/details/libs/image_support/rle.rst similarity index 98% rename from docs/src/details/libs/rle.rst rename to docs/src/details/libs/image_support/rle.rst index 201d97eefc..646850af17 100644 --- a/docs/src/details/libs/rle.rst +++ b/docs/src/details/libs/image_support/rle.rst @@ -22,7 +22,7 @@ compressed to save more than 70% space. The below statistics are from a watch project. It shows the file count of every compress level. For rare conditions, RLE compress may increase the file size if there's no large repetition in data. -.. image:: rle-compress-statistics.png +.. image:: /_static/images/rle-compress-statistics.png :alt: RLE compress statistics from a watch project :align: center diff --git a/docs/src/details/libs/rlottie.rst b/docs/src/details/libs/image_support/rlottie.rst similarity index 99% rename from docs/src/details/libs/rlottie.rst rename to docs/src/details/libs/image_support/rlottie.rst index 66ad33263e..feab6b86b7 100644 --- a/docs/src/details/libs/rlottie.rst +++ b/docs/src/details/libs/image_support/rlottie.rst @@ -298,7 +298,7 @@ IDF) with the appropriate :cpp:expr:`MALLOC_CAP` call --- for SPIRAM usage this Example ******* -.. include:: ../../examples/libs/rlottie/index.rst +.. include:: ../../../examples/libs/rlottie/index.rst diff --git a/docs/src/details/libs/svg.rst b/docs/src/details/libs/image_support/svg.rst similarity index 81% rename from docs/src/details/libs/svg.rst rename to docs/src/details/libs/image_support/svg.rst index 162f5799c3..35c5a3175e 100644 --- a/docs/src/details/libs/svg.rst +++ b/docs/src/details/libs/image_support/svg.rst @@ -1,7 +1,7 @@ .. _svg: =========== -SVG Support +SVG Decoder =========== The lv_svg extension provides makes it possible to use SVG images in your LVGL UI using the @@ -22,11 +22,20 @@ If you need support for SVG animation attribute parsing, you can set :c:macro:`LV_USE_SVG_ANIMATION` in ``lv_conf.h`` to ``1``. +As Image Source +*************** -.. _svg_example: +`lv_image` directly supports SVG images. For example: -Example -******* +.. code-block:: c + + lv_image_set_src(widget, "S:path/to/example.svg"); + + +Direct Rendering +**************** + +It is also possible to draw SVG vector graphics in draw events: .. code:: c @@ -44,12 +53,12 @@ Example /* Release the DOM tree */ lv_svg_node_delete(svg_doc); -`lv_image` also supports SVG images. For example: +.. _svg_example: -.. code-block:: c - - lv_image_set_src(widget, "S:path/to/example.svg"); +Example +******* +.. include:: ../../../examples/libs/svg/index.rst .. _svg_api: diff --git a/docs/src/details/libs/tjpgd.rst b/docs/src/details/libs/image_support/tjpgd.rst similarity index 90% rename from docs/src/details/libs/tjpgd.rst rename to docs/src/details/libs/image_support/tjpgd.rst index 8855270a2b..ab9c7df4f9 100644 --- a/docs/src/details/libs/tjpgd.rst +++ b/docs/src/details/libs/image_support/tjpgd.rst @@ -1,8 +1,8 @@ .. _tjpgd: -================================ -Tiny JPEG Decompressor (TJpgDec) -================================ +================= +Tiny JPEG Decoder +================= **Tiny JPEG Decompressor** is an LVGL interface to the TJpgDec library --- a generic JPEG image decompressor module that highly optimized for small embedded systems. It @@ -65,7 +65,7 @@ Converting JPEG to C array Example ******* -.. include:: ../../examples/libs/tjpgd/index.rst +.. include:: ../../../examples/libs/tjpgd/index.rst diff --git a/docs/src/details/libs/index.rst b/docs/src/details/libs/index.rst index 427df12417..0a54e324f5 100644 --- a/docs/src/details/libs/index.rst +++ b/docs/src/details/libs/index.rst @@ -8,24 +8,11 @@ .. toctree:: :maxdepth: 2 - arduino_esp_littlefs - arduino_sd + font_support/index + fs_support/index + image_support/index + video_support/index barcode - bmp - ffmpeg - freetype - frogfs - fs - gif - gstreamer gltf - lfs - libjpeg_turbo - libpng - lodepng qrcode - rle - rlottie - svg - tiny_ttf - tjpgd + diff --git a/docs/src/details/libs/ffmpeg.rst b/docs/src/details/libs/video_support/ffmpeg.rst similarity index 97% rename from docs/src/details/libs/ffmpeg.rst rename to docs/src/details/libs/video_support/ffmpeg.rst index 49cbea2e37..d2949ebeb3 100644 --- a/docs/src/details/libs/ffmpeg.rst +++ b/docs/src/details/libs/video_support/ffmpeg.rst @@ -90,7 +90,7 @@ Learn more about :ref:`events`. Examples ******** -.. include:: ../../examples/libs/ffmpeg/index.rst +.. include:: ../../../examples/libs/ffmpeg/index.rst diff --git a/docs/src/details/libs/gstreamer.rst b/docs/src/details/libs/video_support/gstreamer.rst similarity index 94% rename from docs/src/details/libs/gstreamer.rst rename to docs/src/details/libs/video_support/gstreamer.rst index fed358381f..89e8c35170 100644 --- a/docs/src/details/libs/gstreamer.rst +++ b/docs/src/details/libs/video_support/gstreamer.rst @@ -66,7 +66,7 @@ Requirements The GStreamer extension requires **GStreamer 1.0** or later with the following components: :gstreamer-1.0: Core GStreamer framework -:gstreamer-video-1.0: Video handling and processing utilities +:gstreamer-video-1.0: Video handling and processing utilities :gstreamer-app-1.0: Application integration utilities Dependencies @@ -92,18 +92,18 @@ Setup .. code-block:: cmake find_package(PkgConfig REQUIRED) - + # Find GStreamer packages pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0) pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0) pkg_check_modules(GSTREAMER_APP REQUIRED gstreamer-app-1.0) - + # Link with LVGL - target_include_directories(lvgl PUBLIC + target_include_directories(lvgl PUBLIC ${GSTREAMER_INCLUDE_DIRS} - ${GSTREAMER_VIDEO_INCLUDE_DIRS} + ${GSTREAMER_VIDEO_INCLUDE_DIRS} ${GSTREAMER_APP_INCLUDE_DIRS}) - target_link_libraries(lvgl PUBLIC + target_link_libraries(lvgl PUBLIC ${GSTREAMER_LIBRARIES} ${GSTREAMER_VIDEO_LIBRARIES} ${GSTREAMER_APP_LIBRARIES}) @@ -126,18 +126,18 @@ Setup { /* Initialize LVGL */ lv_init(); - + /* Setup display driver */ lv_display_t *display = lv_display_create(800, 480); /* ... configure display driver ... */ - + /* Create and run your GStreamer application */ lv_example_gstreamer_1(); - + while (1) { lv_timer_handler(); } - + return 0; } @@ -153,18 +153,18 @@ Here's how to create a basic GStreamer player and load media: /* Create a GStreamer object */ lv_obj_t * streamer = lv_gstreamer_create(lv_screen_active()); - + /* Set the media source using URI factory */ - lv_result_t result = lv_gstreamer_set_src(streamer, + lv_result_t result = lv_gstreamer_set_src(streamer, LV_GSTREAMER_FACTORY_URI_DECODE, LV_GSTREAMER_PROPERTY_URI_DECODE, "https://example.com/video.webm"); - + if (result != LV_RESULT_OK) { LV_LOG_ERROR("Failed to set GStreamer source"); return; } - + /* Start playback */ lv_gstreamer_play(streamer); @@ -178,15 +178,15 @@ The GStreamer widget supports various media sources through different factories: .. code-block:: c /* Load from web URL */ - lv_gstreamer_set_src(streamer, LV_GSTREAMER_FACTORY_URI_DECODE, + lv_gstreamer_set_src(streamer, LV_GSTREAMER_FACTORY_URI_DECODE, LV_GSTREAMER_PROPERTY_URI_DECODE, "https://example.com/stream.webm"); - + /* Load from local file */ lv_gstreamer_set_src(streamer, LV_GSTREAMER_FACTORY_URI_DECODE, - LV_GSTREAMER_PROPERTY_URI_DECODE, + LV_GSTREAMER_PROPERTY_URI_DECODE, "file:///path/to/video.mp4"); - + /* RTSP stream */ lv_gstreamer_set_src(streamer, LV_GSTREAMER_FACTORY_URI_DECODE, LV_GSTREAMER_PROPERTY_URI_DECODE, @@ -213,17 +213,17 @@ Control media playback with these functions: lv_gstreamer_play(streamer); lv_gstreamer_pause(streamer); lv_gstreamer_stop(streamer); - + /* Get current state */ lv_gstreamer_state_t state = lv_gstreamer_get_state(streamer); - + /* Seek to position (in milliseconds) */ lv_gstreamer_set_position(streamer, 30000); /* Seek to 30 seconds */ - + /* Get current position and duration */ uint32_t position = lv_gstreamer_get_position(streamer); uint32_t duration = lv_gstreamer_get_duration(streamer); - + /* Set playback rate - values relative to 256 (1x speed) */ lv_gstreamer_set_rate(streamer, 128); /* 0.5x speed */ lv_gstreamer_set_rate(streamer, 256); /* 1.0x speed (normal) */ @@ -238,7 +238,7 @@ Manage audio volume with built-in controls: /* Set volume (0-100%) */ lv_gstreamer_set_volume(streamer, 75); - + /* Get current volume */ uint8_t volume = lv_gstreamer_get_volume(streamer); @@ -253,16 +253,16 @@ Handle GStreamer events using LVGL's event system: { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * streamer = lv_event_get_target_obj(e); - + if(code == LV_EVENT_READY) { - LV_LOG_USER("Stream ready - Duration: %" LV_PRIu32 " ms", + LV_LOG_USER("Stream ready - Duration: %" LV_PRIu32 " ms", lv_gstreamer_get_duration(streamer)); LV_LOG_USER("Resolution: %" LV_PRId32 "x%" LV_PRId32, lv_image_get_src_width(streamer), lv_image_get_src_height(streamer)); } } - + /* Add event callback */ lv_obj_add_event_cb(streamer, gstreamer_event_cb, LV_EVENT_ALL, NULL); @@ -291,7 +291,7 @@ Media Information Access Once media is loaded (LV_EVENT_READY), you can access: - Video resolution via ``lv_image_get_src_width()`` and ``lv_image_get_src_height()`` -- Media duration via ``lv_gstreamer_get_duration()`` +- Media duration via ``lv_gstreamer_get_duration()`` - Current playback position via ``lv_gstreamer_get_position()`` - Current volume level via ``lv_gstreamer_get_volume()`` - Current playback state via ``lv_gstreamer_get_state()`` @@ -301,7 +301,7 @@ Once media is loaded (LV_EVENT_READY), you can access: Examples ******** -.. include:: ../../examples/libs/gstreamer/index.rst +.. include:: ../../../examples/libs/gstreamer/index.rst .. _gstreamer_api: diff --git a/docs/src/details/libs/video_support/index.rst b/docs/src/details/libs/video_support/index.rst new file mode 100644 index 0000000000..0974463bbc --- /dev/null +++ b/docs/src/details/libs/video_support/index.rst @@ -0,0 +1,11 @@ +.. _libs_video_support: + +============= +Video Support +============= + +.. toctree:: + :maxdepth: 2 + + ffmpeg + gstreamer diff --git a/docs/src/details/main-modules/draw/index.rst b/docs/src/details/main-modules/draw/index.rst index 81ce958a01..4bd9b26319 100644 --- a/docs/src/details/main-modules/draw/index.rst +++ b/docs/src/details/main-modules/draw/index.rst @@ -11,3 +11,4 @@ Drawing draw_api draw_layers draw_descriptors + snapshot diff --git a/docs/src/details/auxiliary-modules/snapshot.rst b/docs/src/details/main-modules/draw/snapshot.rst similarity index 98% rename from docs/src/details/auxiliary-modules/snapshot.rst rename to docs/src/details/main-modules/draw/snapshot.rst index 2d4c81a96f..8d69b52639 100644 --- a/docs/src/details/auxiliary-modules/snapshot.rst +++ b/docs/src/details/main-modules/draw/snapshot.rst @@ -84,7 +84,7 @@ is large enough, and if it fails, destroy the existing draw buffer and call Example ******* -.. include:: ../../examples/others/snapshot/index.rst +.. include:: ../../../examples/others/snapshot/index.rst diff --git a/docs/src/details/main-modules/font.rst b/docs/src/details/main-modules/font.rst deleted file mode 100644 index e6435203e0..0000000000 --- a/docs/src/details/main-modules/font.rst +++ /dev/null @@ -1,549 +0,0 @@ -.. include:: /include/substitutions.txt -.. _font: - -============== -Font (lv_font) -============== - -In LVGL fonts are collections of bitmaps and other information required -to render images of individual letters (glyph). A font is stored in a -:cpp:type:`lv_font_t` variable and can be set in a style's *text_font* field. -For example: - -.. code-block:: c - - lv_style_set_text_font(&my_style, &lv_font_montserrat_28); /* Set a larger font */ - -Fonts have a **format** property. It describes how the glyph data is stored. -At the time of writing, there are 12 possible values that this field can take, and those -values fall into 2 categories: - -:Legacy simple: 1, 2, 4 or 8-bpp (aligned or unaligned) and image format, and -:Advanced: vector, SVG, and custom formats; for the latter, the user provides - the rendering logic. - -For simple formats: - -- the font is stored as an array of bitmaps, one bitmap per glyph; -- the value stored for each pixel determines the pixel's opacity, enabling edges - to be smoother --- higher bpp values result in smoother edges. - -For advanced formats, the font information is stored in its respective format. - -The **format** property also affects the amount of memory needed to store a -font. For example, ``format = LV_FONT_GLYPH_FORMAT_A4`` makes a font nearly four -times larger compared to ``format = LV_FONT_GLYPH_FORMAT_A1``. - - - -Unicode Support -*************** - -LVGL supports **UTF-8** encoded Unicode characters. Your editor needs to -be configured to save your code/text as UTF-8 (usually this the default) -and be sure that :c:macro:`LV_TXT_ENC` is set to :c:macro:`LV_TXT_ENC_UTF8` in -``lv_conf.h``. (This is the default value.) - -To test it try - -.. code-block:: c - - lv_obj_t * label1 = lv_label_create(lv_screen_active(), NULL); - lv_label_set_text(label1, LV_SYMBOL_OK); - -If all works well, a '\ |check|\ ' character should be displayed. - - -Typesetting -*********** - -Although LVGL can decode and display any Unicode characters -(assuming the font supports them), LVGL cannot correctly render -all complex languages. - -The standard Latin-based languages (e.g., English, Spanish, German) -and East Asian languages such as Chinese, Japanese, and Korean (CJK) -are relatively straightforward, as their characters are simply -written from left to right. - -Languages like Arabic, Persian, and Hebrew, which use Right-to-Left -(RTL) or mixed writing directions, are also supported in LVGL. -Learn more :ref:`here `. - -For characters such as '|eacute|', '|uuml|', '|otilde|', '|Aacute|', and '|Uacute|', -it is recommended to use the single Unicode format (NFC) rather than decomposing them -into a base letter and diacritics (e.g. ``u`` + |uml|). - -Complex languages where subsequent characters combine into a single glyph -and where the resulting glyph has no individual Unicode representation -(e.g., Devanagari), have limited support in LVGL. - - - -Built-In Fonts -************** - -There are several built-in fonts in different sizes, which can be -enabled in ``lv_conf.h`` with *LV_FONT_...* defines. - -Normal Fonts ------------- - -The following fonts contain all ASCII characters, the degree symbol (U+00B0), the -bullet symbol (U+2022) and the built-in symbols (see below). - -- :c:macro:`LV_FONT_MONTSERRAT_12`: 12 px font -- :c:macro:`LV_FONT_MONTSERRAT_14`: 14 px font -- :c:macro:`LV_FONT_MONTSERRAT_16`: 16 px font -- :c:macro:`LV_FONT_MONTSERRAT_18`: 18 px font -- :c:macro:`LV_FONT_MONTSERRAT_20`: 20 px font -- :c:macro:`LV_FONT_MONTSERRAT_22`: 22 px font -- :c:macro:`LV_FONT_MONTSERRAT_24`: 24 px font -- :c:macro:`LV_FONT_MONTSERRAT_26`: 26 px font -- :c:macro:`LV_FONT_MONTSERRAT_28`: 28 px font -- :c:macro:`LV_FONT_MONTSERRAT_30`: 30 px font -- :c:macro:`LV_FONT_MONTSERRAT_32`: 32 px font -- :c:macro:`LV_FONT_MONTSERRAT_34`: 34 px font -- :c:macro:`LV_FONT_MONTSERRAT_36`: 36 px font -- :c:macro:`LV_FONT_MONTSERRAT_38`: 38 px font -- :c:macro:`LV_FONT_MONTSERRAT_40`: 40 px font -- :c:macro:`LV_FONT_MONTSERRAT_42`: 42 px font -- :c:macro:`LV_FONT_MONTSERRAT_44`: 44 px font -- :c:macro:`LV_FONT_MONTSERRAT_46`: 46 px font -- :c:macro:`LV_FONT_MONTSERRAT_48`: 48 px font - -Special fonts -------------- - -- :c:macro:`LV_FONT_MONTSERRAT_28_COMPRESSED`: Same as normal 28 px font but stored as a :ref:`fonts_compressed` with 3 bpp -- :c:macro:`LV_FONT_DEJAVU_16_PERSIAN_HEBREW`: 16 px font with normal range + Hebrew, Arabic, Persian letters and all their forms -- :c:macro:`LV_FONT_SOURCE_HAN_SANS_SC_16_CJK`: 16 px font with normal range plus 1000 of the most common CJK radicals -- :c:macro:`LV_FONT_UNSCII_8`: 8 px pixel perfect font with only ASCII characters -- :c:macro:`LV_FONT_UNSCII_16`: 16 px pixel perfect font with only ASCII characters - -The built-in fonts are **global variables** with names like -:cpp:var:`lv_font_montserrat_16` for a 16 px height font. To use them in a -style, just add a pointer to a font variable like this: - -.. code-block:: c - - lv_style_set_text_font(&my_style, &lv_font_montserrat_28); - -The built-in fonts with ``bpp = 4`` contain the ASCII characters and use -the `Montserrat `__ font. - -In addition to the ASCII range, the following symbols are also added to -the built-in fonts from the `FontAwesome `__ -font. - -.. _fonts_symbols: - -.. image:: /_static/images/symbols.png - -The symbols can be used singly as: - -.. code-block:: c - - lv_label_set_text(my_label, LV_SYMBOL_OK); - -Or together with strings (compile time string concatenation): - -.. code-block:: c - - lv_label_set_text(my_label, LV_SYMBOL_OK "Apply"); - -Or more symbols together: - -.. code-block:: c - - lv_label_set_text(my_label, LV_SYMBOL_OK LV_SYMBOL_WIFI LV_SYMBOL_PLAY); - - - -Special Features -**************** - -.. _bidi: - -Bidirectional support ---------------------- - -Most languages use a Left-to-Right (LTR for short) writing direction, -however some languages (such as Hebrew, Persian or Arabic) use -Right-to-Left (RTL for short) direction. - -LVGL not only supports RTL text but supports mixed (a.k.a. -bidirectional, BiDi) text rendering as well. Some examples: - -.. image:: /_static/images/bidi.png - -BiDi support is enabled by setting :c:macro:`LV_USE_BIDI` to a non-zero value in ``lv_conf.h``. - -All text has a base direction (LTR or RTL) which determines some -rendering rules and the default alignment of the text (left or right). -However, in LVGL, the base direction is not only applied to labels. It's -a general property which can be set for every Widget. If not set then it -will be inherited from the parent. This means it's enough to set the -base direction of a screen and its child Widgets will inherit it. - -The default base direction for screens can be set by -:c:macro:`LV_BIDI_BASE_DIR_DEF` in ``lv_conf.h`` and other Widgets inherit the -base direction from their parent. - -To set a Widget's base direction use :cpp:expr:`lv_obj_set_style_base_dir(widget, base_dir, selector)`. -The possible base directions are: - -- :cpp:enumerator:`LV_BASE_DIR_LTR`: Left to Right base direction -- :cpp:enumerator:`LV_BASE_DIR_RTL`: Right to Left base direction -- :cpp:enumerator:`LV_BASE_DIR_AUTO`: Auto detect base direction - -This list summarizes the effect of RTL base direction on Widgets: - -- Create Widgets by default on the right -- ``lv_tabview``: Displays tabs from right to left -- ``lv_checkbox``: Shows the box on the right -- ``lv_buttonmatrix``: Orders buttons from right to left -- ``lv_list``: Shows icons on the right -- ``lv_dropdown``: Aligns options to the right -- The text strings in ``lv_table``, ``lv_buttonmatrix``, ``lv_keyboard``, ``lv_tabview``, - ``lv_dropdown``, ``lv_roller`` are "BiDi processed" to be displayed correctly - -Arabic and Persian support --------------------------- - -There are some special rules to display Arabic and Persian characters: -the *form* of a character depends on its position in the text. A -different form of the same letter needs to be used when it is isolated, -at start, middle or end positions. Besides these, some conjunction rules -should also be taken into account. - -LVGL supports these rules if :c:macro:`LV_USE_ARABIC_PERSIAN_CHARS` is enabled -in ``lv_conf.h``. - -However, there are some limitations: - -- Only displaying text is supported (e.g. on labels), i.e. text inputs (e.g. Text - Area) do not support this feature. -- Static text (i.e. const) is not processed. E.g. text set by :cpp:func:`lv_label_set_text` - will be "Arabic processed" but :cpp:func:`lv_label_set_text_static` will not. -- Text get functions (e.g. :cpp:func:`lv_label_get_text`) will return the processed text. - -.. _fonts_compressed: - -Compressed fonts ----------------- - -The built-in font engine supports compressed bitmaps. -Compressed fonts can be generated by - -- ticking the ``Compressed`` check box in the online converter -- not passing the ``--no-compress`` flag to the offline converter (compression is applied by default) - -Compression is more effective with larger fonts and higher bpp. However, -it's about 30% slower to render compressed fonts. Therefore, it is -recommended to compress only the largest fonts of a user interface, -because - -- they need the most memory -- they can be compressed better -- and on the likelihood that they are used less frequently than the medium-sized - fonts, the performance cost will be smaller. - -Compressed fonts also support ``bpp=3``. - -Kerning -------- - -Fonts may provide kerning information to adjust the spacing between specific -characters. - -- The online converter generates kerning tables. -- The offline converter generates kerning tables unless ``--no-kerning`` is - specified. -- FreeType integration does not currently support kerning. -- The Tiny TTF font engine supports GPOS (Glyph Positioning) and Kern tables. - -To configure kerning at runtime, use :cpp:func:`lv_font_set_kerning`. - - - -.. _add_font: - -Adding a New Font -***************** - -There are several ways to add a new font to your project: - -1. The simplest method is to use the `Online font converter `__. - Just set the parameters, click the *Convert* button, copy the font to your project - and use it. **Be sure to carefully read the steps provided on that site - or you will get an error while converting.** -2. Use the `Offline font converter `__. - (Requires Node.js to be installed) -3. If you want to create something like the built-in - fonts (Montserrat font and symbols) but in a different size and/or - ranges, you can use the ``built_in_font_gen.py`` script in - ``lvgl/scripts/built_in_font`` folder. (This requires Python and - https://github.com/lvgl/lv_font_conv/ to be installed.) - -To declare a font in a file, use :cpp:expr:`LV_FONT_DECLARE(my_font_name)`. - -To make fonts globally available (like the built-in fonts), add them to -:c:macro:`LV_FONT_CUSTOM_DECLARE` in ``lv_conf.h``. - - - -Adding New Symbols -****************** - -The built-in symbols are created from the `FontAwesome `__ font. - -1. Search for a symbol on https://fontawesome.com. For example the - `USB symbol `__. Copy its - Unicode ID which is ``0xf287``. -2. Open the `Online font converter `__. - Add `FontAwesome.woff `__. -3. Set the parameters such as Name, Size, BPP. You'll use this name to - declare and use the font in your code. -4. Add the Unicode ID of the symbol to the range field. E.g. ``0xf287`` - for the USB symbol. More symbols can be enumerated with ``,``. -5. Convert the font and copy the generated source code to your project. - Make sure to compile the ``.c`` file of your font. -6. Declare the font using ``extern lv_font_t my_font_name;`` or simply - use :cpp:expr:`LV_FONT_DECLARE(my_font_name)`. - -**Using the symbol** - -1. Convert the Unicode value to UTF8, for example on - `this site `__. - For ``0xf287`` the *Hex UTF-8 bytes* are ``EF 8A 87``. -2. Create a ``#define`` string from the UTF8 values: ``#define MY_USB_SYMBOL "\xEF\x8A\x87"`` -3. Create a label and set the text. Eg. :cpp:expr:`lv_label_set_text(label, MY_USB_SYMBOL)` - -:note: :cpp:expr:`lv_label_set_text(label, MY_USB_SYMBOL)` searches for this symbol - in the font defined in the style's ``text.font`` property. To use the symbol - you will need to set the style's text font to use the generated font, e.g. - :cpp:expr:`lv_style_set_text_font(&my_style, &my_font_name)` or - :cpp:expr:`lv_obj_set_style_text_font(label, &my_font_name, 0)`. - - - -Loading a Font at Run-Time -************************** - -:cpp:func:`lv_binfont_create` can be used to load a font from a file. The font needs -to have a special binary format. (Not TTF or WOFF). Use -`lv_font_conv `__ with the -``--format bin`` option to generate an LVGL compatible font file. - -:note: To load a font :ref:`LVGL's filesystem ` - needs to be enabled and a driver must be added. - -Example - -.. code-block:: c - - lv_font_t *my_font = lv_binfont_create("X:/path/to/my_font.bin"); - if(my_font == NULL) return; - - /* Use the font */ - - /* Free the font if not required anymore */ - lv_binfont_destroy(my_font); - - - -Loading a Font from a Memory Buffer at Run-Time -*********************************************** - -:cpp:func:`lv_binfont_create_from_buffer` can be used to load a font from a memory buffer. -This function may be useful to load a font from an external file system, which is not -supported by LVGL. The font needs to be in the same format as if it were loaded from a file. - -:note: To load a font from a buffer :ref:`LVGL's filesystem ` - needs to be enabled and the MEMFS driver must be added. - -Example - -.. code-block:: c - - lv_font_t *my_font; - uint8_t *buf; - uint32_t bufsize; - - /* Read font file into the buffer from the external file system */ - ... - - /* Load font from the buffer */ - my_font = lv_binfont_create_from_buffer((void *)buf, buf)); - if(my_font == NULL) return; - /* Use the font */ - - /* Free the font if not required anymore */ - lv_binfont_destroy(my_font); - - -Using a BDF Font -**************** - -Small displays with low resolution don't look pretty with automatically rendered fonts. A bitmap font provides -the solution, but it's necessary to convert the bitmap font (BDF) to a TTF. - -Convert BDF to TTF ------------------- - -BDF are bitmap fonts where fonts are not described in outlines but in pixels. BDF files can be used but -they must be converted into the TTF format using ``mkttf``, which can be found -in this GitHub repository: https://github.com/Tblue/mkttf . This tool uses potrace to generate outlines from -the bitmap information. The bitmap itself will be embedded into the TTF as well. `lv_font_conv `__ uses -the embedded bitmap but it also needs the outlines. One might think you can use a fake MS Bitmap -only sfnt (ttf) (TTF without outlines) created by fontforge, but this will not work. - -Install imagemagick, python3, python3-fontforge and potrace - -On Ubuntu Systems, just type - -.. code:: bash - - sudo apt install imagemagick python3-fontforge potrace - -Clone mkttf - -.. code:: bash - - git clone https://github.com/Tblue/mkttf - -Read the mkttf docs. - -Former versions of imagemagick needs the imagemagick call in front of convert, identify and so on. -But newer versions don't. So you might want to change 2 lines in ``potrace-wrapper.sh`` --- -open ``potrace-wrapper.sh`` and remove imagemagick from line 55 and line 64: - -line 55 - -.. code:: bash - - wh=($(identify -format '%[width]pt %[height]pt' "${input?}")) - -line 64 - -.. code:: bash - - convert "${input?}" -sample '1000%' - \ - -It might be necessary to change the mkttf.py script. - -line 1 - -.. code:: bash - - #!/usr/bin/env python3 - -Example for a 12px font ------------------------ - -.. code-block:: console - - cd mkttf - ./mkttf.py ./TerminusMedium-12-12.bdf - Importing bitmaps from 0 additional fonts... - Importing font `./TerminusMedium-12-12.bdf' into glyph background... - Processing glyphs... - Saving TTF file... - Saving SFD file... - Done! - -The TTF ``TerminusMedium-001.000.ttf`` will be created from ``./TerminusMedium-12-12.bdf``. - -To create a font for LVGL: - -.. code:: bash - - lv_font_conv --bpp 1 --size 12 --no-compress --font TerminusMedium-001.000.ttf --range 0x20-0x7e,0xa1-0xff --format lvgl -o terminus_1bpp_12px.c - -:note: use 1-bpp because we don't use anti-aliasing. It doesn't look sharp on displays with a low resolution. - - - -Adding a New Font Engine -************************ - -LVGL's font interface is designed to be very flexible but, even so, you -can add your own font engine in place of LVGL's internal one. For -example, you can use `FreeType `__ to -real-time render glyphs from TTF fonts or use an external flash to store -the font's bitmap and read them when the library needs them. FreeType can be used in LVGL as described in :ref:`Freetype `. - -To add a new font engine, a custom :cpp:type:`lv_font_t` variable needs to be created: - -.. code-block:: c - - /* Describe the properties of a font */ - lv_font_t my_font; - my_font.get_glyph_dsc = my_get_glyph_dsc_cb; /* Set a callback to get info about glyphs */ - my_font.get_glyph_bitmap = my_get_glyph_bitmap_cb; /* Set a callback to get bitmap of a glyph */ - my_font.line_height = height; /* The real line height where any text fits */ - my_font.base_line = base_line; /* Base line measured from the top of line_height */ - my_font.dsc = something_required; /* Store any implementation specific data here */ - my_font.user_data = user_data; /* Optionally some extra user data */ - - ... - - /* Get info about glyph of `unicode_letter` in `font` font. - * Store the result in `dsc_out`. - * The next letter (`unicode_letter_next`) might be used to calculate the width required by this glyph (kerning) - */ - bool my_get_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) - { - /* Your code here */ - - /* Store the result. - * For example ... - */ - dsc_out->adv_w = 12; /* Horizontal space required by the glyph in [px] */ - dsc_out->box_h = 8; /* Height of the bitmap in [px] */ - dsc_out->box_w = 6; /* Width of the bitmap in [px] */ - dsc_out->ofs_x = 0; /* X offset of the bitmap in [pf] */ - dsc_out->ofs_y = 3; /* Y offset of the bitmap measured from the as line */ - dsc_out->format= LV_FONT_GLYPH_FORMAT_A2; - - return true; /* true: glyph found; false: glyph was not found */ - } - - - /* Get the bitmap of `unicode_letter` from `font`. */ - const uint8_t * my_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) - { - /* Your code here */ - - /* The bitmap should be a continuous bitstream where - * each pixel is represented by `bpp` bits */ - - return bitmap; /* Or NULL if not found */ - } - - - -Using Font Fallback -******************* - -If the font in use does not have a glyph needed in a text-rendering task, you can -specify a ``fallback`` font to be used in :cpp:type:`lv_font_t`. - -``fallback`` can be chained, so it will try to solve until there is no ``fallback`` set. - -.. code-block:: c - - /* Roboto font doesn't have support for CJK glyphs */ - lv_font_t *roboto = my_font_load_function(); - /* Droid Sans Fallback has more glyphs but its typeface doesn't look good as Roboto */ - lv_font_t *droid_sans_fallback = my_font_load_function(); - /* So now we can display Roboto for supported characters while having wider characters set support */ - roboto->fallback = droid_sans_fallback; - - - -.. _fonts_api: - -API -*** diff --git a/docs/src/details/main-modules/fonts/bdf_fonts.rst b/docs/src/details/main-modules/fonts/bdf_fonts.rst new file mode 100644 index 0000000000..2048ebb0d9 --- /dev/null +++ b/docs/src/details/main-modules/fonts/bdf_fonts.rst @@ -0,0 +1,88 @@ + +.. _bdf_font: + +======== +BDF Font +======== + +Overview +******** + +Small displays with low resolution don't look pretty with automatically rendered fonts. A bitmap font provides +the solution, but it's necessary to convert the bitmap font (BDF) to a TTF. + +Convert BDF to TTF +****************** + +BDF are bitmap fonts where fonts are not described in outlines but in pixels. BDF files can be used but +they must be converted into the TTF format using ``mkttf``, which can be found +in this GitHub repository: https://github.com/Tblue/mkttf . This tool uses potrace to generate outlines from +the bitmap information. The bitmap itself will be embedded into the TTF as well. `lv_font_conv `__ uses +the embedded bitmap but it also needs the outlines. One might think you can use a fake MS Bitmap +only sfnt (ttf) (TTF without outlines) created by fontforge, but this will not work. + +Install imagemagick, python3, python3-fontforge and potrace + +On Ubuntu Systems, just type + +.. code:: bash + + sudo apt install imagemagick python3-fontforge potrace + +Clone mkttf + +.. code:: bash + + git clone https://github.com/Tblue/mkttf + +Read the mkttf docs. + +Former versions of imagemagick needs the imagemagick call in front of convert, identify and so on. +But newer versions don't. So you might want to change 2 lines in ``potrace-wrapper.sh`` --- +open ``potrace-wrapper.sh`` and remove imagemagick from line 55 and line 64: + +line 55 + +.. code:: bash + + wh=($(identify -format '%[width]pt %[height]pt' "${input?}")) + +line 64 + +.. code:: bash + + convert "${input?}" -sample '1000%' - \ + +It might be necessary to change the mkttf.py script. + +line 1 + +.. code:: bash + + #!/usr/bin/env python3 + +Example +******* + +.. code-block:: console + + cd mkttf + ./mkttf.py ./TerminusMedium-12-12.bdf + Importing bitmaps from 0 additional fonts... + Importing font `./TerminusMedium-12-12.bdf' into glyph background... + Processing glyphs... + Saving TTF file... + Saving SFD file... + Done! + +The TTF ``TerminusMedium-001.000.ttf`` will be created from ``./TerminusMedium-12-12.bdf``. + +To create a font for LVGL: + +.. code:: bash + + lv_font_conv --bpp 1 --size 12 --no-compress --font TerminusMedium-001.000.ttf --range 0x20-0x7e,0xa1-0xff --format lvgl -o terminus_1bpp_12px.c + +:note: use 1-bpp because we don't use anti-aliasing. It doesn't look sharp on displays with a low resolution. + + diff --git a/docs/src/details/main-modules/fonts/binfont_loader.rst b/docs/src/details/main-modules/fonts/binfont_loader.rst new file mode 100644 index 0000000000..9fafc4a6c4 --- /dev/null +++ b/docs/src/details/main-modules/fonts/binfont_loader.rst @@ -0,0 +1,65 @@ + +.. _binfont_loader: + +============== +BinFont Loader +============== + +Overview +******** + +:cpp:func:`lv_binfont_create` can be used to load a font from a file. The font needs +to have a special binary format. (Not TTF or WOFF). Use +`lv_font_conv `__ with the +``--format bin`` option to generate an LVGL compatible font file. + +Loading from File +***************** + +:note: To load a font :ref:`LVGL's filesystem ` + needs to be enabled and a driver must be added. + +Example + +.. code-block:: c + + lv_font_t *my_font = lv_binfont_create("X:/path/to/my_font.bin"); + if(my_font == NULL) return; + + /* Use the font */ + + /* Free the font if not required anymore */ + lv_binfont_destroy(my_font); + + + +Loading from Memory +******************* + +:cpp:func:`lv_binfont_create_from_buffer` can be used to load a font from a memory buffer. +This function may be useful to load a font from an external file system, which is not +supported by LVGL. The font needs to be in the same format as if it were loaded from a file. + +:note: To load a font from a buffer :ref:`LVGL's filesystem ` + needs to be enabled and the MEMFS driver must be added. + +Example + +.. code-block:: c + + lv_font_t *my_font; + uint8_t *buf; + uint32_t bufsize; + + /* Read font file into the buffer from the external file system */ + ... + + /* Load font from the buffer */ + my_font = lv_binfont_create_from_buffer((void *)buf, buf)); + if(my_font == NULL) return; + /* Use the font */ + + /* Free the font if not required anymore */ + lv_binfont_destroy(my_font); + + diff --git a/docs/src/details/main-modules/fonts/built_in_fonts.rst b/docs/src/details/main-modules/fonts/built_in_fonts.rst new file mode 100644 index 0000000000..58d0ecea6f --- /dev/null +++ b/docs/src/details/main-modules/fonts/built_in_fonts.rst @@ -0,0 +1,114 @@ +.. _built_in_fonts: + +============== +Built-In Fonts +============== + +Overview +******** + +There are several built-in fonts in different sizes, which can be +enabled in ``lv_conf.h`` with *LV_FONT_...* defines. + + +The built-in fonts are **global variables** with names like +:cpp:var:`lv_font_montserrat_16` for a 16 px height font. To use them in a +style, just add a pointer to a font variable like this: + +.. code-block:: c + + lv_style_set_text_font(&my_style, &lv_font_montserrat_28); + + +The built-in fonts with ``bpp = 4`` contain the ASCII characters and use +the `Montserrat `__ font. + +In addition to the ASCII range all the :ref:`predefined symbols ` are +added to the built-in fonts from the +`FontAwesome `__ font. + + +Normal Fonts +************ + +The following fonts contain all ASCII characters, the degree symbol (U+00B0), the +bullet symbol (U+2022) and the built-in symbols (see below). + +- :c:macro:`LV_FONT_MONTSERRAT_12`: 12 px font +- :c:macro:`LV_FONT_MONTSERRAT_14`: 14 px font +- :c:macro:`LV_FONT_MONTSERRAT_16`: 16 px font +- :c:macro:`LV_FONT_MONTSERRAT_18`: 18 px font +- :c:macro:`LV_FONT_MONTSERRAT_20`: 20 px font +- :c:macro:`LV_FONT_MONTSERRAT_22`: 22 px font +- :c:macro:`LV_FONT_MONTSERRAT_24`: 24 px font +- :c:macro:`LV_FONT_MONTSERRAT_26`: 26 px font +- :c:macro:`LV_FONT_MONTSERRAT_28`: 28 px font +- :c:macro:`LV_FONT_MONTSERRAT_30`: 30 px font +- :c:macro:`LV_FONT_MONTSERRAT_32`: 32 px font +- :c:macro:`LV_FONT_MONTSERRAT_34`: 34 px font +- :c:macro:`LV_FONT_MONTSERRAT_36`: 36 px font +- :c:macro:`LV_FONT_MONTSERRAT_38`: 38 px font +- :c:macro:`LV_FONT_MONTSERRAT_40`: 40 px font +- :c:macro:`LV_FONT_MONTSERRAT_42`: 42 px font +- :c:macro:`LV_FONT_MONTSERRAT_44`: 44 px font +- :c:macro:`LV_FONT_MONTSERRAT_46`: 46 px font +- :c:macro:`LV_FONT_MONTSERRAT_48`: 48 px font + +Special Fonts +************* + +- :c:macro:`LV_FONT_MONTSERRAT_28_COMPRESSED`: Same as normal 28 px font but stored as a :ref:`fonts_compressed` with 3 bpp +- :c:macro:`LV_FONT_DEJAVU_16_PERSIAN_HEBREW`: 16 px font with normal range + Hebrew, Arabic, Persian letters and all their forms +- :c:macro:`LV_FONT_SOURCE_HAN_SANS_SC_16_CJK`: 16 px font with normal range plus 1000 of the most common CJK radicals +- :c:macro:`LV_FONT_UNSCII_8`: 8 px pixel perfect font with only ASCII characters +- :c:macro:`LV_FONT_UNSCII_16`: 16 px pixel perfect font with only ASCII characters + + +.. _add_new_builtin_font: + +Adding a New Font +***************** + +There are several ways to add a new font to your project: + +1. The simplest method is to use the `Online font converter `__. + Just set the parameters, click the *Convert* button, copy the font to your project + and use it. **Be sure to carefully read the steps provided on that site + or you will get an error while converting.** +2. Use the `Offline font converter `__. + (Requires Node.js to be installed) +3. If you want to create something like the built-in + fonts (Montserrat font and symbols) but in a different size and/or + ranges, you can use the ``built_in_font_gen.py`` script in + ``lvgl/scripts/built_in_font`` folder. (This requires Python and + https://github.com/lvgl/lv_font_conv/ to be installed.) + +To declare a font in a file, use :cpp:expr:`LV_FONT_DECLARE(my_font_name)`. + +To make fonts globally available (like the built-in fonts), add them to +:c:macro:`LV_FONT_CUSTOM_DECLARE` in ``lv_conf.h``. + + +.. _fonts_compressed: + +Compressed Fonts +**************** + +The built-in font engine supports compressed bitmaps. +Compressed fonts can be generated by + +- ticking the ``Compressed`` check box in the online converter +- not passing the ``--no-compress`` flag to the offline converter (compression is applied by default) + +Compression is more effective with larger fonts and higher bpp. However, +it's about 30% slower to render compressed fonts. Therefore, it is +recommended to compress only the largest fonts of a user interface, +because + +- they need the most memory +- they can be compressed better +- and on the likelihood that they are used less frequently than the medium-sized + fonts, the performance cost will be smaller. + +Compressed fonts also support ``bpp=3``. + diff --git a/docs/src/details/auxiliary-modules/font_manager.rst b/docs/src/details/main-modules/fonts/font_manager.rst similarity index 98% rename from docs/src/details/auxiliary-modules/font_manager.rst rename to docs/src/details/main-modules/fonts/font_manager.rst index 4720debd16..a2fec8b7c7 100644 --- a/docs/src/details/auxiliary-modules/font_manager.rst +++ b/docs/src/details/main-modules/fonts/font_manager.rst @@ -127,7 +127,7 @@ being referenced, the font manager will fail to be destroyed and the function wi Example ******* -.. include:: ../../examples/others/font_manager/index.rst +.. include:: ../../../examples/others/font_manager/index.rst diff --git a/docs/src/details/auxiliary-modules/imgfont.rst b/docs/src/details/main-modules/fonts/imgfont.rst similarity index 94% rename from docs/src/details/auxiliary-modules/imgfont.rst rename to docs/src/details/main-modules/fonts/imgfont.rst index b0af49369c..32df2ee511 100644 --- a/docs/src/details/auxiliary-modules/imgfont.rst +++ b/docs/src/details/main-modules/fonts/imgfont.rst @@ -43,7 +43,7 @@ To destroy the *imgfont* that is no longer used, use :cpp:expr:`lv_imgfont_destr Example ******* -.. include:: ../../examples/others/imgfont/index.rst +.. include:: ../../../examples/others/imgfont/index.rst diff --git a/docs/src/details/main-modules/fonts/index.rst b/docs/src/details/main-modules/fonts/index.rst new file mode 100644 index 0000000000..78d9ecb296 --- /dev/null +++ b/docs/src/details/main-modules/fonts/index.rst @@ -0,0 +1,20 @@ +.. _fonts: + +=============== +Fonts (lv_font) +=============== + +.. toctree:: + :maxdepth: 2 + + overview + built_in_fonts + binfont_loader + ../../libs/font_support/tiny_ttf + ../../libs/font_support/freetype + imgfont + bdf_fonts + rtl + new_font_engine + font_manager + diff --git a/docs/src/details/main-modules/fonts/new_font_engine.rst b/docs/src/details/main-modules/fonts/new_font_engine.rst new file mode 100644 index 0000000000..0c2f579ada --- /dev/null +++ b/docs/src/details/main-modules/fonts/new_font_engine.rst @@ -0,0 +1,88 @@ + +.. _new_font_engine: + +======================== +Adding a New Font Engine +======================== + +Overview +******** + +Fonts have a **format** property. It describes how the glyph data is stored. +At the time of writing, there are several possible values that this field can take, and those +values fall into 2 categories: + +1. **Bitmap based**: 1, 2, 4 or 8-bpp and image format, and +2. **Vector based** vector, SVG; for the latter, the user provides the rendering logic. + +For simple formats: + +- the font is stored as an array of bitmaps, one bitmap per glyph; +- the value stored for each pixel determines the pixel's opacity, enabling edges + to be smoother --- higher bpp values result in smoother edges. + +For advanced formats, the font information is stored in its respective format. + +The **format** property also affects the amount of memory needed to store a +font. For example, ``format = LV_FONT_GLYPH_FORMAT_A4`` makes a font nearly four +times larger compared to ``format = LV_FONT_GLYPH_FORMAT_A1``. + +Example +******* + +LVGL's font interface is designed to be very flexible but, even so, you +can add your own font engine in place of LVGL's internal one. For +example, you can use `FreeType `__ to +real-time render glyphs from TTF fonts or use an external flash to store +the font's bitmap and read them when the library needs them. FreeType can be used in LVGL as described in :ref:`Freetype `. + +To add a new font engine, a custom :cpp:type:`lv_font_t` variable needs to be created: + +.. code-block:: c + + /* Describe the properties of a font */ + lv_font_t my_font; + my_font.get_glyph_dsc = my_get_glyph_dsc_cb; /* Set a callback to get info about glyphs */ + my_font.get_glyph_bitmap = my_get_glyph_bitmap_cb; /* Set a callback to get bitmap of a glyph */ + my_font.line_height = height; /* The real line height where any text fits */ + my_font.base_line = base_line; /* Base line measured from the top of line_height */ + my_font.dsc = something_required; /* Store any implementation specific data here */ + my_font.user_data = user_data; /* Optionally some extra user data */ + + ... + + /* Get info about glyph of `unicode_letter` in `font` font. + * Store the result in `dsc_out`. + * The next letter (`unicode_letter_next`) might be used to calculate the width required by this glyph (kerning) + */ + bool my_get_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) + { + /* Your code here */ + + /* Store the result. + * For example ... + */ + dsc_out->adv_w = 12; /* Horizontal space required by the glyph in [px] */ + dsc_out->box_h = 8; /* Height of the bitmap in [px] */ + dsc_out->box_w = 6; /* Width of the bitmap in [px] */ + dsc_out->ofs_x = 0; /* X offset of the bitmap in [px] */ + dsc_out->ofs_y = 3; /* Y offset of the bitmap measured from the as line */ + dsc_out->format= LV_FONT_GLYPH_FORMAT_A2; + + return true; /* true: glyph found; false: glyph was not found */ + } + + + /* Get the bitmap of `unicode_letter` from `font`. */ + const uint8_t * my_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) + { + /* Your code here */ + + /* The bitmap should be a continuous bitstream where + * each pixel is represented by `bpp` bits */ + + return bitmap; /* Or NULL if not found */ + } + + + diff --git a/docs/src/details/main-modules/fonts/overview.rst b/docs/src/details/main-modules/fonts/overview.rst new file mode 100644 index 0000000000..0bbfa6f783 --- /dev/null +++ b/docs/src/details/main-modules/fonts/overview.rst @@ -0,0 +1,188 @@ +.. |check| unicode:: U+02713 .. CHECK MARK +.. |Aacute| unicode:: U+000C1 .. LATIN CAPITAL LETTER A WITH ACUTE +.. |eacute| unicode:: U+000E9 .. LATIN SMALL LETTER E WITH ACUTE +.. |otilde| unicode:: U+000F5 .. LATIN SMALL LETTER O WITH TILDE +.. |Utilde| unicode:: U+00168 .. LATIN CAPITAL LETTER U WITH TILDE +.. |uuml| unicode:: U+000FC .. LATIN SMALL LETTER U WITH DIAERESIS +.. |uml| unicode:: U+000A8 .. DIAERESIS + +.. _font: + +======== +Overview +======== + +What is a Font? +*************** + +In LVGL fonts are collections of bitmaps and other information required +to render the images of the individual letters (glyphs). A font is stored in a +:cpp:type:`lv_font_t` variable and can be set in a style's *text_font* field. +For example: + +.. code-block:: c + + lv_style_set_text_font(&my_style, &lv_font_montserrat_28); /* Set a larger font */ + +Font Engines +************ + +A font engine is some C code that allows LVGL to extract various information +from the fonts, such as character (glyph) information or bitmap. + +LVGL's built-in font engine is suitable for most typical cases. +It can handle various bit-per-pixel settings (1, 2, 3, 4, 8) in bitmaps, +kerning, having only selected character ranges from multiple fonts, +compressing bitmaps, and several others. + +The built-in font engine is also the easiest to use: + +1. Go to https://lvgl.io/tools/fontconverter +2. Upload font(s) and set the ranges and/or specify a list of characters to include and other parameters +3. Click the "Submit" button and copy the generated file to your project +4. In a C file add :cpp:expr:`LV_FONT_DECLARE(font_name)` to declare the font +5. Use the font like ``lv_style_set_text_font(&my_style, &font_name);`` + or ``lv_obj_set_style_text_font(label1, &font_name, 0);`` + +LVGL also supports several other font engines: + +- ``fmt_txt``: This is the built-in font engine that stores the fonts as a C array +- ``binfont``: Similar to the built-in format, but the font is stored as a file, so it can be loaded at runtime too +- ``tiny_ttf``: Small vector graphics engine to load TTF files at runtime at any size +- ``freetype``: Well known font rendering library load and render TTF fonts at runtime. Also supports letter strokes. + +Unicode Support +*************** + +LVGL supports **UTF-8** encoded Unicode characters. Your editor needs to +be configured to save your code/text as UTF-8 (usually this is the default) +and be sure that :c:macro:`LV_TXT_ENC` is set to :c:macro:`LV_TXT_ENC_UTF8` in +``lv_conf.h``. (This is the default value.) + +To test it try + +.. code-block:: c + + lv_obj_t * label1 = lv_label_create(lv_screen_active(), NULL); + lv_label_set_text(label1, LV_SYMBOL_OK); + +If all works well, a '\ |check|\ ' character should be displayed. + + +Typesetting +*********** + +Although LVGL can decode and display any Unicode characters +(assuming the font supports them), LVGL cannot correctly render +all complex languages. + +The standard Latin-based languages (e.g., English, Spanish, German) +and East Asian languages such as Chinese, Japanese, and Korean (CJK) +are relatively straightforward, as their characters are simply +written from left to right. + +Languages like Arabic, Persian, and Hebrew, which use Right-to-Left +(RTL) or mixed writing directions, are also supported in LVGL. +Learn more :ref:`here `. + +For characters such as '|eacute|', '|uuml|', '|otilde|', '|Aacute|', and '|Utilde|', +it is recommended to use the single Unicode format (NFC) rather than decomposing them +into a base letter and diacritics (e.g. ``u`` + |uml|). + +Complex languages where subsequent characters combine into a single glyph +and where the resulting glyph has no individual Unicode representation +(e.g., Devanagari), have limited support in LVGL. + + +Kerning +******* + +Fonts usually provide kerning information to adjust the spacing between specific +characters. + +- The `Online converter `__ generates kerning tables. +- The `Offline converter `__ generates kerning tables unless ``--no-kerning`` is + specified. +- FreeType integration does not currently support kerning. +- The Tiny TTF font engine supports GPOS (Glyph Positioning) and Kern tables. + +To configure kerning at runtime, use :cpp:func:`lv_font_set_kerning`. + + +Using Font Fallback +******************* + +If the font in use does not have a glyph needed in a text-rendering task, you can +specify a ``fallback`` font to be used in :cpp:type:`lv_font_t`. + +``fallback`` can be chained, so it will try to solve until there is no ``fallback`` set. + +.. code-block:: c + + /* Roboto font doesn't have support for CJK glyphs */ + lv_font_t *roboto = my_font_load_function(); + /* Droid Sans Fallback has more glyphs but its typeface doesn't look good as Roboto */ + lv_font_t *droid_sans_fallback = my_font_load_function(); + /* So now we can display Roboto for supported characters while having wider characters set support */ + roboto->fallback = droid_sans_fallback; + + +.. _font_symbols: + +Symbols +******* + +LVGL supports some predefined "symbols". A symbol is a specific Unicode character +in a font with an icon-like image. The symbols have names like ``LV_SYMBOL_OK``, +``LV_SYMBOL_HOME``, etc. See the full list of predefined symbols below: + +.. image:: /_static/images/symbols.png + +The symbols in the :ref:`built-in fonts ` are created from +the `FontAwesome `__ font. + +Using these symbols is very simple: + + +.. code-block:: c + + lv_label_set_text(label, LV_SYMBOL_OK); /*Just a symbol*/ + lv_label_set_text(label, LV_SYMBOL_OK "Apply"); /*Concatenate with a string*/ + + +To add a new symbol in a custom font: + +1. Search for a symbol on https://fontawesome.com. For example the + `USB symbol `__. Copy its + Unicode ID which is ``0xf287``. +2. Open the `Online font converter `__. + Add `FontAwesome.woff `__. +3. Set the parameters such as Name, Size, BPP. You'll use this name to + declare and use the font in your code. +4. Add the Unicode ID of the symbol to the range field. E.g. ``0xf287`` + for the USB symbol. More symbols can be enumerated with ``,``. +5. Convert the font and copy the generated source code to your project. + Make sure to compile the ``.c`` file of your font. +6. Declare the font using :cpp:expr:`LV_FONT_DECLARE(my_font_name)`. + +**Using the symbol** + +1. Convert the Unicode value to UTF8, for example on + `this site `__. + For ``0xf287`` the *Hex UTF-8 bytes* are ``EF 8A 87``. +2. Create a ``#define`` string from the UTF8 values: ``#define MY_USB_SYMBOL "\xEF\x8A\x87"`` +3. Create a label and set the text. Eg. :cpp:expr:`lv_label_set_text(label, MY_USB_SYMBOL)` + +:note: :cpp:expr:`lv_label_set_text(label, MY_USB_SYMBOL)` searches for this symbol + in the font defined in the style's ``text.font`` property. To use the symbol + you will need to set the style's text font to use the generated font, e.g. + :cpp:expr:`lv_style_set_text_font(&my_style, &my_font_name)` or + :cpp:expr:`lv_obj_set_style_text_font(label, &my_font_name, 0)`. + +Of course any other fonts can be used, just make sure that they define the +symbols you need. + +.. _fonts_api: + +API +*** diff --git a/docs/src/details/main-modules/fonts/rtl.rst b/docs/src/details/main-modules/fonts/rtl.rst new file mode 100644 index 0000000000..f84edc5608 --- /dev/null +++ b/docs/src/details/main-modules/fonts/rtl.rst @@ -0,0 +1,73 @@ + + +.. _bidi: + + +===================== +Bidirectional Support +===================== + + +Overview +******** + +Most languages use a Left-to-Right (LTR for short) writing direction, +however some languages (such as Hebrew, Persian or Arabic) use +Right-to-Left (RTL for short) direction. + +LVGL not only supports RTL text but supports mixed (a.k.a. +bidirectional, BiDi) text rendering as well. Some examples: + +.. image:: /_static/images/bidi.png + +BiDi support is enabled by setting :c:macro:`LV_USE_BIDI` to a non-zero value in ``lv_conf.h``. + +All text has a base direction (LTR or RTL) which determines some +rendering rules and the default alignment of the text (left or right). +However, in LVGL, the base direction is not only applied to labels. It's +a general property which can be set for every Widget. If not set then it +will be inherited from the parent. This means it's enough to set the +base direction of a screen and its child Widgets will inherit it. + +The default base direction for screens can be set by +:c:macro:`LV_BIDI_BASE_DIR_DEF` in ``lv_conf.h`` and other Widgets inherit the +base direction from their parent. + +To set a Widget's base direction use :cpp:expr:`lv_obj_set_style_base_dir(widget, base_dir, selector)`. +The possible base directions are: + +- :cpp:enumerator:`LV_BASE_DIR_LTR`: Left to Right base direction +- :cpp:enumerator:`LV_BASE_DIR_RTL`: Right to Left base direction +- :cpp:enumerator:`LV_BASE_DIR_AUTO`: Auto detect base direction + +This list summarizes the effect of RTL base direction on Widgets: + +- Create Widgets by default on the right +- ``lv_tabview``: Displays tabs from right to left +- ``lv_checkbox``: Shows the box on the right +- ``lv_buttonmatrix``: Orders buttons from right to left +- ``lv_list``: Shows icons on the right +- ``lv_dropdown``: Aligns options to the right +- The text strings in ``lv_table``, ``lv_buttonmatrix``, ``lv_keyboard``, ``lv_tabview``, + ``lv_dropdown``, ``lv_roller`` are "BiDi processed" to be displayed correctly + +Arabic and Persian support +************************** + +There are some special rules to display Arabic and Persian characters: +the *form* of a character depends on its position in the text. A +different form of the same letter needs to be used when it is isolated, +at start, middle or end positions. Besides these, some conjunction rules +should also be taken into account. + +LVGL supports these rules if :c:macro:`LV_USE_ARABIC_PERSIAN_CHARS` is enabled +in ``lv_conf.h``. + +However, there are some limitations: + +- Only displaying text is supported (e.g. on labels), i.e. text inputs (e.g. Text + Area) do not support this feature. +- Static text (i.e. const) is not processed. E.g. text set by :cpp:func:`lv_label_set_text` + will be "Arabic processed" but :cpp:func:`lv_label_set_text_static` will not. +- Text get functions (e.g. :cpp:func:`lv_label_get_text`) will return the processed text. + diff --git a/docs/src/details/auxiliary-modules/gridnav.rst b/docs/src/details/main-modules/indev/gridnav.rst similarity index 97% rename from docs/src/details/auxiliary-modules/gridnav.rst rename to docs/src/details/main-modules/indev/gridnav.rst index 07c235a174..106b777825 100644 --- a/docs/src/details/auxiliary-modules/gridnav.rst +++ b/docs/src/details/main-modules/indev/gridnav.rst @@ -4,6 +4,10 @@ Grid navigation =============== + +Overview +******** + Grid navigation (gridnav for short) is a feature that moves focus among a set of child Widgets via arrow-key presses. @@ -82,7 +86,7 @@ hidden (:cpp:enumerator:`LV_OBJ_FLAG_HIDDEN`) to receive focus via gridnav. Examples ******** -.. include:: ../../examples/others/gridnav/index.rst +.. include:: ../../../examples/others/gridnav/index.rst diff --git a/docs/src/details/main-modules/indev/index.rst b/docs/src/details/main-modules/indev/index.rst index a9f30e7141..4bb693f878 100644 --- a/docs/src/details/main-modules/indev/index.rst +++ b/docs/src/details/main-modules/indev/index.rst @@ -14,3 +14,4 @@ Input devices (lv_indev) button groups gestures + gridnav diff --git a/docs/src/details/main-modules/index.rst b/docs/src/details/main-modules/index.rst index 8a773e574e..a1e72808b6 100644 --- a/docs/src/details/main-modules/index.rst +++ b/docs/src/details/main-modules/index.rst @@ -9,10 +9,11 @@ Main Modules display/index indev/index - color - font + fonts/index image + color timer animation fs + observer/index draw/index diff --git a/docs/src/details/auxiliary-modules/observer/index.rst b/docs/src/details/main-modules/observer/index.rst similarity index 100% rename from docs/src/details/auxiliary-modules/observer/index.rst rename to docs/src/details/main-modules/observer/index.rst diff --git a/docs/src/details/auxiliary-modules/observer/observer.rst b/docs/src/details/main-modules/observer/observer.rst similarity index 100% rename from docs/src/details/auxiliary-modules/observer/observer.rst rename to docs/src/details/main-modules/observer/observer.rst diff --git a/docs/src/details/auxiliary-modules/observer/observer_examples.rst b/docs/src/details/main-modules/observer/observer_examples.rst similarity index 100% rename from docs/src/details/auxiliary-modules/observer/observer_examples.rst rename to docs/src/details/main-modules/observer/observer_examples.rst diff --git a/docs/src/details/widgets/image.rst b/docs/src/details/widgets/image.rst index a09c8fa904..d9f6931698 100644 --- a/docs/src/details/widgets/image.rst +++ b/docs/src/details/widgets/image.rst @@ -35,7 +35,7 @@ To provide maximum flexibility, the source of the image can be: - a variable in code (a C array containing the pixels). - a file stored externally (e.g. on an SD card). -- a :ref:`Symbol ` as text. +- a :ref:`Symbol ` as text. To set the source of an image, use :cpp:expr:`lv_image_set_src(img, src)`. diff --git a/docs/src/details/auxiliary-modules/ime_pinyin.rst b/docs/src/details/widgets/ime_pinyin.rst similarity index 100% rename from docs/src/details/auxiliary-modules/ime_pinyin.rst rename to docs/src/details/widgets/ime_pinyin.rst diff --git a/docs/src/details/widgets/index.rst b/docs/src/details/widgets/index.rst index e7e1723e2b..b997a57fb4 100644 --- a/docs/src/details/widgets/index.rst +++ b/docs/src/details/widgets/index.rst @@ -30,6 +30,7 @@ All Widgets dropdown image imagebutton + ime_pinyin keyboard label led diff --git a/lvgl.h b/lvgl.h index 140a934e1f..f7c4c3f8af 100644 --- a/lvgl.h +++ b/lvgl.h @@ -43,14 +43,18 @@ extern "C" { #include "src/core/lv_obj.h" #include "src/core/lv_group.h" +#include "src/core/lv_refr.h" +#include "src/core/lv_observer.h" #include "src/indev/lv_indev.h" #include "src/indev/lv_indev_gesture.h" -#include "src/core/lv_refr.h" +#include "src/indev/lv_gridnav.h" #include "src/display/lv_display.h" #include "src/font/lv_font.h" -#include "src/font/lv_binfont_loader.h" -#include "src/font/lv_font_fmt_txt.h" +#include "src/font/binfont_loader/lv_binfont_loader.h" +#include "src/font/fmt_txt/lv_font_fmt_txt.h" +#include "src/font/imgfont/lv_imgfont.h" +#include "src/font/font_manager/lv_font_manager.h" #include "src/widgets/animimage/lv_animimage.h" #include "src/widgets/arc/lv_arc.h" @@ -86,20 +90,17 @@ extern "C" { #include "src/widgets/tileview/lv_tileview.h" #include "src/widgets/win/lv_win.h" #include "src/widgets/3dtexture/lv_3dtexture.h" +#include "src/widgets/ime/lv_ime_pinyin.h" + +#include "src/xml/lv_xml.h" + +#include "src/debugging/sysmon/lv_sysmon.h" +#include "src/debugging/monkey/lv_monkey.h" +#include "src/debugging/test/lv_test.h" -#include "src/others/snapshot/lv_snapshot.h" -#include "src/others/sysmon/lv_sysmon.h" -#include "src/others/monkey/lv_monkey.h" -#include "src/others/gridnav/lv_gridnav.h" #include "src/others/fragment/lv_fragment.h" -#include "src/others/imgfont/lv_imgfont.h" -#include "src/others/observer/lv_observer.h" -#include "src/others/ime/lv_ime_pinyin.h" #include "src/others/file_explorer/lv_file_explorer.h" -#include "src/others/font_manager/lv_font_manager.h" #include "src/others/translation/lv_translation.h" -#include "src/others/xml/lv_xml.h" -#include "src/others/test/lv_test.h" #include "src/libs/barcode/lv_barcode.h" #include "src/libs/bin_decoder/lv_bin_decoder.h" @@ -128,12 +129,13 @@ extern "C" { #include "src/draw/lv_draw_vector.h" #include "src/draw/sw/lv_draw_sw_utils.h" #include "src/draw/eve/lv_draw_eve_target.h" +#include "src/draw/snapshot/lv_snapshot.h" #include "src/themes/lv_theme.h" #include "src/drivers/lv_drivers.h" -/* Define LV_DISABLE_API_MAPPING using a compiler option +/* Define LV_DISABLE_API_MAPPING using a compiler option * to make sure your application is not using deprecated names */ #ifndef LV_DISABLE_API_MAPPING #include "src/lv_api_map_v8.h" diff --git a/lvgl_private.h b/lvgl_private.h index 9a4ee0f8da..7b95527a2e 100644 --- a/lvgl_private.h +++ b/lvgl_private.h @@ -24,12 +24,7 @@ extern "C" { #include "src/layouts/lv_layout_private.h" #include "src/stdlib/lv_mem_private.h" #include "src/others/file_explorer/lv_file_explorer_private.h" -#include "src/others/sysmon/lv_sysmon_private.h" -#include "src/others/monkey/lv_monkey_private.h" -#include "src/others/ime/lv_ime_pinyin_private.h" #include "src/others/fragment/lv_fragment_private.h" -#include "src/others/observer/lv_observer_private.h" -#include "src/others/xml/lv_xml_private.h" #include "src/libs/qrcode/lv_qrcode_private.h" #include "src/libs/barcode/lv_barcode_private.h" #include "src/draw/lv_draw_triangle_private.h" @@ -47,7 +42,6 @@ extern "C" { #include "src/drivers/libinput/lv_xkb_private.h" #include "src/drivers/libinput/lv_libinput_private.h" #include "src/drivers/evdev/lv_evdev_private.h" -#include "src/font/lv_font_fmt_txt_private.h" #include "src/themes/lv_theme_private.h" #include "src/core/lv_refr_private.h" #include "src/core/lv_obj_style_private.h" @@ -57,6 +51,14 @@ extern "C" { #include "src/core/lv_obj_class_private.h" #include "src/core/lv_group_private.h" #include "src/core/lv_obj_event_private.h" +#include "src/core/lv_observer_private.h" + +#include "src/xml/lv_xml_private.h" +#include "src/debugging/sysmon/lv_sysmon_private.h" +#include "src/debugging/monkey/lv_monkey_private.h" + +#include "src/font/fmt_txt/lv_font_fmt_txt_private.h" + #include "src/misc/lv_timer_private.h" #include "src/misc/lv_area_private.h" #include "src/misc/lv_fs_private.h" @@ -67,6 +69,7 @@ extern "C" { #include "src/misc/lv_style_private.h" #include "src/misc/lv_color_op_private.h" #include "src/misc/lv_anim_private.h" + #include "src/widgets/msgbox/lv_msgbox_private.h" #include "src/widgets/buttonmatrix/lv_buttonmatrix_private.h" #include "src/widgets/slider/lv_slider_private.h" @@ -97,6 +100,8 @@ extern "C" { #include "src/widgets/canvas/lv_canvas_private.h" #include "src/widgets/tabview/lv_tabview_private.h" #include "src/widgets/3dtexture/lv_3dtexture_private.h" +#include "src/widgets/ime/lv_ime_pinyin_private.h" + #include "src/tick/lv_tick_private.h" #include "src/stdlib/builtin/lv_tlsf_private.h" #include "src/libs/rlottie/lv_rlottie_private.h" diff --git a/src/core/lv_global.h b/src/core/lv_global.h index da32f8ccc8..c244e86afa 100644 --- a/src/core/lv_global.h +++ b/src/core/lv_global.h @@ -28,11 +28,11 @@ extern "C" { #include "../misc/lv_style.h" #include "../misc/lv_timer.h" #include "../osal/lv_os_private.h" -#include "../others/sysmon/lv_sysmon.h" +#include "../debugging/sysmon/lv_sysmon.h" #include "../stdlib/builtin/lv_tlsf.h" #if LV_USE_FONT_COMPRESSED -#include "../font/lv_font_fmt_txt_private.h" +#include "../font/fmt_txt/lv_font_fmt_txt_private.h" #endif #include "../tick/lv_tick.h" @@ -48,8 +48,8 @@ extern "C" { #include "../draw/sw/lv_draw_sw_private.h" #include "../draw/sw/lv_draw_sw_mask_private.h" #include "../stdlib/builtin/lv_tlsf_private.h" -#include "../others/sysmon/lv_sysmon_private.h" -#include "../others/test/lv_test_private.h" +#include "../debugging/sysmon/lv_sysmon_private.h" +#include "../debugging/test/lv_test_private.h" #include "../layouts/lv_layout_private.h" /********************* diff --git a/src/others/observer/lv_observer.c b/src/core/lv_observer.c similarity index 99% rename from src/others/observer/lv_observer.c rename to src/core/lv_observer.c index 955a661a0c..f01fc415cc 100644 --- a/src/others/observer/lv_observer.c +++ b/src/core/lv_observer.c @@ -10,9 +10,9 @@ #include "lv_observer_private.h" #if LV_USE_OBSERVER -#include "../../lvgl.h" -#include "../../core/lv_obj_private.h" -#include "../../misc/lv_event_private.h" +#include "../lvgl.h" +#include "../core/lv_obj_private.h" +#include "../misc/lv_event_private.h" /********************* * DEFINES diff --git a/src/others/observer/lv_observer.h b/src/core/lv_observer.h similarity index 99% rename from src/others/observer/lv_observer.h rename to src/core/lv_observer.h index 4881b64a87..9f4b75db9a 100644 --- a/src/others/observer/lv_observer.h +++ b/src/core/lv_observer.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../core/lv_obj.h" +#include "lv_obj.h" #if LV_USE_OBSERVER /********************* diff --git a/src/others/observer/lv_observer_private.h b/src/core/lv_observer_private.h similarity index 100% rename from src/others/observer/lv_observer_private.h rename to src/core/lv_observer_private.h diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 9e546c8628..e30ffb4f29 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -21,7 +21,6 @@ #include "../misc/lv_profiler.h" #include "../misc/lv_types.h" #include "../draw/lv_draw_private.h" -#include "../font/lv_font_fmt_txt.h" #include "../stdlib/lv_string.h" #include "lv_global.h" diff --git a/src/others/monkey/lv_monkey.c b/src/debugging/monkey/lv_monkey.c similarity index 100% rename from src/others/monkey/lv_monkey.c rename to src/debugging/monkey/lv_monkey.c diff --git a/src/others/monkey/lv_monkey.h b/src/debugging/monkey/lv_monkey.h similarity index 100% rename from src/others/monkey/lv_monkey.h rename to src/debugging/monkey/lv_monkey.h diff --git a/src/others/monkey/lv_monkey_private.h b/src/debugging/monkey/lv_monkey_private.h similarity index 100% rename from src/others/monkey/lv_monkey_private.h rename to src/debugging/monkey/lv_monkey_private.h diff --git a/src/others/sysmon/lv_sysmon.c b/src/debugging/sysmon/lv_sysmon.c similarity index 100% rename from src/others/sysmon/lv_sysmon.c rename to src/debugging/sysmon/lv_sysmon.c diff --git a/src/others/sysmon/lv_sysmon.h b/src/debugging/sysmon/lv_sysmon.h similarity index 98% rename from src/others/sysmon/lv_sysmon.h rename to src/debugging/sysmon/lv_sysmon.h index 69b4b11fe9..7893677b05 100644 --- a/src/others/sysmon/lv_sysmon.h +++ b/src/debugging/sysmon/lv_sysmon.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../misc/lv_timer.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" #if LV_USE_SYSMON diff --git a/src/others/sysmon/lv_sysmon_private.h b/src/debugging/sysmon/lv_sysmon_private.h similarity index 100% rename from src/others/sysmon/lv_sysmon_private.h rename to src/debugging/sysmon/lv_sysmon_private.h diff --git a/src/others/test/lv_test.h b/src/debugging/test/lv_test.h similarity index 100% rename from src/others/test/lv_test.h rename to src/debugging/test/lv_test.h diff --git a/src/others/test/lv_test_display.c b/src/debugging/test/lv_test_display.c similarity index 100% rename from src/others/test/lv_test_display.c rename to src/debugging/test/lv_test_display.c diff --git a/src/others/test/lv_test_display.h b/src/debugging/test/lv_test_display.h similarity index 100% rename from src/others/test/lv_test_display.h rename to src/debugging/test/lv_test_display.h diff --git a/src/others/test/lv_test_helpers.c b/src/debugging/test/lv_test_helpers.c similarity index 100% rename from src/others/test/lv_test_helpers.c rename to src/debugging/test/lv_test_helpers.c diff --git a/src/others/test/lv_test_helpers.h b/src/debugging/test/lv_test_helpers.h similarity index 100% rename from src/others/test/lv_test_helpers.h rename to src/debugging/test/lv_test_helpers.h diff --git a/src/others/test/lv_test_indev.c b/src/debugging/test/lv_test_indev.c similarity index 100% rename from src/others/test/lv_test_indev.c rename to src/debugging/test/lv_test_indev.c diff --git a/src/others/test/lv_test_indev.h b/src/debugging/test/lv_test_indev.h similarity index 100% rename from src/others/test/lv_test_indev.h rename to src/debugging/test/lv_test_indev.h diff --git a/src/others/test/lv_test_indev_gesture.c b/src/debugging/test/lv_test_indev_gesture.c similarity index 100% rename from src/others/test/lv_test_indev_gesture.c rename to src/debugging/test/lv_test_indev_gesture.c diff --git a/src/others/test/lv_test_indev_gesture.h b/src/debugging/test/lv_test_indev_gesture.h similarity index 100% rename from src/others/test/lv_test_indev_gesture.h rename to src/debugging/test/lv_test_indev_gesture.h diff --git a/src/others/test/lv_test_private.h b/src/debugging/test/lv_test_private.h similarity index 100% rename from src/others/test/lv_test_private.h rename to src/debugging/test/lv_test_private.h diff --git a/src/others/test/lv_test_screenshot_compare.c b/src/debugging/test/lv_test_screenshot_compare.c similarity index 100% rename from src/others/test/lv_test_screenshot_compare.c rename to src/debugging/test/lv_test_screenshot_compare.c diff --git a/src/others/test/lv_test_screenshot_compare.h b/src/debugging/test/lv_test_screenshot_compare.h similarity index 100% rename from src/others/test/lv_test_screenshot_compare.h rename to src/debugging/test/lv_test_screenshot_compare.h diff --git a/src/debugging/vg_lite_tvg/vg_lite.h b/src/debugging/vg_lite_tvg/vg_lite.h new file mode 100644 index 0000000000..f2d4aafe01 --- /dev/null +++ b/src/debugging/vg_lite_tvg/vg_lite.h @@ -0,0 +1,1352 @@ +/**************************************************************************** +* +* Copyright 2012 - 2023 Vivante Corporation, Santa Clara, California. +* All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* 'Software'), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sub license, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject +* to the following conditions: +* +* The above copyright notice and this permission notice (including the +* next paragraph) shall be included in all copies or substantial +* portions of the Software. +* +* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +* IN NO EVENT SHALL VIVANTE AND/OR ITS SUPPLIERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* +*****************************************************************************/ + +#ifndef _vg_lite_h_ +#define _vg_lite_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * causes MSVC error C1189. + * Not needed because "The __inline keyword is equivalent to inline." + * See: https://learn.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=msvc-170 +*/ +/* +#if defined(_MSC_VER) +#define inline __inline +#endif +*/ + +#include +#include + + +/* VGLite API Constants *******************************************************************************************************************/ + +#define VGLITE_HEADER_VERSION 7 + +#ifndef VGLITE_VERSION_3_0 +#define VGLITE_VERSION_3_0 1 + +#define VGLITE_MAKE_VERSION(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#define VGLITE_VERSION_MAJOR(version) (((uint32_t)(version) >> 16) & 0xff) +#define VGLITE_VERSION_MINOR(version) (((uint32_t)(version) >> 8) & 0xff) +#define VGLITE_VERSION_PATCH(version) ((uint32_t)(version) & 0xff) + +#define VGLITE_API_VERSION_3_0 VGLITE_MAKE_VERSION(3, 0, 0) + +#define VGLITE_RELEASE_VERSION VGLITE_MAKE_VERSION(4,0,47) + +#define VGL_FALSE 0 +#define VGL_TRUE 1 + +/* Path command (op code). */ +#define VLC_OP_END 0x00 +#define VLC_OP_CLOSE 0x01 +#define VLC_OP_MOVE 0x02 +#define VLC_OP_MOVE_REL 0x03 +#define VLC_OP_LINE 0x04 +#define VLC_OP_LINE_REL 0x05 +#define VLC_OP_QUAD 0x06 +#define VLC_OP_QUAD_REL 0x07 +#define VLC_OP_CUBIC 0x08 +#define VLC_OP_CUBIC_REL 0x09 +#define VLC_OP_BREAK 0x0A +#define VLC_OP_HLINE 0x0B +#define VLC_OP_HLINE_REL 0x0C +#define VLC_OP_VLINE 0x0D +#define VLC_OP_VLINE_REL 0x0E +#define VLC_OP_SQUAD 0x0F +#define VLC_OP_SQUAD_REL 0x10 +#define VLC_OP_SCUBIC 0x11 +#define VLC_OP_SCUBIC_REL 0x12 +#define VLC_OP_SCCWARC 0x13 +#define VLC_OP_SCCWARC_REL 0x14 +#define VLC_OP_SCWARC 0x15 +#define VLC_OP_SCWARC_REL 0x16 +#define VLC_OP_LCCWARC 0x17 +#define VLC_OP_LCCWARC_REL 0x18 +#define VLC_OP_LCWARC 0x19 +#define VLC_OP_LCWARC_REL 0x1A + +/* Macros for path manipulating: See path definitions. */ +#define VLM_PATH_ENABLE_UPLOAD(path) (path).uploaded.property |= 1 +#define VLM_PATH_DISABLE_UPLOAD(path) (path).uploaded.property &= (~1) +#define VLM_PATH_GET_UPLOAD_BIT(path) ((path).uploaded.property & 1) + +/* Gradient constants. */ +#define VLC_MAX_COLOR_RAMP_STOPS 256 /*! The max number of radial gradient stops. */ +#define VLC_MAX_GRADIENT_STOPS 16 /*! The max number of gradient stops. */ +#define VLC_GRADIENT_BUFFER_WIDTH 1024 /*! The internal gradient buffer width.*/ + + +/* API name defines for backward compatibility to VGLite 2.0 APIs */ +#define vg_lite_buffer_upload vg_lite_upload_buffer +#define vg_lite_path_append vg_lite_append_path +#define vg_lite_path_calc_length vg_lite_get_path_length +#define vg_lite_set_ts_buffer vg_lite_set_tess_buffer +#define vg_lite_set_draw_path_type vg_lite_set_path_type +#define vg_lite_create_mask_layer vg_lite_create_masklayer +#define vg_lite_fill_mask_layer vg_lite_fill_masklayer +#define vg_lite_blend_mask_layer vg_lite_blend_masklayer +#define vg_lite_generate_mask_layer_by_path vg_lite_render_masklayer +#define vg_lite_set_mask_layer vg_lite_set_masklayer +#define vg_lite_destroy_mask_layer vg_lite_destroy_masklayer +#define vg_lite_enable_mask vg_lite_enable_masklayer +#define vg_lite_enable_color_transformation vg_lite_enable_color_transform +#define vg_lite_set_color_transformation vg_lite_set_color_transform +#define vg_lite_set_image_global_alpha vg_lite_source_global_alpha +#define vg_lite_set_dest_global_alpha vg_lite_dest_global_alpha +#define vg_lite_clear_rad_grad vg_lite_clear_radial_grad +#define vg_lite_update_rad_grad vg_lite_update_radial_grad +#define vg_lite_get_rad_grad_matrix vg_lite_get_radial_grad_matrix +#define vg_lite_set_rad_grad vg_lite_set_radial_grad +#define vg_lite_draw_linear_gradient vg_lite_draw_linear_grad +#define vg_lite_draw_radial_gradient vg_lite_draw_radial_grad +#define vg_lite_draw_gradient vg_lite_draw_grad +#define vg_lite_mem_avail vg_lite_get_mem_size +#define vg_lite_set_update_stroke vg_lite_update_stroke + +#define vg_lite_buffer_image_mode_t vg_lite_image_mode_t +#define vg_lite_draw_path_type_t vg_lite_path_type_t +#define vg_lite_linear_gradient_ext_t vg_lite_ext_linear_gradient_t +#define vg_lite_buffer_transparency_mode_t vg_lite_transparency_t + + +/* VGLite API Types ***********************************************************************************************************************/ + +typedef unsigned char vg_lite_uint8_t; +typedef char vg_lite_int8_t; +typedef short vg_lite_int16_t; +typedef unsigned short vg_lite_uint16_t; +typedef int vg_lite_int32_t; +typedef unsigned int vg_lite_uint32_t; +typedef unsigned long long vg_lite_uint64_t; +typedef float vg_lite_float_t; +typedef double vg_lite_double_t; +typedef char vg_lite_char; +typedef char * vg_lite_string; +typedef void * vg_lite_pointer; +typedef void vg_lite_void; +typedef unsigned int vg_lite_color_t; + + +/* VGLite API Enumerations ****************************************************************************************************************/ + +#ifndef VG_LITE_ERROR +#define VG_LITE_ERROR 1 + +/* Error codes that the vg_lite functions can return. */ +typedef enum vg_lite_error { + VG_LITE_SUCCESS = 0, /*! Success. */ + VG_LITE_INVALID_ARGUMENT, /*! An invalid argument was specified. */ + VG_LITE_OUT_OF_MEMORY, /*! Out of memory. */ + VG_LITE_NO_CONTEXT, /*! No context or an uninitialized context specified. */ + VG_LITE_TIMEOUT, /*! A timeout has occurred during a wait. */ + VG_LITE_OUT_OF_RESOURCES, /*! Out of system resources. */ + VG_LITE_GENERIC_IO, /*! Cannot communicate with the kernel driver. */ + VG_LITE_NOT_SUPPORT, /*! Function call not supported. */ + VG_LITE_ALREADY_EXISTS, /*! Object already exists */ + VG_LITE_NOT_ALIGNED, /*! Data alignment error */ + VG_LITE_FLEXA_TIME_OUT, /*! VG timeout requesting for segment buffer */ + VG_LITE_FLEXA_HANDSHAKE_FAIL, /*! VG and SBI synchronizer handshake failed */ +} vg_lite_error_t; +#endif + +/* Chip features bit */ +typedef enum vg_lite_feature { + gcFEATURE_BIT_VG_IM_INDEX_FORMAT, + gcFEATURE_BIT_VG_SCISSOR, + gcFEATURE_BIT_VG_BORDER_CULLING, + gcFEATURE_BIT_VG_RGBA2_FORMAT, + gcFEATURE_BIT_VG_QUALITY_8X, + gcFEATURE_BIT_VG_IM_FASTCLAER, + gcFEATURE_BIT_VG_RADIAL_GRADIENT, + gcFEATURE_BIT_VG_GLOBAL_ALPHA, + gcFEATURE_BIT_VG_RGBA8_ETC2_EAC, + gcFEATURE_BIT_VG_COLOR_KEY, + gcFEATURE_BIT_VG_DOUBLE_IMAGE, + gcFEATURE_BIT_VG_YUV_OUTPUT, + gcFEATURE_BIT_VG_FLEXA, + gcFEATURE_BIT_VG_24BIT, + gcFEATURE_BIT_VG_DITHER, + gcFEATURE_BIT_VG_USE_DST, + gcFEATURE_BIT_VG_PE_CLEAR, + gcFEATURE_BIT_VG_IM_INPUT, + gcFEATURE_BIT_VG_DEC_COMPRESS, + gcFEATURE_BIT_VG_LINEAR_GRADIENT_EXT, + gcFEATURE_BIT_VG_MASK, + gcFEATURE_BIT_VG_MIRROR, + gcFEATURE_BIT_VG_GAMMA, + gcFEATURE_BIT_VG_NEW_BLEND_MODE, + gcFEATURE_BIT_VG_STENCIL, + gcFEATURE_BIT_VG_SRC_PREMULTIPLIED, /*! Valid only if gcFEATURE_BIT_VG_HW_PREMULTIPLY is 0 */ + gcFEATURE_BIT_VG_HW_PREMULTIPLY, /*! HW multiplier can accept either premultiplied or not */ + gcFEATURE_BIT_VG_COLOR_TRANSFORMATION, + gcFEATURE_BIT_VG_LVGL_SUPPORT, + gcFEATURE_BIT_VG_INDEX_ENDIAN, + gcFEATURE_BIT_VG_24BIT_PLANAR, + gcFEATURE_BIT_VG_PIXEL_MATRIX, + gcFEATURE_BIT_VG_NEW_IMAGE_INDEX, + gcFEATURE_BIT_VG_PARALLEL_PATHS, + gcFEATURE_BIT_VG_STRIPE_MODE, + gcFEATURE_BIT_VG_IM_DEC_INPUT, + gcFEATURE_BIT_VG_GAUSSIAN_BLUR, + gcFEATURE_BIT_VG_RECTANGLE_TILED_OUT, + gcFEATURE_BIT_VG_TESSELLATION_TILED_OUT, + gcFEATURE_BIT_VG_IM_REPEAT_REFLECT, + gcFEATURE_BIT_VG_YUY2_INPUT, + gcFEATURE_BIT_VG_YUV_INPUT, + gcFEATURE_BIT_VG_YUV_TILED_INPUT, + gcFEATURE_BIT_VG_AYUV_INPUT, + gcFEATURE_BIT_VG_16PIXELS_ALIGN, + gcFEATURE_BIT_VG_DEC_COMPRESS_2_0, + gcFEATURE_COUNT +} vg_lite_feature_t; + +/* Rendering quality enums. */ +typedef enum vg_lite_quality { + VG_LITE_HIGH, /*! High quality 16x anti-aliasing path. */ + VG_LITE_UPPER, /*! Upper quality 8x anti-aliasing path. */ + VG_LITE_MEDIUM, /*! Medium quality 4x anti-aliasing path. */ + VG_LITE_LOW, /*! Low quality path without any anti-aliasing. */ +} vg_lite_quality_t; + +/* Format of path coordinates. */ +typedef enum vg_lite_format { + VG_LITE_S8, /*! Signed 8-bit coordinates. */ + VG_LITE_S16, /*! Signed 16-bit coordinates. */ + VG_LITE_S32, /*! Signed 32-bit coordinates. */ + VG_LITE_FP32, /*! 32-bit floating point coordinates. */ +} vg_lite_format_t; + +/* Format of pixel buffer. */ +typedef enum vg_lite_buffer_format { + /* OpenVG VGImageFormat enums: + * Note: The bits for each color channel are stored within a machine word + * from MSB to LSB in the order indicated by the pixel format name. + * This is opposite of VG_LITE_* formats (from LSB to MSB). + */ + + /* RGB{A,X} channel ordering */ + VG_sRGBX_8888 = 0, + VG_sRGBA_8888 = 1, + VG_sRGBA_8888_PRE = 2, + VG_sRGB_565 = 3, + VG_sRGBA_5551 = 4, + VG_sRGBA_4444 = 5, + VG_sL_8 = 6, + VG_lRGBX_8888 = 7, + VG_lRGBA_8888 = 8, + VG_lRGBA_8888_PRE = 9, + VG_lL_8 = 10, + VG_A_8 = 11, + VG_BW_1 = 12, + VG_A_1 = 13, + VG_A_4 = 14, + + VG_sRGBX_8888_PRE = 15, + VG_sRGB_565_PRE = 16, + VG_sRGBA_5551_PRE = 17, + VG_sRGBA_4444_PRE = 18, + VG_lRGBX_8888_PRE = 19, + VG_lRGB_565 = 20, + VG_lRGB_565_PRE = 21, + VG_lRGBA_5551 = 22, + VG_lRGBA_5551_PRE = 23, + VG_lRGBA_4444 = 24, + VG_lRGBA_4444_PRE = 25, + + /* {A,X}RGB channel ordering */ + VG_sXRGB_8888 = 0 | (1 << 6), + VG_sARGB_8888 = 1 | (1 << 6), + VG_sARGB_8888_PRE = 2 | (1 << 6), + VG_sARGB_1555 = 4 | (1 << 6), + VG_sARGB_4444 = 5 | (1 << 6), + VG_lXRGB_8888 = 7 | (1 << 6), + VG_lARGB_8888 = 8 | (1 << 6), + VG_lARGB_8888_PRE = 9 | (1 << 6), + + /* BGR{A,X} channel ordering */ + VG_sBGRX_8888 = 0 | (1 << 7), + VG_sBGRA_8888 = 1 | (1 << 7), + VG_sBGRA_8888_PRE = 2 | (1 << 7), + VG_sBGR_565 = 3 | (1 << 7), + VG_sBGRA_5551 = 4 | (1 << 7), + VG_sBGRA_4444 = 5 | (1 << 7), + VG_lBGRX_8888 = 7 | (1 << 7), + VG_lBGRA_8888 = 8 | (1 << 7), + VG_lBGRA_8888_PRE = 9 | (1 << 7), + + /* {A,X}BGR channel ordering */ + VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), + VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), + VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), + VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), + VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), + VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), + VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), + VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7), + + /* Original VGLite API image format enums: + * Note: The bits for each color channel are stored within a machine word + * from LSB to MSB in the order indicated by the pixel format name. + * This is opposite of OPENVG VG_* formats (from MSB to LSB). + */ + VG_LITE_RGBA8888 = 0 | (1 << 10), + VG_LITE_BGRA8888 = 1 | (1 << 10), + VG_LITE_RGBX8888 = 2 | (1 << 10), + VG_LITE_BGRX8888 = 3 | (1 << 10), + VG_LITE_RGB565 = 4 | (1 << 10), + VG_LITE_BGR565 = 5 | (1 << 10), + VG_LITE_RGBA4444 = 6 | (1 << 10), + VG_LITE_BGRA4444 = 7 | (1 << 10), + VG_LITE_BGRA5551 = 8 | (1 << 10), + VG_LITE_A4 = 9 | (1 << 10), + VG_LITE_A8 = 10 | (1 << 10), + VG_LITE_L8 = 11 | (1 << 10), + VG_LITE_YUYV = 12 | (1 << 10), + VG_LITE_YUY2 = 13 | (1 << 10), + VG_LITE_ANV12 = 14 | (1 << 10), + VG_LITE_AYUY2 = 15 | (1 << 10), + VG_LITE_NV12 = 16 | (1 << 10), + VG_LITE_YV12 = 17 | (1 << 10), + VG_LITE_YV24 = 18 | (1 << 10), + VG_LITE_YV16 = 19 | (1 << 10), + VG_LITE_NV16 = 20 | (1 << 10), + VG_LITE_YUY2_TILED = 21 | (1 << 10), + VG_LITE_NV12_TILED = 22 | (1 << 10), + VG_LITE_ANV12_TILED = 23 | (1 << 10), + VG_LITE_AYUY2_TILED = 24 | (1 << 10), + VG_LITE_RGBA2222 = 25 | (1 << 10), + VG_LITE_BGRA2222 = 26 | (1 << 10), + VG_LITE_ABGR2222 = 27 | (1 << 10), + VG_LITE_ARGB2222 = 28 | (1 << 10), + VG_LITE_ABGR4444 = 29 | (1 << 10), + VG_LITE_ARGB4444 = 30 | (1 << 10), + VG_LITE_ABGR8888 = 31 | (1 << 10), + VG_LITE_ARGB8888 = 32 | (1 << 10), + VG_LITE_ABGR1555 = 33 | (1 << 10), + VG_LITE_RGBA5551 = 34 | (1 << 10), + VG_LITE_ARGB1555 = 35 | (1 << 10), + VG_LITE_XBGR8888 = 36 | (1 << 10), + VG_LITE_XRGB8888 = 37 | (1 << 10), + VG_LITE_RGBA8888_ETC2_EAC = 38 | (1 << 10), + VG_LITE_RGB888 = 39 | (1 << 10), + VG_LITE_BGR888 = 40 | (1 << 10), + VG_LITE_ABGR8565 = 41 | (1 << 10), + VG_LITE_BGRA5658 = 42 | (1 << 10), + VG_LITE_ARGB8565 = 43 | (1 << 10), + VG_LITE_RGBA5658 = 44 | (1 << 10), + VG_LITE_ABGR8565_PLANAR = 45 | (1 << 10), + VG_LITE_BGRA5658_PLANAR = 46 | (1 << 10), + VG_LITE_ARGB8565_PLANAR = 47 | (1 << 10), + VG_LITE_RGBA5658_PLANAR = 48 | (1 << 10), + + VG_LITE_INDEX_1 = 0 | (1 << 11), /*! Indexed format. */ + VG_LITE_INDEX_2 = 1 | (1 << 11), + VG_LITE_INDEX_4 = 2 | (1 << 11), + VG_LITE_INDEX_8 = 3 | (1 << 11), + +} vg_lite_buffer_format_t; + +/* Swizzle of packed YUV format UV channels. */ +typedef enum vg_lite_swizzle { + VG_LITE_SWIZZLE_UV, + VG_LITE_SWIZZLE_VU, +} vg_lite_swizzle_t; + +/* The YUV<->RGB conversion rule. */ +typedef enum vg_lite_yuv2rgb { + VG_LITE_YUV601, + VG_LITE_YUV709, +} vg_lite_yuv2rgb_t; + +/* The pixel layout in a buffer. */ +typedef enum vg_lite_buffer_layout { + VG_LITE_LINEAR, + VG_LITE_TILED, +} vg_lite_buffer_layout_t; + +/* The image (buffer) rendering mode. Match OpenVG enum VGImageMode */ +typedef enum vg_lite_image_mode { + /* For enum value backward compatibility */ + VG_LITE_ZERO = 0, + VG_LITE_NORMAL_IMAGE_MODE = 0x1F00, + VG_LITE_MULTIPLY_IMAGE_MODE = 0x1F01, + VG_LITE_STENCIL_MODE = 0x1F02, + VG_LITE_NONE_IMAGE_MODE = 0x1F03, + VG_LITE_RECOLOR_MODE = 0x1F04, +} vg_lite_image_mode_t; + +/* The image (buffer) transparency mode. */ +typedef enum vg_lite_transparency { + VG_LITE_IMAGE_OPAQUE, + VG_LITE_IMAGE_TRANSPARENT +} vg_lite_transparency_t; + +/* Blending modes. VG_BLEND_* match OpenVG enum VGBlendMode. + * S and D represent source and destination color channels. + * Sa and Da represent the source and destination alpha channels. + */ +typedef enum vg_lite_blend { + VG_LITE_BLEND_NONE = 0, /*! S, No blend, Non-premultiplied */ + VG_LITE_BLEND_SRC_OVER = 1, /*! S + (1 - Sa) * D , Non-premultiplied */ + VG_LITE_BLEND_DST_OVER = 2, /*! (1 - Da) * S + D , Non-premultiplied */ + VG_LITE_BLEND_SRC_IN = 3, /*! Da * S , Non-premultiplied */ + VG_LITE_BLEND_DST_IN = 4, /*! Sa * D , Non-premultiplied */ + VG_LITE_BLEND_MULTIPLY = 5, /*! S * (1 - Da) + D * (1 - Sa) + S * D , Non-premultiplied */ + VG_LITE_BLEND_SCREEN = 6, /*! S + D - S * D , Non-premultiplied */ + VG_LITE_BLEND_DARKEN = 7, /*! min(SrcOver, DstOver) , Non-premultiplied */ + VG_LITE_BLEND_LIGHTEN = 8, /*! max(SrcOver, DstOver) , Non-premultiplied */ + VG_LITE_BLEND_ADDITIVE = 9, /*! S + D , Non-premultiplied */ + VG_LITE_BLEND_SUBTRACT = 10, /*! D * (1 - Sa) , Non-premultiplied */ + VG_LITE_BLEND_SUBTRACT_LVGL = 11, /*! D - S , Non-premultiplied */ + VG_LITE_BLEND_NORMAL_LVGL = 12, /*! S * Sa + (1 - Sa) * D , Non-premultiplied */ + VG_LITE_BLEND_ADDITIVE_LVGL = 13, /*! (S + D) * Sa + D * (1 - Sa) , Non-premultiplied */ + VG_LITE_BLEND_MULTIPLY_LVGL = 14, /*! (S * D) * Sa + D * (1 - Sa) , Non-premultiplied */ + VG_LITE_BLEND_PREMULTIPLY_SRC_OVER = 15, /*! S * Sa + (1 - Sa) * D , Non-premultiplied */ + + OPENVG_BLEND_SRC = 0x2000, /*! Copy SRC, no blend, Premultiplied */ + OPENVG_BLEND_SRC_OVER = 0x2001, /*! Porter-Duff SRC_OVER blend, Premultiplied */ + OPENVG_BLEND_DST_OVER = 0x2002, /*! Porter-Duff DST_OVER blend, Premultiplied */ + OPENVG_BLEND_SRC_IN = 0x2003, /*! Porter-Duff SRC_IN blend, Premultiplied */ + OPENVG_BLEND_DST_IN = 0x2004, /*! Porter-Duff DST_IN blend, Premultiplied */ + OPENVG_BLEND_MULTIPLY = 0x2005, /*! Porter-Duff MULTIPLY blend, Premultiplied */ + OPENVG_BLEND_SCREEN = 0x2006, /*! Porter-Duff SCREEN blend, Premultiplied */ + OPENVG_BLEND_DARKEN = 0x2007, /*! Porter-Duff DARKEN blend, Premultiplied */ + OPENVG_BLEND_LIGHTEN = 0x2008, /*! Porter-Duff LIGHTEN blend, Premultiplied */ + OPENVG_BLEND_ADDITIVE = 0x2009, /*! Porter-Duff ADDITIVE blend, Premultiplied */ +} vg_lite_blend_t; + +/* Fill rules. Match OpenVG enum VGFillRule */ +typedef enum vg_lite_fill { + VG_LITE_FILL_EVEN_ODD = 0x1900, /*! A pixel is drawn it it crosses an odd number of path pixels. */ + VG_LITE_FILL_NON_ZERO = 0x1901, /*! A pixel is drawn if it crosses at least one path pixel. */ +} vg_lite_fill_t; + +/* Global alpha modes. */ +typedef enum vg_lite_global_alpha { + VG_LITE_NORMAL = 0, /*! Use original src/dst alpha value. */ + VG_LITE_GLOBAL, /*! Use global src/dst alpha value to replace original src/dst alpha value. */ + VG_LITE_SCALED, /*! Multiply global src/dst alpha value and original src/dst alpha value. */ +} vg_lite_global_alpha_t; + +/* Filter modes. */ +typedef enum vg_lite_filter { + VG_LITE_FILTER_POINT = 0, /*! Fetch the nearest image pixel. */ + VG_LITE_FILTER_LINEAR = 0x1000, /*! Used for linear paint. */ + VG_LITE_FILTER_BI_LINEAR = 0x2000, /*! Use a 2x2 box around the image pixel and perform an interpolation. */ + VG_LITE_FILTER_GAUSSIAN = 0x3000, /*! Perform 3x3 gaussian blur with the convolution for image pixel. */ +} vg_lite_filter_t; + +/* Pattern padding mode. Match OpenVG enum VGTilingMode. */ +typedef enum vg_lite_pattern_mode { + VG_LITE_PATTERN_COLOR = 0x1D00, /*! Pixel outside the bounds of sourceimage should be taken as the color */ + VG_LITE_PATTERN_PAD = 0x1D01, /*! Pixel outside the bounds of sourceimage should be taken as having the same color as the closest edge pixel */ + VG_LITE_PATTERN_REPEAT = 0x1D02, /*! Pixel outside the bounds of sourceimage should be repeated indefinitely in all directions */ + VG_LITE_PATTERN_REFLECT = 0x1D03, /*! Pixel outside the bounds of sourceimage should be reflected indefinitely in all directions */ +} vg_lite_pattern_mode_t; + +/* Paint type. Match OpenVG enum VGPaintType. */ +typedef enum vg_lite_paint_type { + /* For enum value backward compatibility */ + VG_LITE_PAINT_ZERO = 0, + VG_LITE_PAINT_COLOR = 0x1B00, + VG_LITE_PAINT_LINEAR_GRADIENT = 0x1B01, + VG_LITE_PAINT_RADIAL_GRADIENT = 0x1B02, + VG_LITE_PAINT_PATTERN = 0x1B03, +} vg_lite_paint_type_t; + +/* Radial gradient padding mode. Match OpenVG enum VGColorRampSpreadMode */ +typedef enum { + VG_LITE_GRADIENT_SPREAD_FILL = 0, + VG_LITE_GRADIENT_SPREAD_PAD = 0x1C00, + VG_LITE_GRADIENT_SPREAD_REPEAT = 0x1C01, + VG_LITE_GRADIENT_SPREAD_REFLECT = 0x1C02, +} vg_lite_gradient_spreadmode_t; + +/* Decnano Compress mode. */ +typedef enum vg_lite_compress_mode { + VG_LITE_DEC_DISABLE = 0, /*! disable compress */ + VG_LITE_DEC_NON_SAMPLE, /*! compress ratio is 1.6 if use ARGB8888, compress ratio is 2 if use XRGB8888 */ + VG_LITE_DEC_HSAMPLE, /*! compress ratio is 2 if use ARGB8888, compress ratio is 2.6 if use XRGB8888 */ + VG_LITE_DEC_HV_SAMPLE, /*! compress ratio is 2.6 if use ARGB8888, compress ratio is 4 if use XRGB8888 */ +} vg_lite_compress_mode_t; + +/* Draw path type. Match OpenVG enum VGPaintMode */ +typedef enum vg_lite_path_type { + /* For enum value backward compatibility */ + VG_LITE_DRAW_ZERO = 0, + VG_LITE_DRAW_STROKE_PATH = (1 << 0), + VG_LITE_DRAW_FILL_PATH = (1 << 1), + VG_LITE_DRAW_FILL_STROKE_PATH = (1 << 1 | 1 << 0), +} vg_lite_path_type_t; + +/* End cap style. Match OpenVG enum VGCapStyle */ +typedef enum vg_lite_cap_style { + VG_LITE_CAP_BUTT = 0x1700, + VG_LITE_CAP_ROUND = 0x1701, + VG_LITE_CAP_SQUARE = 0x1702, +} vg_lite_cap_style_t; + +/* Line join styles. Match OpenVG enum VGJoinStyle */ +typedef enum vg_lite_join_style { + VG_LITE_JOIN_MITER = 0x1800, + VG_LITE_JOIN_ROUND = 0x1801, + VG_LITE_JOIN_BEVEL = 0x1802, +} vg_lite_join_style_t; + +/* Mask operation mode. Match OpenVG enum VGMaskOperation */ +typedef enum vg_lite_mask_operation { + VG_LITE_CLEAR_MASK = 0x1500, /*! Set all dest mask values to 0 */ + VG_LITE_FILL_MASK = 0x1501, /*! Set all dest mask values to 1 */ + VG_LITE_SET_MASK = 0x1502, /*! Copy from src masklayer to dest masklayer. */ + VG_LITE_UNION_MASK = 0x1503, /*! Replace dest masklayer by its union with src masklayer. */ + VG_LITE_INTERSECT_MASK = 0x1504, /*! Replace dest masklayer by its intersection with src masklayer. */ + VG_LITE_SUBTRACT_MASK = 0x1505, /*! Subtract src mask in dest masklayer */ +} vg_lite_mask_operation_t; + +/* Mirror orientation mode. */ +typedef enum vg_lite_orientation { + VG_LITE_ORIENTATION_TOP_BOTTOM, + VG_LITE_ORIENTATION_BOTTOM_TOP, +} vg_lite_orientation_t; + +/* Gamma conversion mode. */ +typedef enum vg_lite_gamma_conversion { + VG_LITE_GAMMA_NO_CONVERSION, /*! Leave color as is. */ + VG_LITE_GAMMA_LINEAR, /*! Convert from sRGB to linear space. */ + VG_LITE_GAMMA_NON_LINEAR /*! Convert from linear to sRGB space. */ +} vg_lite_gamma_conversion_t; + +/* Index endian */ +typedef enum vg_lite_index_endian { + VG_LITE_INDEX_LITTLE_ENDIAN, /*! Parse the index pixel from low to high, + *! when using index1, the parsing order is bit0~bit7. + *! when using index2, the parsing order is bit0:1,bit2:3,bit4:5.bit6:7. + *! when using index4, the parsing order is bit0:3,bit4:7. + */ + VG_LITE_INDEX_BIG_ENDIAN, /*! Parse the index pixel from low to high, + *! when using index1, the parsing order is bit7~bit0. + *! when using index2, the parsing order is bit7:6,bit5:4,bit3:2.bit1:0. + *! when using index4, the parsing order is bit4:7,bit0:3. + */ +} vg_lite_index_endian_t; + +/* Map flag*/ +typedef enum vg_lite_map_flag { + VG_LITE_MAP_USER_MEMORY = 0, + VG_LITE_MAP_DMABUF = 0x01, +} vg_lite_map_flag_t; + +/*VGLite parameters variable*/ +typedef enum vg_lite_param_type { + VG_LITE_SCISSOR_RECT, /*! count must be 4n for x, y, right, bottom */ + VG_LITE_GPU_IDLE_STATE, /*! 0: busy, 1: idle */ +} vg_lite_param_type_t; + +/* VGLite API Structures ******************************************************************************************************************/ + +/* VGLite driver information */ +typedef struct vg_lite_info { + vg_lite_uint32_t api_version; + vg_lite_uint32_t header_version; + vg_lite_uint32_t release_version; + vg_lite_uint32_t reserved; +} vg_lite_info_t; + +/* A 2D Point definition. */ +typedef struct vg_lite_point { + vg_lite_int32_t x; + vg_lite_int32_t y; +} vg_lite_point_t; + +/* Four 2D Point that form a polygon */ +typedef vg_lite_point_t vg_lite_point4_t[4]; + +/* A rectangle.*/ +typedef struct vg_lite_rectangle { + vg_lite_int32_t x; /*! Left coordinate of rectangle. */ + vg_lite_int32_t y; /*! Top coordinate of rectangle. */ + vg_lite_int32_t width; /*! Width of rectangle. */ + vg_lite_int32_t height; /*! Height of rectangle. */ +} vg_lite_rectangle_t; + +typedef struct vg_lite_matrix { + vg_lite_float_t m[3][3]; /*! The 3x3 matrix is in [row][column] order. */ + vg_lite_float_t scaleX; + vg_lite_float_t scaleY; + vg_lite_float_t angle; +} vg_lite_matrix_t; + +typedef struct vg_lite_yuvinfo { + vg_lite_swizzle_t swizzle; /*! UV swizzle. */ + vg_lite_yuv2rgb_t yuv2rgb; /*! 601 or 709 conversion standard. */ + vg_lite_uint32_t uv_planar; /*! UV(U) planar address. */ + vg_lite_uint32_t v_planar; /*! V planar address. */ + vg_lite_uint32_t alpha_planar; /*! Alpha planar address. */ + vg_lite_uint32_t uv_stride; /*! UV(U) stride. */ + vg_lite_uint32_t v_stride; /*! V stride. */ + vg_lite_uint32_t alpha_stride; /*! Alpha stride. */ + vg_lite_uint32_t uv_height; /*! UV(U) height. */ + vg_lite_uint32_t v_height; /*! V height. */ + vg_lite_pointer uv_memory; /*! The logical pointer to the UV(U) planar memory. */ + vg_lite_pointer v_memory; /*! The logical pointer to the V planar memory. */ + vg_lite_pointer uv_handle; /*! The memory handle of the UV(U) planar. */ + vg_lite_pointer v_handle; /*! The memory handle of the V planar. */ +} vg_lite_yuvinfo_t; + +typedef struct vg_lite_path_point * vg_lite_path_point_ptr; +typedef struct vg_lite_path_point { + /* X coordinate. */ + vg_lite_float_t x; + + /* Y coordinate. */ + vg_lite_float_t y; + + /* Flatten flag for flattened path. */ + vg_lite_uint8_t flatten_flag; + + /* Curve type for stroke path. */ + vg_lite_uint8_t curve_type; + + /* X tangent. */ + vg_lite_float_t tangentX; + + /* Y tangent. */ + vg_lite_float_t tangentY; + + /* Length of the line. */ + vg_lite_float_t length; + + /* Pointer to next point node. */ + vg_lite_path_point_ptr next; + + /* Pointer to previous point node. */ + vg_lite_path_point_ptr prev; + +} vg_lite_path_point_t; + +typedef struct vg_lite_sub_path * vg_lite_sub_path_ptr; +typedef struct vg_lite_sub_path { + /* Pointer to next sub path. */ + vg_lite_sub_path_ptr next; + + /* Number of points. */ + vg_lite_uint32_t point_count; + + /* Point list. */ + vg_lite_path_point_ptr point_list; + + /* Last point. */ + vg_lite_path_point_ptr end_point; + + /* Whether is path is closed. */ + vg_lite_uint8_t closed; + + /* Sub path length. */ + vg_lite_float_t length; + +} vg_lite_sub_path_t; + +/* Save divided path data according to MOVE/MOVE_REL. */ +typedef struct vg_lite_path_list * vg_lite_path_list_ptr; +typedef struct vg_lite_path_list { + vg_lite_path_point_ptr path_points; + vg_lite_path_point_ptr path_end; + vg_lite_uint32_t point_count; + vg_lite_path_list_ptr next; + vg_lite_uint8_t closed; + +} vg_lite_path_list_t; + +typedef struct vg_lite_stroke { + /* Stroke parameters */ + vg_lite_cap_style_t cap_style; + vg_lite_join_style_t join_style; + vg_lite_float_t line_width; + vg_lite_float_t miter_limit; + vg_lite_float_t * dash_pattern; + vg_lite_uint32_t pattern_count; + vg_lite_float_t dash_phase; + vg_lite_float_t dash_length; + vg_lite_uint32_t dash_index; + vg_lite_float_t half_width; + + /* Total length of stroke dash patterns. */ + vg_lite_float_t pattern_length; + + /* For fast checking. */ + vg_lite_float_t miter_square; + + /* Temp storage of stroke subPath. */ + vg_lite_path_point_ptr path_points; + vg_lite_path_point_ptr path_end; + vg_lite_uint32_t point_count; + vg_lite_path_point_ptr left_point; + vg_lite_path_point_ptr right_point; + vg_lite_path_point_ptr stroke_points; + vg_lite_path_point_ptr stroke_end; + vg_lite_uint32_t stroke_count; + + /* Divide stroke path according to move or move_rel for avoiding implicit closure. */ + vg_lite_path_list_ptr path_list_divide; + + /* pointer to current divided path data. */ + vg_lite_path_list_ptr cur_list; + + /* Flag that add end_path in driver. */ + vg_lite_uint8_t add_end; + vg_lite_uint8_t dash_reset; + + /* Sub path list. */ + vg_lite_sub_path_ptr stroke_paths; + + /* Last sub path. */ + vg_lite_sub_path_ptr last_stroke; + + /* Swing area handling. */ + vg_lite_uint32_t swing_handling; + vg_lite_float_t swing_deltax; + vg_lite_float_t swing_deltay; + vg_lite_path_point_ptr swing_start; + vg_lite_path_point_ptr swing_stroke; + vg_lite_float_t swing_length; + vg_lite_float_t swing_centlen; + vg_lite_uint32_t swing_count; + vg_lite_uint8_t need_swing; + vg_lite_uint8_t swing_ccw; + + vg_lite_float_t stroke_length; + vg_lite_uint32_t stroke_size; + + /* The stroke line is fat line. */ + vg_lite_uint8_t fattened; + vg_lite_uint8_t closed; + +} vg_lite_stroke_t; + +/* Fast clear buffer. */ +typedef struct vg_lite_fc_buffer { + vg_lite_int32_t width; /*! Width of the buffer in pixels. */ + vg_lite_int32_t height; /*! height of the buffer in pixels. */ + vg_lite_int32_t stride; /*! The number of bytes to move from one line in the buffer to the next line. */ + vg_lite_pointer + handle; /*! The memory handle of the buffer's memory as allocated by the VGLite kernel. */ + vg_lite_pointer memory; /*! The logical pointer to the buffer's memory for the CPU. */ + vg_lite_uint32_t address; /*! The address to the buffer's memory for the hardware. */ + vg_lite_uint32_t color; /*! The fastclear color value. */ +} vg_lite_fc_buffer_t; + +/* Structure for any image or render target. */ +typedef struct vg_lite_buffer { + vg_lite_int32_t width; /*! Width of the buffer in pixels. */ + vg_lite_int32_t height; /*! Height of the buffer in pixels. */ + vg_lite_int32_t stride; /*! The number of bytes to move from one line in the buffer to the next line. */ + vg_lite_buffer_layout_t tiled; /*! Indicating the buffer memory layout is linear or tiled. */ + vg_lite_buffer_format_t format; /*! The pixel format of the buffer. */ + vg_lite_pointer + handle; /*! The memory handle of the buffer's memory as allocated by the VGLite kernel. */ + vg_lite_pointer memory; /*! The logical pointer to the buffer's memory for the CPU. */ + vg_lite_uint32_t address; /*! The address to the buffer's memory for the hardware. */ + vg_lite_yuvinfo_t yuv; /*! The yuv format details. */ + vg_lite_image_mode_t image_mode; /*! The blit image mode. */ + vg_lite_transparency_t transparency_mode; /*! image transparency mode. */ + vg_lite_fc_buffer_t fc_buffer[3]; /*! 3 fastclear buffers,reserved YUV format. */ + vg_lite_compress_mode_t compress_mode; /*! Refer to the definition by vg_lite_compress_mode_t. */ + vg_lite_index_endian_t index_endian; /*! Refer to the definition by vg_lite_index_endian_t. */ + vg_lite_paint_type_t paintType; /*! Get paintcolor from different paint types. */ + vg_lite_uint8_t fc_enable; /*! enable im fastclear. */ + vg_lite_uint8_t scissor_layer; /*! The buffer is scissor buffer. */ + vg_lite_uint8_t premultiplied; /*! The RGB pixel values are alpha-premultiplied */ +} vg_lite_buffer_t; + +/* Memory allocation info by kernel. */ +typedef struct vg_lite_hw_memory { + vg_lite_pointer handle; /*! gpu memory object handle. */ + vg_lite_pointer memory; /*! logical memory address. */ + vg_lite_uint32_t address; /*! GPU memory address. */ + vg_lite_uint32_t bytes; /*! Size of memory. */ + vg_lite_uint32_t property; /*! Currently bit0 is used for path upload state: + *! 1 : enable auto path data uploading. + *! 0 : disable path data uploading. path data is embedded in command buffer. */ +} vg_lite_hw_memory_t; + +/* Path info for drawing command. */ +typedef struct vg_lite_path { + vg_lite_float_t bounding_box[4]; /*! Bounding box specified as left, top, right, and bottom. */ + vg_lite_quality_t quality; /*! Quality hint for the path. */ + vg_lite_format_t format; /*! Coordinate format. */ + vg_lite_hw_memory_t uploaded; /*! Path data that has been upload into GPU addressable memory. */ + vg_lite_uint32_t path_length; /*! Number of bytes in the path data. */ + vg_lite_pointer path; /*! Pointer to the physical description of the path. */ + vg_lite_int8_t + path_changed; /*! Indicate whether path data is synced with command buffer (uploaded) or not. */ + vg_lite_int8_t pdata_internal; /*! Indicate whether path data memory is allocated by driver. */ + vg_lite_path_type_t path_type; /*! Refer to the definition by vg_lite_path_type_t. */ + vg_lite_stroke_t * stroke; /*! Pointer to a vg_lite_stroke_t structure.*/ + vg_lite_pointer stroke_path; /*! Pointer to the physical description of the stroke path. */ + vg_lite_uint32_t stroke_size; /*! Number of bytes in the stroke path data. */ + vg_lite_color_t stroke_color; /*! The stroke path fill color. */ + vg_lite_int8_t add_end; /*! Flag that add end_path in driver. */ +} vg_lite_path_t; + +/* Color ramp definition. */ +typedef struct vg_lite_color_ramp { + vg_lite_float_t stop; /*! Value for the color stop. */ + vg_lite_float_t red; /*! Red color channel value for the color stop. */ + vg_lite_float_t green; /*! Green color channel value for the color stop. */ + vg_lite_float_t blue; /*! Blue color channel value for the color stop. */ + vg_lite_float_t alpha; /*! Alpha color channel value for the color stop. */ +} vg_lite_color_ramp_t; + +/* Linear gradient parameter */ +typedef struct vg_lite_linear_gradient_parameter { + vg_lite_float_t X0; + vg_lite_float_t Y0; + vg_lite_float_t X1; + vg_lite_float_t Y1; +} vg_lite_linear_gradient_parameter_t; + +typedef struct vg_lite_radial_gradient_parameter { + vg_lite_float_t cx; /*! x coordinate of the center point. */ + vg_lite_float_t cy; /*! y coordinate of the center point. */ + vg_lite_float_t r; /*! radius. */ + vg_lite_float_t fx; /*! x coordinate of the focal point. */ + vg_lite_float_t fy; /*! y coordinate of the focal point. */ +} vg_lite_radial_gradient_parameter_t; + +/* Linear gradient definition. */ +typedef struct vg_lite_linear_gradient { + vg_lite_uint32_t colors[VLC_MAX_GRADIENT_STOPS]; /*! Colors for stops. */ + vg_lite_uint32_t count; /*! Count of colors, up to 16. */ + vg_lite_uint32_t stops[VLC_MAX_GRADIENT_STOPS]; /*! Color stops, value from 0 to 255. */ + vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ + vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ +} vg_lite_linear_gradient_t; + +/* Extended linear gradient definition. */ +typedef struct vg_lite_ext_linear_gradient { + vg_lite_uint32_t count; /*! Count of colors, up to 256. */ + vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ + vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ + vg_lite_linear_gradient_parameter_t linear_grad; /*! Include center point,focal point and radius.*/ + + vg_lite_uint32_t ramp_length; /*! Color ramp for gradient paints provided to driver. */ + vg_lite_color_ramp_t color_ramp[VLC_MAX_COLOR_RAMP_STOPS]; + + vg_lite_uint32_t converted_length; /*! Converted internal color ramp. */ + vg_lite_color_ramp_t converted_ramp[VLC_MAX_COLOR_RAMP_STOPS + 2]; + + vg_lite_uint8_t + pre_multiplied; /*! If color values of color_ramp[] are multiply by alpha value of color_ramp[]. */ + vg_lite_gradient_spreadmode_t + spread_mode; /*! The spread mode that applied to the pixels out of the image after transformed. */ +} vg_lite_ext_linear_gradient_t; + +/* Radial gradient definition. */ +typedef struct vg_lite_radial_gradient { + vg_lite_uint32_t count; /*! Count of colors, up to 256. */ + vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ + vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ + vg_lite_radial_gradient_parameter_t radial_grad; /*! Include center point,focal point and radius.*/ + + vg_lite_uint32_t ramp_length; /*! Color ramp for gradient paints provided to the driver. */ + vg_lite_color_ramp_t color_ramp[VLC_MAX_COLOR_RAMP_STOPS]; + + vg_lite_uint32_t converted_length; /*! Converted internal color ramp. */ + vg_lite_color_ramp_t converted_ramp[VLC_MAX_COLOR_RAMP_STOPS + 2]; + + vg_lite_uint8_t + pre_multiplied; /*! If color values of color_ramp[] are multiply by alpha value of color_ramp[]. */ + vg_lite_gradient_spreadmode_t + spread_mode; /*! The spread mode that applied to the pixels out of the image after transformed. */ +} vg_lite_radial_gradient_t; + +/* Colorkey definition */ +typedef struct vg_lite_color_key { + vg_lite_uint8_t enable; /*! The color key is effective only when "enable" is true, */ + vg_lite_uint8_t low_r; /*! The R channel of low_rgb. */ + vg_lite_uint8_t low_g; /*! The G channel of low_rgb. */ + vg_lite_uint8_t low_b; /*! The B channel of low_rgb. */ + vg_lite_uint8_t alpha; /*! The alpha channel to replace destination pixel alpha channel.*/ + vg_lite_uint8_t high_r; /*! The R channel of high_rgb. */ + vg_lite_uint8_t high_g; /*! The G channel of high_rgb. */ + vg_lite_uint8_t high_b; /*! The B channel of high_rgb. */ +} vg_lite_color_key_t; + +/* Four colorkey definition. + * rgb_hi_0, rgb_lo_0, alpha_0, enable_0; + * rgb_hi_1, rgb_lo_1, alpha_1, enable_1; + * rgb_hi_2, rgb_lo_2, alpha_2, enable_2; + * rgb_hi_3, rgb_lo_3, alpha_3, enable_3; + * Priority order: color_key_0 > color_key_1 > color_key_2 > color_key_3. +*/ +typedef vg_lite_color_key_t vg_lite_color_key4_t[4]; + +/* Pixel matrix values */ +typedef vg_lite_float_t vg_lite_pixel_matrix_t[20]; + +/* HW pixel channel enable flags */ +typedef struct vg_lite_pixel_channel_enable { + vg_lite_uint8_t enable_a; /*! Enable A channel.*/ + vg_lite_uint8_t enable_b; /*! Enable B channel. */ + vg_lite_uint8_t enable_g; /*! Enable G channel. */ + vg_lite_uint8_t enable_r; /*! Enable R channel. */ +} vg_lite_pixel_channel_enable_t; + +/* Pixel color transform */ +typedef struct vg_lite_color_transform { + vg_lite_float_t a_scale; + vg_lite_float_t a_bias; + vg_lite_float_t r_scale; + vg_lite_float_t r_bias; + vg_lite_float_t g_scale; + vg_lite_float_t g_bias; + vg_lite_float_t b_scale; + vg_lite_float_t b_bias; +} vg_lite_color_transform_t; + +/* VGLite API Functions *******************************************************************************************************************/ + +/* Initialize a vglite context. */ +vg_lite_error_t vg_lite_init(vg_lite_int32_t tess_width, vg_lite_int32_t tess_height); + +/* Destroy a vglite context. */ +vg_lite_error_t vg_lite_close(void); + +/* Get the VGLite driver information. */ +vg_lite_error_t vg_lite_get_info(vg_lite_info_t * info); + +/* Get the GPU chip information. */ +vg_lite_uint32_t vg_lite_get_product_info(vg_lite_char * name, vg_lite_uint32_t * chip_id, vg_lite_uint32_t * chip_rev); + +/* Query if a specific feature is supported. */ +vg_lite_uint32_t vg_lite_query_feature(vg_lite_feature_t feature); + +/* Flush command buffer and wait for GPU to complete. */ +vg_lite_error_t vg_lite_finish(void); + +/* Flush the command buffer without waiting for GPU to complete. */ +vg_lite_error_t vg_lite_flush(void); + +/* Get the value of register from register's address. */ +vg_lite_error_t vg_lite_get_register(vg_lite_uint32_t address, vg_lite_uint32_t * result); + +/* Generate a 3x3 homogeneous matrix to transform 4 source coordinates to 4 target coordinates. */ +vg_lite_error_t vg_lite_get_transform_matrix(vg_lite_point4_t src, vg_lite_point4_t dst, vg_lite_matrix_t * mat); + +/* Allocate a buffer from GPU hardware accessible memory. */ +vg_lite_error_t vg_lite_allocate(vg_lite_buffer_t * buffer); + +/* Free a buffer allocated by vg_lite_allocate() */ +vg_lite_error_t vg_lite_free(vg_lite_buffer_t * buffer); + +/* Upload RGB or YUV pixel data to an allocated buffer. */ +vg_lite_error_t vg_lite_upload_buffer(vg_lite_buffer_t * buffer, vg_lite_uint8_t * data[3], vg_lite_uint32_t stride[3]); + +/* Map a buffer into hardware accessible address space. */ +vg_lite_error_t vg_lite_map(vg_lite_buffer_t * buffer, vg_lite_map_flag_t flag, int32_t fd); + +/* Unmap a buffer that is mapped */ +vg_lite_error_t vg_lite_unmap(vg_lite_buffer_t * buffer); + +/* flush cache */ +vg_lite_error_t vg_lite_flush_mapped_buffer(vg_lite_buffer_t * buffer); + +/* Fill a buffer rectangle area with a specified color. */ +vg_lite_error_t vg_lite_clear(vg_lite_buffer_t * target, vg_lite_rectangle_t * rect, vg_lite_color_t color); + +/* Copy a source image to target buffer with transformation, blending, color mixing, and filtering. */ +vg_lite_error_t vg_lite_blit(vg_lite_buffer_t * target, + vg_lite_buffer_t * source, + vg_lite_matrix_t * matrix, + vg_lite_blend_t blend, + vg_lite_color_t color, + vg_lite_filter_t filter); + +/* Copy a rectangle area of source image to target buffer with transformation, blending, color mixing, and filtering. */ +vg_lite_error_t vg_lite_blit_rect(vg_lite_buffer_t * target, + vg_lite_buffer_t * source, + vg_lite_rectangle_t * rect, + vg_lite_matrix_t * matrix, + vg_lite_blend_t blend, + vg_lite_color_t color, + vg_lite_filter_t filter); + +/* Copy two source images to the target buffer with transformation, blending, and filtering. */ +vg_lite_error_t vg_lite_blit2(vg_lite_buffer_t * target, + vg_lite_buffer_t * source0, + vg_lite_buffer_t * source1, + vg_lite_matrix_t * matrix0, + vg_lite_matrix_t * matrix1, + vg_lite_blend_t blend, + vg_lite_filter_t filter); + +/* Copy a rectangle area of source image to target buffer without transformation, blending, color mixing, and filtering. */ +vg_lite_error_t vg_lite_copy_image(vg_lite_buffer_t * target, + vg_lite_buffer_t * source, + vg_lite_int32_t sx, + vg_lite_int32_t sy, + vg_lite_int32_t dx, + vg_lite_int32_t dy, + vg_lite_int32_t width, + vg_lite_int32_t height); + +/* Draw a path to a target buffer with transformation, color, and blending */ +vg_lite_error_t vg_lite_draw(vg_lite_buffer_t * target, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_matrix_t * matrix, + vg_lite_blend_t blend, + vg_lite_color_t color); + +/* Set stroke path attributes. */ +vg_lite_error_t vg_lite_set_stroke(vg_lite_path_t * path, + vg_lite_cap_style_t cap_style, + vg_lite_join_style_t join_style, + vg_lite_float_t line_width, + vg_lite_float_t miter_limit, + vg_lite_float_t * dash_pattern, + vg_lite_uint32_t pattern_count, + vg_lite_float_t dash_phase, + vg_lite_color_t color); + +/* Update stroke path. */ +vg_lite_error_t vg_lite_update_stroke(vg_lite_path_t * path); + +/* Set path type. */ +vg_lite_error_t vg_lite_set_path_type(vg_lite_path_t * path, vg_lite_path_type_t path_type); + +/* Clears all attributes of a path. */ +vg_lite_error_t vg_lite_clear_path(vg_lite_path_t * path); + +/* Upload a path to GPU memory so GPU can access it directly. */ +vg_lite_error_t vg_lite_upload_path(vg_lite_path_t * path); + +/* Initialize a path object with attributes. */ +vg_lite_error_t vg_lite_init_path(vg_lite_path_t * path, + vg_lite_format_t format, + vg_lite_quality_t quality, + vg_lite_uint32_t length, + vg_lite_pointer data, + vg_lite_float_t min_x, + vg_lite_float_t min_y, + vg_lite_float_t max_x, + vg_lite_float_t max_y); + +/* Initializes a arc path with attributes. */ +vg_lite_error_t vg_lite_init_arc_path(vg_lite_path_t * path, + vg_lite_format_t format, + vg_lite_quality_t quality, + vg_lite_uint32_t length, + vg_lite_pointer data, + vg_lite_float_t min_x, + vg_lite_float_t min_y, + vg_lite_float_t max_x, + vg_lite_float_t max_y); + +/* Return the size (in bytes) of command buffer for a path opcode array. */ +vg_lite_uint32_t vg_lite_get_path_length(vg_lite_uint8_t * opcode, + vg_lite_uint32_t count, + vg_lite_format_t format); + +/* Generate command buffer for the (path) based on input opcodes (opcode) and coordinates (data). */ +vg_lite_error_t vg_lite_append_path(vg_lite_path_t * path, + vg_lite_uint8_t * opcode, + vg_lite_pointer data, + vg_lite_uint32_t seg_count); + +/* Set CLUT (Color Look Up Table) for index image. The (colors) is in ARGB format. */ +vg_lite_error_t vg_lite_set_CLUT(vg_lite_uint32_t count, vg_lite_uint32_t * colors); + +/* Draw a path that is filled by a transformed image pattern. */ +vg_lite_error_t vg_lite_draw_pattern(vg_lite_buffer_t * target, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_matrix_t * path_matrix, + vg_lite_buffer_t * pattern_image, + vg_lite_matrix_t * pattern_matrix, + vg_lite_blend_t blend, + vg_lite_pattern_mode_t pattern_mode, + vg_lite_color_t pattern_color, + vg_lite_color_t color, + vg_lite_filter_t filter); + +/* Initialize a linear gradient object with default attributes. */ +vg_lite_error_t vg_lite_init_grad(vg_lite_linear_gradient_t * grad); + +/* Reset a linear gradient object attributes. */ +vg_lite_error_t vg_lite_clear_grad(vg_lite_linear_gradient_t * grad); + +/* Update a linear gradient object. */ +vg_lite_error_t vg_lite_update_grad(vg_lite_linear_gradient_t * grad); + +/* Return pointer to a linear gradient object's matrix. */ +vg_lite_matrix_t * vg_lite_get_grad_matrix(vg_lite_linear_gradient_t * grad); + +/* Set attributes for a linear gradient object. */ +vg_lite_error_t vg_lite_set_grad(vg_lite_linear_gradient_t * grad, + vg_lite_uint32_t count, + vg_lite_uint32_t * colors, + vg_lite_uint32_t * stops); + +/* Draw a path with a linear gradient object pattern. */ +vg_lite_error_t vg_lite_draw_grad(vg_lite_buffer_t * target, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_matrix_t * matrix, + vg_lite_linear_gradient_t * grad, + vg_lite_blend_t blend); + +/* Reset an extended linear gradient object attributes and free image buffer. */ +vg_lite_error_t vg_lite_clear_linear_grad(vg_lite_ext_linear_gradient_t * grad); + +/* Update an extended linear gradient object. */ +vg_lite_error_t vg_lite_update_linear_grad(vg_lite_ext_linear_gradient_t * grad); + +/* Return pointer to an extended linear gradient object's matrix. */ +vg_lite_matrix_t * vg_lite_get_linear_grad_matrix(vg_lite_ext_linear_gradient_t * grad); + +/* Set attributes for an extended linear gradient object. */ +vg_lite_error_t vg_lite_set_linear_grad(vg_lite_ext_linear_gradient_t * grad, + vg_lite_uint32_t count, + vg_lite_color_ramp_t * color_ramp, + vg_lite_linear_gradient_parameter_t grad_param, + vg_lite_gradient_spreadmode_t spread_mode, + vg_lite_uint8_t pre_mult); + +/* Draw a path with an extended linear gradient object. */ +vg_lite_error_t vg_lite_draw_linear_grad(vg_lite_buffer_t * target, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_matrix_t * path_matrix, + vg_lite_ext_linear_gradient_t * grad, + vg_lite_color_t paint_color, + vg_lite_blend_t blend, + vg_lite_filter_t filter); + +/* Reset a radial gradient object attributes and free image buffer. */ +vg_lite_error_t vg_lite_clear_radial_grad(vg_lite_radial_gradient_t * grad); + +/* Update a radial gradient object. */ +vg_lite_error_t vg_lite_update_radial_grad(vg_lite_radial_gradient_t * grad); + +/* Return pointer to a radial gradient object's matrix. */ +vg_lite_matrix_t * vg_lite_get_radial_grad_matrix(vg_lite_radial_gradient_t * grad); + +/* Set attributes for a radial gradient object. */ +vg_lite_error_t vg_lite_set_radial_grad(vg_lite_radial_gradient_t * grad, + vg_lite_uint32_t count, + vg_lite_color_ramp_t * color_ramp, + vg_lite_radial_gradient_parameter_t grad_param, + vg_lite_gradient_spreadmode_t spread_mode, + vg_lite_uint8_t pre_mult); + +/* Draw a path with a radial gradient object pattern. */ +vg_lite_error_t vg_lite_draw_radial_grad(vg_lite_buffer_t * target, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_matrix_t * path_matrix, + vg_lite_radial_gradient_t * grad, + vg_lite_color_t paint_color, + vg_lite_blend_t blend, + vg_lite_filter_t filter); + +/* Load an identity matrix. */ +vg_lite_error_t vg_lite_identity(vg_lite_matrix_t * matrix); + +/* Translate a matrix. */ +vg_lite_error_t vg_lite_translate(vg_lite_float_t x, vg_lite_float_t y, vg_lite_matrix_t * matrix); + +/* Scale a matrix. */ +vg_lite_error_t vg_lite_scale(vg_lite_float_t scale_x, vg_lite_float_t scale_y, vg_lite_matrix_t * matrix); + +/* Rotate a matrix. */ +vg_lite_error_t vg_lite_rotate(vg_lite_float_t degrees, vg_lite_matrix_t * matrix); + +/* Set and enable a scissor rectangle for render target. */ +vg_lite_error_t vg_lite_set_scissor(vg_lite_int32_t x, vg_lite_int32_t y, vg_lite_int32_t right, + vg_lite_int32_t bottom); + +/* Set scissor rectangles on mask layer. Scissor rects are enabled/disabled by following APIs. */ +vg_lite_error_t vg_lite_scissor_rects(vg_lite_uint32_t nums, vg_lite_rectangle_t rect[]); + +/* Enable scissor rects defined on mask layer. */ +vg_lite_error_t vg_lite_enable_scissor(void); + +/* Disable scissor rects defined on mask layer. */ +vg_lite_error_t vg_lite_disable_scissor(void); + +/* Query size of available contiguous video memory. */ +vg_lite_error_t vg_lite_get_mem_size(vg_lite_uint32_t * size); + +/* Set global alpha value for source image */ +vg_lite_error_t vg_lite_source_global_alpha(vg_lite_global_alpha_t alpha_mode, vg_lite_uint8_t alpha_value); + +/* Set global alpha value for destination image. */ +vg_lite_error_t vg_lite_dest_global_alpha(vg_lite_global_alpha_t alpha_mode, vg_lite_uint8_t alpha_value); + +/* Set colorkey. */ +vg_lite_error_t vg_lite_set_color_key(vg_lite_color_key4_t colorkey); + +/* Enable dither function. Dither is OFF by default. */ +vg_lite_error_t vg_lite_enable_dither(void); + +/* Disable dither function. Dither is OFF by default. */ +vg_lite_error_t vg_lite_disable_dither(void); + +/* Set a 64-byte aligned memory buffer (physical) as VGLite tessellation buffer. */ +vg_lite_error_t vg_lite_set_tess_buffer(vg_lite_uint32_t physical, vg_lite_uint32_t size); + +/* Can be called before vg_lite_init() to overwrite the default VG_LITE_COMMAND_BUFFER_SIZE */ +vg_lite_error_t vg_lite_set_command_buffer_size(vg_lite_uint32_t size); + +/* Set a user-defined external memory buffer (physical, 64-byte aligned) as VGLite command buffer. */ +vg_lite_error_t vg_lite_set_command_buffer(vg_lite_uint32_t physical, vg_lite_uint32_t size); + +/* Setup a pixel transform matrix m[20] which transforms each pixel as following: + * + * |a'| |m0 m1 m2 m3 m4 | |a| + * |r'| |m5 m6 m7 m8 m9 | |r| + * |g'| = |m10 m11 m12 m13 m14|.|g| + * |b'| |m15 m16 m17 m18 m19| |b| + * |1 | |0 0 0 0 1 | |1| + * + * The pixel transform for A, R, G, B channel can be enabled/disabled individually with (channel) parameter. + */ +vg_lite_error_t vg_lite_set_pixel_matrix(vg_lite_pixel_matrix_t matrix, vg_lite_pixel_channel_enable_t * channel); + +/* Setup 3x3 gaussian blur weight values to filter image pixels. + * + * Parameters w0, w1, w2 define a 3x3 gaussian blur weight matrix as below + * + * | w2 w1 w2 | + * | w1 w0 w1 | + * | w2 w1 w2 | + * + * The sum of 9 kernel weights must be 1.0 to avoid convolution overflow ( w0 + 4*w1 + 4*w2 = 1.0 ). + * The 3x3 weight matrix applies to a 3x3 pixel block + * + * | pixel[i-1][j-1] pixel[i][j-1] pixel[i+1][j-1]| + * | pixel[i-1][j] pixel[i][j] pixel[i+1][j] | + * | pixel[i-1][j+1] pixel[i][j+1] pixel[i+1][j+1]| + * + * With the following dot product equation: + * + * color[i][j] = w2*pixel[i-1][j-1] + w1*pixel[i][j-1] + w2*pixel[i+1][j-1] + * + w1*pixel[i-1][j] + w0*pixel[i][j] + w1*pixel[i+1][j] + * + w2*pixel[i-1][j+1] + w1*pixel[i][j+1] + w2*pixel[i+1][j+1]; + */ +vg_lite_error_t vg_lite_gaussian_filter(vg_lite_float_t w0, vg_lite_float_t w1, vg_lite_float_t w2); + +/* Enable masklayer function. Masklayer is OFF by default. */ +vg_lite_error_t vg_lite_enable_masklayer(void); + +/* Disable masklayer function. Masklayer is OFF by default. */ +vg_lite_error_t vg_lite_disable_masklayer(void); + +/* Setup a masklayer. */ +vg_lite_error_t vg_lite_set_masklayer(vg_lite_buffer_t * masklayer); + +/* Free a masklayer and disable mask operation. */ +vg_lite_error_t vg_lite_destroy_masklayer(vg_lite_buffer_t * masklayer); + +/* Create a masklayer with default format A8 and default pixel value 255. */ +vg_lite_error_t vg_lite_create_masklayer(vg_lite_buffer_t * masklayer, + vg_lite_uint32_t width, + vg_lite_uint32_t height); + +/* Set pixel values for a rectangle area in a masklayer */ +vg_lite_error_t vg_lite_fill_masklayer(vg_lite_buffer_t * masklayer, + vg_lite_rectangle_t * rect, + vg_lite_uint8_t value); + +/* Blend a rectangle area of src masklayer with dst masklayer according to (operation). */ +vg_lite_error_t vg_lite_blend_masklayer(vg_lite_buffer_t * dst, + vg_lite_buffer_t * src, + vg_lite_mask_operation_t operation, + vg_lite_rectangle_t * rect); + +/* Render a (path) with (fill_rule), (color), (matrix) to the masklayer. */ +vg_lite_error_t vg_lite_render_masklayer(vg_lite_buffer_t * masklayer, + vg_lite_mask_operation_t operation, + vg_lite_path_t * path, + vg_lite_fill_t fill_rule, + vg_lite_color_t color, + vg_lite_matrix_t * matrix); + +/* Set mirror orientation. */ +vg_lite_error_t vg_lite_set_mirror(vg_lite_orientation_t orientation); + +/* Set gamma value. */ +vg_lite_error_t vg_lite_set_gamma(vg_lite_gamma_conversion_t gamma_value); + +/* Enable color transformation, which is OFF by default. */ +vg_lite_error_t vg_lite_enable_color_transform(void); + +/* Disable color transformation, which is OFF by default. */ +vg_lite_error_t vg_lite_disable_color_transform(void); + +/* Set pixel color transformation scale and bias values for each pixel channel. */ +vg_lite_error_t vg_lite_set_color_transform(vg_lite_color_transform_t * values); + +/* Set flexa stream id. */ +vg_lite_error_t vg_lite_flexa_set_stream(vg_lite_uint8_t stream_id); + +/* set flexa background buffer.*/ +vg_lite_error_t vg_lite_flexa_bg_buffer(vg_lite_uint8_t stream_id, + vg_lite_buffer_t * buffer, + vg_lite_uint32_t seg_count, + vg_lite_uint32_t seg_size); + +/* Enable flexa. */ +vg_lite_error_t vg_lite_flexa_enable(void); + +/* Disable flexa.*/ +vg_lite_error_t vg_lite_flexa_disable(void); + +/* Set flexa stop flag after the last frame. */ +vg_lite_error_t vg_lite_flexa_stop_frame(void); + +/* Dump command buffer */ +vg_lite_error_t vg_lite_dump_command_buffer(void); + +/* Return VGLite parameters in params[] array */ +vg_lite_error_t vg_lite_get_parameter(vg_lite_param_type_t type, + vg_lite_int32_t count, + vg_lite_float_t * params); + +#endif /* VGLITE_VERSION_3_0 */ + +#ifdef __cplusplus +} +#endif +#endif /* _vg_lite_h_ */ diff --git a/src/others/vg_lite_tvg/vg_lite_matrix.c b/src/debugging/vg_lite_tvg/vg_lite_matrix.c similarity index 100% rename from src/others/vg_lite_tvg/vg_lite_matrix.c rename to src/debugging/vg_lite_tvg/vg_lite_matrix.c diff --git a/src/others/vg_lite_tvg/vg_lite_tvg.cpp b/src/debugging/vg_lite_tvg/vg_lite_tvg.cpp similarity index 100% rename from src/others/vg_lite_tvg/vg_lite_tvg.cpp rename to src/debugging/vg_lite_tvg/vg_lite_tvg.cpp diff --git a/src/display/lv_display.c b/src/display/lv_display.c index f5b5fb2caa..7b0d81af51 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -17,7 +17,7 @@ #include "../stdlib/lv_string.h" #include "../themes/lv_theme.h" #include "../core/lv_global.h" -#include "../others/sysmon/lv_sysmon.h" +#include "../debugging/sysmon/lv_sysmon.h" #if LV_USE_DRAW_SW #include "../draw/sw/lv_draw_sw.h" diff --git a/src/display/lv_display_private.h b/src/display/lv_display_private.h index 6545b0c161..c00e81a28d 100644 --- a/src/display/lv_display_private.h +++ b/src/display/lv_display_private.h @@ -19,7 +19,7 @@ extern "C" { #include "lv_display.h" #if LV_USE_SYSMON -#include "../others/sysmon/lv_sysmon_private.h" +#include "../debugging/sysmon/lv_sysmon_private.h" #endif /********************* diff --git a/src/others/snapshot/lv_snapshot.c b/src/draw/snapshot/lv_snapshot.c similarity index 100% rename from src/others/snapshot/lv_snapshot.c rename to src/draw/snapshot/lv_snapshot.c diff --git a/src/others/snapshot/lv_snapshot.h b/src/draw/snapshot/lv_snapshot.h similarity index 100% rename from src/others/snapshot/lv_snapshot.h rename to src/draw/snapshot/lv_snapshot.h diff --git a/src/draw/vg_lite/lv_draw_vg_lite_type.h b/src/draw/vg_lite/lv_draw_vg_lite_type.h index a5cc899618..1afe4ede3f 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_type.h +++ b/src/draw/vg_lite/lv_draw_vg_lite_type.h @@ -22,7 +22,7 @@ extern "C" { #include "../../misc/lv_array.h" #if LV_USE_VG_LITE_THORVG -#include "../../others/vg_lite_tvg/vg_lite.h" +#include "../../debugging/vg_lite_tvg/vg_lite.h" #else #if LV_USE_VG_LITE_DRIVER #include "../../libs/vg_lite_driver/inc/vg_lite.h" diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index 022b1b639d..4fa8ed208b 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -22,7 +22,7 @@ extern "C" { #include #if LV_USE_VG_LITE_THORVG -#include "../../others/vg_lite_tvg/vg_lite.h" +#include "../../debugging/vg_lite_tvg/vg_lite.h" #else #if LV_USE_VG_LITE_DRIVER #include "../../libs/vg_lite_driver/inc/vg_lite.h" diff --git a/src/font/lv_binfont_loader.c b/src/font/binfont_loader/lv_binfont_loader.c similarity index 99% rename from src/font/lv_binfont_loader.c rename to src/font/binfont_loader/lv_binfont_loader.c index d53452c9f2..a911d882b0 100644 --- a/src/font/lv_binfont_loader.c +++ b/src/font/binfont_loader/lv_binfont_loader.c @@ -6,11 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_font_fmt_txt_private.h" -#include "../lvgl.h" -#include "../misc/lv_fs_private.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" +#include "../../lvgl.h" +#include "../fmt_txt/lv_font_fmt_txt_private.h" +#include "../../misc/lv_fs_private.h" +#include "../../misc/lv_types.h" +#include "../../stdlib/lv_string.h" #include "lv_binfont_loader.h" /********************** diff --git a/src/font/lv_binfont_loader.h b/src/font/binfont_loader/lv_binfont_loader.h similarity index 100% rename from src/font/lv_binfont_loader.h rename to src/font/binfont_loader/lv_binfont_loader.h diff --git a/src/font/lv_font_fmt_txt.c b/src/font/fmt_txt/lv_font_fmt_txt.c similarity index 99% rename from src/font/lv_font_fmt_txt.c rename to src/font/fmt_txt/lv_font_fmt_txt.c index 6df2f9a276..b05c1c268f 100644 --- a/src/font/lv_font_fmt_txt.c +++ b/src/font/fmt_txt/lv_font_fmt_txt.c @@ -6,14 +6,14 @@ /********************* * INCLUDES *********************/ -#include "lv_font.h" +#include "../lv_font.h" #include "lv_font_fmt_txt_private.h" -#include "../core/lv_global.h" -#include "../misc/lv_assert.h" -#include "../misc/lv_types.h" -#include "../misc/lv_log.h" -#include "../misc/lv_utils.h" -#include "../stdlib/lv_mem.h" +#include "../../core/lv_global.h" +#include "../../misc/lv_assert.h" +#include "../../misc/lv_types.h" +#include "../../misc/lv_log.h" +#include "../../misc/lv_utils.h" +#include "../../stdlib/lv_mem.h" /********************* * DEFINES diff --git a/src/font/lv_font_fmt_txt.h b/src/font/fmt_txt/lv_font_fmt_txt.h similarity index 99% rename from src/font/lv_font_fmt_txt.h rename to src/font/fmt_txt/lv_font_fmt_txt.h index 4dae27b7d8..962061776f 100644 --- a/src/font/lv_font_fmt_txt.h +++ b/src/font/fmt_txt/lv_font_fmt_txt.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "lv_font.h" -#include "../misc/lv_types.h" +#include "../lv_font.h" +#include "../../misc/lv_types.h" /********************* * DEFINES diff --git a/src/font/lv_font_fmt_txt_private.h b/src/font/fmt_txt/lv_font_fmt_txt_private.h similarity index 100% rename from src/font/lv_font_fmt_txt_private.h rename to src/font/fmt_txt/lv_font_fmt_txt_private.h diff --git a/src/others/font_manager/lv_font_manager.c b/src/font/font_manager/lv_font_manager.c similarity index 100% rename from src/others/font_manager/lv_font_manager.c rename to src/font/font_manager/lv_font_manager.c diff --git a/src/others/font_manager/lv_font_manager.h b/src/font/font_manager/lv_font_manager.h similarity index 100% rename from src/others/font_manager/lv_font_manager.h rename to src/font/font_manager/lv_font_manager.h diff --git a/src/others/font_manager/lv_font_manager_recycle.c b/src/font/font_manager/lv_font_manager_recycle.c similarity index 100% rename from src/others/font_manager/lv_font_manager_recycle.c rename to src/font/font_manager/lv_font_manager_recycle.c diff --git a/src/others/font_manager/lv_font_manager_recycle.h b/src/font/font_manager/lv_font_manager_recycle.h similarity index 100% rename from src/others/font_manager/lv_font_manager_recycle.h rename to src/font/font_manager/lv_font_manager_recycle.h diff --git a/src/others/imgfont/lv_imgfont.c b/src/font/imgfont/lv_imgfont.c similarity index 100% rename from src/others/imgfont/lv_imgfont.c rename to src/font/imgfont/lv_imgfont.c diff --git a/src/others/imgfont/lv_imgfont.h b/src/font/imgfont/lv_imgfont.h similarity index 100% rename from src/others/imgfont/lv_imgfont.h rename to src/font/imgfont/lv_imgfont.h diff --git a/src/others/gridnav/lv_gridnav.c b/src/indev/lv_gridnav.c similarity index 99% rename from src/others/gridnav/lv_gridnav.c rename to src/indev/lv_gridnav.c index 4458fce757..ddc5136d6d 100644 --- a/src/others/gridnav/lv_gridnav.c +++ b/src/indev/lv_gridnav.c @@ -9,10 +9,10 @@ #include "lv_gridnav.h" #if LV_USE_GRIDNAV -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" -#include "../../indev/lv_indev.h" -#include "../../core/lv_obj_private.h" +#include "../misc/lv_assert.h" +#include "../misc/lv_math.h" +#include "../indev/lv_indev.h" +#include "../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/others/gridnav/lv_gridnav.h b/src/indev/lv_gridnav.h similarity index 98% rename from src/others/gridnav/lv_gridnav.h rename to src/indev/lv_gridnav.h index 65bd1e0927..59fb80d166 100644 --- a/src/others/gridnav/lv_gridnav.h +++ b/src/indev/lv_gridnav.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../core/lv_obj.h" +#include "../core/lv_obj.h" #if LV_USE_GRIDNAV diff --git a/src/lv_init.c b/src/lv_init.c index eaf4e74a4d..2dd43b205c 100644 --- a/src/lv_init.c +++ b/src/lv_init.c @@ -38,9 +38,9 @@ #include "themes/simple/lv_theme_simple.h" #include "misc/lv_fs.h" #include "osal/lv_os_private.h" -#include "others/sysmon/lv_sysmon_private.h" +#include "debugging/sysmon/lv_sysmon_private.h" #include "others/translation/lv_translation.h" -#include "others/xml/lv_xml.h" +#include "xml/lv_xml.h" #if LV_USE_SVG #include "libs/svg/lv_svg_decoder.h" diff --git a/src/others/vg_lite_tvg/vg_lite.h b/src/others/vg_lite_tvg/vg_lite.h deleted file mode 100644 index 539a3e7483..0000000000 --- a/src/others/vg_lite_tvg/vg_lite.h +++ /dev/null @@ -1,1387 +0,0 @@ -/**************************************************************************** -* -* Copyright 2012 - 2023 Vivante Corporation, Santa Clara, California. -* All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* 'Software'), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sub license, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject -* to the following conditions: -* -* The above copyright notice and this permission notice (including the -* next paragraph) shall be included in all copies or substantial -* portions of the Software. -* -* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -* IN NO EVENT SHALL VIVANTE AND/OR ITS SUPPLIERS BE LIABLE FOR ANY -* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -*****************************************************************************/ - -#ifndef _vg_lite_h_ -#define _vg_lite_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * causes MSVC error C1189. - * Not needed because "The __inline keyword is equivalent to inline." - * See: https://learn.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=msvc-170 -*/ -/* -#if defined(_MSC_VER) -#define inline __inline -#endif -*/ - -#include -#include - - -/* VGLite API Constants *******************************************************************************************************************/ - -#define VGLITE_HEADER_VERSION 7 - -#ifndef VGLITE_VERSION_3_0 -#define VGLITE_VERSION_3_0 1 - -#define VGLITE_MAKE_VERSION(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) -#define VGLITE_VERSION_MAJOR(version) (((uint32_t)(version) >> 16) & 0xff) -#define VGLITE_VERSION_MINOR(version) (((uint32_t)(version) >> 8) & 0xff) -#define VGLITE_VERSION_PATCH(version) ((uint32_t)(version) & 0xff) - -#define VGLITE_API_VERSION_3_0 VGLITE_MAKE_VERSION(3, 0, 0) - -#define VGLITE_RELEASE_VERSION VGLITE_MAKE_VERSION(4,0,47) - -#define VGL_FALSE 0 -#define VGL_TRUE 1 - -/* Path command (op code). */ -#define VLC_OP_END 0x00 -#define VLC_OP_CLOSE 0x01 -#define VLC_OP_MOVE 0x02 -#define VLC_OP_MOVE_REL 0x03 -#define VLC_OP_LINE 0x04 -#define VLC_OP_LINE_REL 0x05 -#define VLC_OP_QUAD 0x06 -#define VLC_OP_QUAD_REL 0x07 -#define VLC_OP_CUBIC 0x08 -#define VLC_OP_CUBIC_REL 0x09 -#define VLC_OP_BREAK 0x0A -#define VLC_OP_HLINE 0x0B -#define VLC_OP_HLINE_REL 0x0C -#define VLC_OP_VLINE 0x0D -#define VLC_OP_VLINE_REL 0x0E -#define VLC_OP_SQUAD 0x0F -#define VLC_OP_SQUAD_REL 0x10 -#define VLC_OP_SCUBIC 0x11 -#define VLC_OP_SCUBIC_REL 0x12 -#define VLC_OP_SCCWARC 0x13 -#define VLC_OP_SCCWARC_REL 0x14 -#define VLC_OP_SCWARC 0x15 -#define VLC_OP_SCWARC_REL 0x16 -#define VLC_OP_LCCWARC 0x17 -#define VLC_OP_LCCWARC_REL 0x18 -#define VLC_OP_LCWARC 0x19 -#define VLC_OP_LCWARC_REL 0x1A - -/* Macros for path manipulating: See path definitions. */ -#define VLM_PATH_ENABLE_UPLOAD(path) (path).uploaded.property |= 1 -#define VLM_PATH_DISABLE_UPLOAD(path) (path).uploaded.property &= (~1) -#define VLM_PATH_GET_UPLOAD_BIT(path) ((path).uploaded.property & 1) - -/* Gradient constants. */ -#define VLC_MAX_COLOR_RAMP_STOPS 256 /*! The max number of radial gradient stops. */ -#define VLC_MAX_GRADIENT_STOPS 16 /*! The max number of gradient stops. */ -#define VLC_GRADIENT_BUFFER_WIDTH 1024 /*! The internal gradient buffer width.*/ - - -/* API name defines for backward compatibility to VGLite 2.0 APIs */ -#define vg_lite_buffer_upload vg_lite_upload_buffer -#define vg_lite_path_append vg_lite_append_path -#define vg_lite_path_calc_length vg_lite_get_path_length -#define vg_lite_set_ts_buffer vg_lite_set_tess_buffer -#define vg_lite_set_draw_path_type vg_lite_set_path_type -#define vg_lite_create_mask_layer vg_lite_create_masklayer -#define vg_lite_fill_mask_layer vg_lite_fill_masklayer -#define vg_lite_blend_mask_layer vg_lite_blend_masklayer -#define vg_lite_generate_mask_layer_by_path vg_lite_render_masklayer -#define vg_lite_set_mask_layer vg_lite_set_masklayer -#define vg_lite_destroy_mask_layer vg_lite_destroy_masklayer -#define vg_lite_enable_mask vg_lite_enable_masklayer -#define vg_lite_enable_color_transformation vg_lite_enable_color_transform -#define vg_lite_set_color_transformation vg_lite_set_color_transform -#define vg_lite_set_image_global_alpha vg_lite_source_global_alpha -#define vg_lite_set_dest_global_alpha vg_lite_dest_global_alpha -#define vg_lite_clear_rad_grad vg_lite_clear_radial_grad -#define vg_lite_update_rad_grad vg_lite_update_radial_grad -#define vg_lite_get_rad_grad_matrix vg_lite_get_radial_grad_matrix -#define vg_lite_set_rad_grad vg_lite_set_radial_grad -#define vg_lite_draw_linear_gradient vg_lite_draw_linear_grad -#define vg_lite_draw_radial_gradient vg_lite_draw_radial_grad -#define vg_lite_draw_gradient vg_lite_draw_grad -#define vg_lite_mem_avail vg_lite_get_mem_size -#define vg_lite_set_update_stroke vg_lite_update_stroke - -#define vg_lite_buffer_image_mode_t vg_lite_image_mode_t -#define vg_lite_draw_path_type_t vg_lite_path_type_t -#define vg_lite_linear_gradient_ext_t vg_lite_ext_linear_gradient_t -#define vg_lite_buffer_transparency_mode_t vg_lite_transparency_t - - -/* VGLite API Types ***********************************************************************************************************************/ - -typedef unsigned char vg_lite_uint8_t; -typedef char vg_lite_int8_t; -typedef short vg_lite_int16_t; -typedef unsigned short vg_lite_uint16_t; -typedef int vg_lite_int32_t; -typedef unsigned int vg_lite_uint32_t; -typedef unsigned long long vg_lite_uint64_t; -typedef float vg_lite_float_t; -typedef double vg_lite_double_t; -typedef char vg_lite_char; -typedef char* vg_lite_string; -typedef void* vg_lite_pointer; -typedef void vg_lite_void; -typedef unsigned int vg_lite_color_t; - - -/* VGLite API Enumerations ****************************************************************************************************************/ - -#ifndef VG_LITE_ERROR -#define VG_LITE_ERROR 1 - - /* Error codes that the vg_lite functions can return. */ - typedef enum vg_lite_error - { - VG_LITE_SUCCESS = 0, /*! Success. */ - VG_LITE_INVALID_ARGUMENT, /*! An invalid argument was specified. */ - VG_LITE_OUT_OF_MEMORY, /*! Out of memory. */ - VG_LITE_NO_CONTEXT, /*! No context or an uninitialized context specified. */ - VG_LITE_TIMEOUT, /*! A timeout has occurred during a wait. */ - VG_LITE_OUT_OF_RESOURCES, /*! Out of system resources. */ - VG_LITE_GENERIC_IO, /*! Cannot communicate with the kernel driver. */ - VG_LITE_NOT_SUPPORT, /*! Function call not supported. */ - VG_LITE_ALREADY_EXISTS, /*! Object already exists */ - VG_LITE_NOT_ALIGNED, /*! Data alignment error */ - VG_LITE_FLEXA_TIME_OUT, /*! VG timeout requesting for segment buffer */ - VG_LITE_FLEXA_HANDSHAKE_FAIL, /*! VG and SBI synchronizer handshake failed */ - } vg_lite_error_t; -#endif - - /* Chip features bit */ - typedef enum vg_lite_feature - { - gcFEATURE_BIT_VG_IM_INDEX_FORMAT, - gcFEATURE_BIT_VG_SCISSOR, - gcFEATURE_BIT_VG_BORDER_CULLING, - gcFEATURE_BIT_VG_RGBA2_FORMAT, - gcFEATURE_BIT_VG_QUALITY_8X, - gcFEATURE_BIT_VG_IM_FASTCLAER, - gcFEATURE_BIT_VG_RADIAL_GRADIENT, - gcFEATURE_BIT_VG_GLOBAL_ALPHA, - gcFEATURE_BIT_VG_RGBA8_ETC2_EAC, - gcFEATURE_BIT_VG_COLOR_KEY, - gcFEATURE_BIT_VG_DOUBLE_IMAGE, - gcFEATURE_BIT_VG_YUV_OUTPUT, - gcFEATURE_BIT_VG_FLEXA, - gcFEATURE_BIT_VG_24BIT, - gcFEATURE_BIT_VG_DITHER, - gcFEATURE_BIT_VG_USE_DST, - gcFEATURE_BIT_VG_PE_CLEAR, - gcFEATURE_BIT_VG_IM_INPUT, - gcFEATURE_BIT_VG_DEC_COMPRESS, - gcFEATURE_BIT_VG_LINEAR_GRADIENT_EXT, - gcFEATURE_BIT_VG_MASK, - gcFEATURE_BIT_VG_MIRROR, - gcFEATURE_BIT_VG_GAMMA, - gcFEATURE_BIT_VG_NEW_BLEND_MODE, - gcFEATURE_BIT_VG_STENCIL, - gcFEATURE_BIT_VG_SRC_PREMULTIPLIED, /*! Valid only if gcFEATURE_BIT_VG_HW_PREMULTIPLY is 0 */ - gcFEATURE_BIT_VG_HW_PREMULTIPLY, /*! HW multiplier can accept either premultiplied or not */ - gcFEATURE_BIT_VG_COLOR_TRANSFORMATION, - gcFEATURE_BIT_VG_LVGL_SUPPORT, - gcFEATURE_BIT_VG_INDEX_ENDIAN, - gcFEATURE_BIT_VG_24BIT_PLANAR, - gcFEATURE_BIT_VG_PIXEL_MATRIX, - gcFEATURE_BIT_VG_NEW_IMAGE_INDEX, - gcFEATURE_BIT_VG_PARALLEL_PATHS, - gcFEATURE_BIT_VG_STRIPE_MODE, - gcFEATURE_BIT_VG_IM_DEC_INPUT, - gcFEATURE_BIT_VG_GAUSSIAN_BLUR, - gcFEATURE_BIT_VG_RECTANGLE_TILED_OUT, - gcFEATURE_BIT_VG_TESSELLATION_TILED_OUT, - gcFEATURE_BIT_VG_IM_REPEAT_REFLECT, - gcFEATURE_BIT_VG_YUY2_INPUT, - gcFEATURE_BIT_VG_YUV_INPUT, - gcFEATURE_BIT_VG_YUV_TILED_INPUT, - gcFEATURE_BIT_VG_AYUV_INPUT, - gcFEATURE_BIT_VG_16PIXELS_ALIGN, - gcFEATURE_BIT_VG_DEC_COMPRESS_2_0, - gcFEATURE_COUNT - } vg_lite_feature_t; - - /* Rendering quality enums. */ - typedef enum vg_lite_quality - { - VG_LITE_HIGH, /*! High quality 16x anti-aliasing path. */ - VG_LITE_UPPER, /*! Upper quality 8x anti-aliasing path. */ - VG_LITE_MEDIUM, /*! Medium quality 4x anti-aliasing path. */ - VG_LITE_LOW, /*! Low quality path without any anti-aliasing. */ - } vg_lite_quality_t; - - /* Format of path coordinates. */ - typedef enum vg_lite_format - { - VG_LITE_S8, /*! Signed 8-bit coordinates. */ - VG_LITE_S16, /*! Signed 16-bit coordinates. */ - VG_LITE_S32, /*! Signed 32-bit coordinates. */ - VG_LITE_FP32, /*! 32-bit floating point coordinates. */ - } vg_lite_format_t; - - /* Format of pixel buffer. */ - typedef enum vg_lite_buffer_format - { - /* OpenVG VGImageFormat enums: - * Note: The bits for each color channel are stored within a machine word - * from MSB to LSB in the order indicated by the pixel format name. - * This is opposite of VG_LITE_* formats (from LSB to MSB). - */ - - /* RGB{A,X} channel ordering */ - VG_sRGBX_8888 = 0, - VG_sRGBA_8888 = 1, - VG_sRGBA_8888_PRE = 2, - VG_sRGB_565 = 3, - VG_sRGBA_5551 = 4, - VG_sRGBA_4444 = 5, - VG_sL_8 = 6, - VG_lRGBX_8888 = 7, - VG_lRGBA_8888 = 8, - VG_lRGBA_8888_PRE = 9, - VG_lL_8 = 10, - VG_A_8 = 11, - VG_BW_1 = 12, - VG_A_1 = 13, - VG_A_4 = 14, - - VG_sRGBX_8888_PRE = 15, - VG_sRGB_565_PRE = 16, - VG_sRGBA_5551_PRE = 17, - VG_sRGBA_4444_PRE = 18, - VG_lRGBX_8888_PRE = 19, - VG_lRGB_565 = 20, - VG_lRGB_565_PRE = 21, - VG_lRGBA_5551 = 22, - VG_lRGBA_5551_PRE = 23, - VG_lRGBA_4444 = 24, - VG_lRGBA_4444_PRE = 25, - - /* {A,X}RGB channel ordering */ - VG_sXRGB_8888 = 0 | (1 << 6), - VG_sARGB_8888 = 1 | (1 << 6), - VG_sARGB_8888_PRE = 2 | (1 << 6), - VG_sARGB_1555 = 4 | (1 << 6), - VG_sARGB_4444 = 5 | (1 << 6), - VG_lXRGB_8888 = 7 | (1 << 6), - VG_lARGB_8888 = 8 | (1 << 6), - VG_lARGB_8888_PRE = 9 | (1 << 6), - - /* BGR{A,X} channel ordering */ - VG_sBGRX_8888 = 0 | (1 << 7), - VG_sBGRA_8888 = 1 | (1 << 7), - VG_sBGRA_8888_PRE = 2 | (1 << 7), - VG_sBGR_565 = 3 | (1 << 7), - VG_sBGRA_5551 = 4 | (1 << 7), - VG_sBGRA_4444 = 5 | (1 << 7), - VG_lBGRX_8888 = 7 | (1 << 7), - VG_lBGRA_8888 = 8 | (1 << 7), - VG_lBGRA_8888_PRE = 9 | (1 << 7), - - /* {A,X}BGR channel ordering */ - VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), - VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), - VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), - VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), - VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), - VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), - VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), - VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7), - - /* Original VGLite API image format enums: - * Note: The bits for each color channel are stored within a machine word - * from LSB to MSB in the order indicated by the pixel format name. - * This is opposite of OPENVG VG_* formats (from MSB to LSB). - */ - VG_LITE_RGBA8888 = 0 | (1 << 10), - VG_LITE_BGRA8888 = 1 | (1 << 10), - VG_LITE_RGBX8888 = 2 | (1 << 10), - VG_LITE_BGRX8888 = 3 | (1 << 10), - VG_LITE_RGB565 = 4 | (1 << 10), - VG_LITE_BGR565 = 5 | (1 << 10), - VG_LITE_RGBA4444 = 6 | (1 << 10), - VG_LITE_BGRA4444 = 7 | (1 << 10), - VG_LITE_BGRA5551 = 8 | (1 << 10), - VG_LITE_A4 = 9 | (1 << 10), - VG_LITE_A8 = 10 | (1 << 10), - VG_LITE_L8 = 11 | (1 << 10), - VG_LITE_YUYV = 12 | (1 << 10), - VG_LITE_YUY2 = 13 | (1 << 10), - VG_LITE_ANV12 = 14 | (1 << 10), - VG_LITE_AYUY2 = 15 | (1 << 10), - VG_LITE_NV12 = 16 | (1 << 10), - VG_LITE_YV12 = 17 | (1 << 10), - VG_LITE_YV24 = 18 | (1 << 10), - VG_LITE_YV16 = 19 | (1 << 10), - VG_LITE_NV16 = 20 | (1 << 10), - VG_LITE_YUY2_TILED = 21 | (1 << 10), - VG_LITE_NV12_TILED = 22 | (1 << 10), - VG_LITE_ANV12_TILED = 23 | (1 << 10), - VG_LITE_AYUY2_TILED = 24 | (1 << 10), - VG_LITE_RGBA2222 = 25 | (1 << 10), - VG_LITE_BGRA2222 = 26 | (1 << 10), - VG_LITE_ABGR2222 = 27 | (1 << 10), - VG_LITE_ARGB2222 = 28 | (1 << 10), - VG_LITE_ABGR4444 = 29 | (1 << 10), - VG_LITE_ARGB4444 = 30 | (1 << 10), - VG_LITE_ABGR8888 = 31 | (1 << 10), - VG_LITE_ARGB8888 = 32 | (1 << 10), - VG_LITE_ABGR1555 = 33 | (1 << 10), - VG_LITE_RGBA5551 = 34 | (1 << 10), - VG_LITE_ARGB1555 = 35 | (1 << 10), - VG_LITE_XBGR8888 = 36 | (1 << 10), - VG_LITE_XRGB8888 = 37 | (1 << 10), - VG_LITE_RGBA8888_ETC2_EAC = 38 | (1 << 10), - VG_LITE_RGB888 = 39 | (1 << 10), - VG_LITE_BGR888 = 40 | (1 << 10), - VG_LITE_ABGR8565 = 41 | (1 << 10), - VG_LITE_BGRA5658 = 42 | (1 << 10), - VG_LITE_ARGB8565 = 43 | (1 << 10), - VG_LITE_RGBA5658 = 44 | (1 << 10), - VG_LITE_ABGR8565_PLANAR = 45 | (1 << 10), - VG_LITE_BGRA5658_PLANAR = 46 | (1 << 10), - VG_LITE_ARGB8565_PLANAR = 47 | (1 << 10), - VG_LITE_RGBA5658_PLANAR = 48 | (1 << 10), - - VG_LITE_INDEX_1 = 0 | (1 << 11), /*! Indexed format. */ - VG_LITE_INDEX_2 = 1 | (1 << 11), - VG_LITE_INDEX_4 = 2 | (1 << 11), - VG_LITE_INDEX_8 = 3 | (1 << 11), - - } vg_lite_buffer_format_t; - - /* Swizzle of packed YUV format UV channels. */ - typedef enum vg_lite_swizzle - { - VG_LITE_SWIZZLE_UV, - VG_LITE_SWIZZLE_VU, - } vg_lite_swizzle_t; - - /* The YUV<->RGB conversion rule. */ - typedef enum vg_lite_yuv2rgb - { - VG_LITE_YUV601, - VG_LITE_YUV709, - } vg_lite_yuv2rgb_t; - - /* The pixel layout in a buffer. */ - typedef enum vg_lite_buffer_layout - { - VG_LITE_LINEAR, - VG_LITE_TILED, - } vg_lite_buffer_layout_t; - - /* The image (buffer) rendering mode. Match OpenVG enum VGImageMode */ - typedef enum vg_lite_image_mode - { - /* For enum value backward compatibility */ - VG_LITE_ZERO = 0, - VG_LITE_NORMAL_IMAGE_MODE = 0x1F00, - VG_LITE_MULTIPLY_IMAGE_MODE = 0x1F01, - VG_LITE_STENCIL_MODE = 0x1F02, - VG_LITE_NONE_IMAGE_MODE = 0x1F03, - VG_LITE_RECOLOR_MODE = 0x1F04, - } vg_lite_image_mode_t; - - /* The image (buffer) transparency mode. */ - typedef enum vg_lite_transparency - { - VG_LITE_IMAGE_OPAQUE, - VG_LITE_IMAGE_TRANSPARENT - } vg_lite_transparency_t; - - /* Blending modes. VG_BLEND_* match OpenVG enum VGBlendMode. - * S and D represent source and destination color channels. - * Sa and Da represent the source and destination alpha channels. - */ - typedef enum vg_lite_blend - { - VG_LITE_BLEND_NONE = 0, /*! S, No blend, Non-premultiplied */ - VG_LITE_BLEND_SRC_OVER = 1, /*! S + (1 - Sa) * D , Non-premultiplied */ - VG_LITE_BLEND_DST_OVER = 2, /*! (1 - Da) * S + D , Non-premultiplied */ - VG_LITE_BLEND_SRC_IN = 3, /*! Da * S , Non-premultiplied */ - VG_LITE_BLEND_DST_IN = 4, /*! Sa * D , Non-premultiplied */ - VG_LITE_BLEND_MULTIPLY = 5, /*! S * (1 - Da) + D * (1 - Sa) + S * D , Non-premultiplied */ - VG_LITE_BLEND_SCREEN = 6, /*! S + D - S * D , Non-premultiplied */ - VG_LITE_BLEND_DARKEN = 7, /*! min(SrcOver, DstOver) , Non-premultiplied */ - VG_LITE_BLEND_LIGHTEN = 8, /*! max(SrcOver, DstOver) , Non-premultiplied */ - VG_LITE_BLEND_ADDITIVE = 9, /*! S + D , Non-premultiplied */ - VG_LITE_BLEND_SUBTRACT = 10, /*! D * (1 - Sa) , Non-premultiplied */ - VG_LITE_BLEND_SUBTRACT_LVGL = 11, /*! D - S , Non-premultiplied */ - VG_LITE_BLEND_NORMAL_LVGL = 12, /*! S * Sa + (1 - Sa) * D , Non-premultiplied */ - VG_LITE_BLEND_ADDITIVE_LVGL = 13, /*! (S + D) * Sa + D * (1 - Sa) , Non-premultiplied */ - VG_LITE_BLEND_MULTIPLY_LVGL = 14, /*! (S * D) * Sa + D * (1 - Sa) , Non-premultiplied */ - VG_LITE_BLEND_PREMULTIPLY_SRC_OVER = 15, /*! S * Sa + (1 - Sa) * D , Non-premultiplied */ - - OPENVG_BLEND_SRC = 0x2000, /*! Copy SRC, no blend, Premultiplied */ - OPENVG_BLEND_SRC_OVER = 0x2001, /*! Porter-Duff SRC_OVER blend, Premultiplied */ - OPENVG_BLEND_DST_OVER = 0x2002, /*! Porter-Duff DST_OVER blend, Premultiplied */ - OPENVG_BLEND_SRC_IN = 0x2003, /*! Porter-Duff SRC_IN blend, Premultiplied */ - OPENVG_BLEND_DST_IN = 0x2004, /*! Porter-Duff DST_IN blend, Premultiplied */ - OPENVG_BLEND_MULTIPLY = 0x2005, /*! Porter-Duff MULTIPLY blend, Premultiplied */ - OPENVG_BLEND_SCREEN = 0x2006, /*! Porter-Duff SCREEN blend, Premultiplied */ - OPENVG_BLEND_DARKEN = 0x2007, /*! Porter-Duff DARKEN blend, Premultiplied */ - OPENVG_BLEND_LIGHTEN = 0x2008, /*! Porter-Duff LIGHTEN blend, Premultiplied */ - OPENVG_BLEND_ADDITIVE = 0x2009, /*! Porter-Duff ADDITIVE blend, Premultiplied */ - } vg_lite_blend_t; - - /* Fill rules. Match OpenVG enum VGFillRule */ - typedef enum vg_lite_fill - { - VG_LITE_FILL_EVEN_ODD = 0x1900, /*! A pixel is drawn it it crosses an odd number of path pixels. */ - VG_LITE_FILL_NON_ZERO = 0x1901, /*! A pixel is drawn if it crosses at least one path pixel. */ - } vg_lite_fill_t; - - /* Global alpha modes. */ - typedef enum vg_lite_global_alpha - { - VG_LITE_NORMAL = 0, /*! Use original src/dst alpha value. */ - VG_LITE_GLOBAL, /*! Use global src/dst alpha value to replace original src/dst alpha value. */ - VG_LITE_SCALED, /*! Multiply global src/dst alpha value and original src/dst alpha value. */ - } vg_lite_global_alpha_t; - - /* Filter modes. */ - typedef enum vg_lite_filter - { - VG_LITE_FILTER_POINT = 0, /*! Fetch the nearest image pixel. */ - VG_LITE_FILTER_LINEAR = 0x1000, /*! Used for linear paint. */ - VG_LITE_FILTER_BI_LINEAR = 0x2000, /*! Use a 2x2 box around the image pixel and perform an interpolation. */ - VG_LITE_FILTER_GAUSSIAN = 0x3000, /*! Perform 3x3 gaussian blur with the convolution for image pixel. */ - } vg_lite_filter_t; - - /* Pattern padding mode. Match OpenVG enum VGTilingMode. */ - typedef enum vg_lite_pattern_mode - { - VG_LITE_PATTERN_COLOR = 0x1D00, /*! Pixel outside the bounds of sourceimage should be taken as the color */ - VG_LITE_PATTERN_PAD = 0x1D01, /*! Pixel outside the bounds of sourceimage should be taken as having the same color as the closest edge pixel */ - VG_LITE_PATTERN_REPEAT = 0x1D02, /*! Pixel outside the bounds of sourceimage should be repeated indefinitely in all directions */ - VG_LITE_PATTERN_REFLECT = 0x1D03, /*! Pixel outside the bounds of sourceimage should be reflected indefinitely in all directions */ - } vg_lite_pattern_mode_t; - - /* Paint type. Match OpenVG enum VGPaintType. */ - typedef enum vg_lite_paint_type - { - /* For enum value backward compatibility */ - VG_LITE_PAINT_ZERO = 0, - VG_LITE_PAINT_COLOR = 0x1B00, - VG_LITE_PAINT_LINEAR_GRADIENT = 0x1B01, - VG_LITE_PAINT_RADIAL_GRADIENT = 0x1B02, - VG_LITE_PAINT_PATTERN = 0x1B03, - } vg_lite_paint_type_t; - - /* Radial gradient padding mode. Match OpenVG enum VGColorRampSpreadMode */ - typedef enum - { - VG_LITE_GRADIENT_SPREAD_FILL = 0, - VG_LITE_GRADIENT_SPREAD_PAD = 0x1C00, - VG_LITE_GRADIENT_SPREAD_REPEAT = 0x1C01, - VG_LITE_GRADIENT_SPREAD_REFLECT = 0x1C02, - } vg_lite_gradient_spreadmode_t; - - /* Decnano Compress mode. */ - typedef enum vg_lite_compress_mode - { - VG_LITE_DEC_DISABLE = 0, /*! disable compress */ - VG_LITE_DEC_NON_SAMPLE, /*! compress ratio is 1.6 if use ARGB8888, compress ratio is 2 if use XRGB8888 */ - VG_LITE_DEC_HSAMPLE, /*! compress ratio is 2 if use ARGB8888, compress ratio is 2.6 if use XRGB8888 */ - VG_LITE_DEC_HV_SAMPLE, /*! compress ratio is 2.6 if use ARGB8888, compress ratio is 4 if use XRGB8888 */ - } vg_lite_compress_mode_t; - - /* Draw path type. Match OpenVG enum VGPaintMode */ - typedef enum vg_lite_path_type - { - /* For enum value backward compatibility */ - VG_LITE_DRAW_ZERO = 0, - VG_LITE_DRAW_STROKE_PATH = (1<<0), - VG_LITE_DRAW_FILL_PATH = (1<<1), - VG_LITE_DRAW_FILL_STROKE_PATH = (1<<1 | 1<<0), - } vg_lite_path_type_t; - - /* End cap style. Match OpenVG enum VGCapStyle */ - typedef enum vg_lite_cap_style - { - VG_LITE_CAP_BUTT = 0x1700, - VG_LITE_CAP_ROUND = 0x1701, - VG_LITE_CAP_SQUARE = 0x1702, - } vg_lite_cap_style_t; - - /* Line join styles. Match OpenVG enum VGJoinStyle */ - typedef enum vg_lite_join_style - { - VG_LITE_JOIN_MITER = 0x1800, - VG_LITE_JOIN_ROUND = 0x1801, - VG_LITE_JOIN_BEVEL = 0x1802, - } vg_lite_join_style_t; - - /* Mask operation mode. Match OpenVG enum VGMaskOperation */ - typedef enum vg_lite_mask_operation - { - VG_LITE_CLEAR_MASK = 0x1500, /*! Set all dest mask values to 0 */ - VG_LITE_FILL_MASK = 0x1501, /*! Set all dest mask values to 1 */ - VG_LITE_SET_MASK = 0x1502, /*! Copy from src masklayer to dest masklayer. */ - VG_LITE_UNION_MASK = 0x1503, /*! Replace dest masklayer by its union with src masklayer. */ - VG_LITE_INTERSECT_MASK = 0x1504, /*! Replace dest masklayer by its intersection with src masklayer. */ - VG_LITE_SUBTRACT_MASK = 0x1505, /*! Subtract src mask in dest masklayer */ - } vg_lite_mask_operation_t; - - /* Mirror orientation mode. */ - typedef enum vg_lite_orientation - { - VG_LITE_ORIENTATION_TOP_BOTTOM, - VG_LITE_ORIENTATION_BOTTOM_TOP, - } vg_lite_orientation_t; - - /* Gamma conversion mode. */ - typedef enum vg_lite_gamma_conversion - { - VG_LITE_GAMMA_NO_CONVERSION, /*! Leave color as is. */ - VG_LITE_GAMMA_LINEAR, /*! Convert from sRGB to linear space. */ - VG_LITE_GAMMA_NON_LINEAR /*! Convert from linear to sRGB space. */ - } vg_lite_gamma_conversion_t; - - /* Index endian */ - typedef enum vg_lite_index_endian - { - VG_LITE_INDEX_LITTLE_ENDIAN, /*! Parse the index pixel from low to high, - *! when using index1, the parsing order is bit0~bit7. - *! when using index2, the parsing order is bit0:1,bit2:3,bit4:5.bit6:7. - *! when using index4, the parsing order is bit0:3,bit4:7. - */ - VG_LITE_INDEX_BIG_ENDIAN, /*! Parse the index pixel from low to high, - *! when using index1, the parsing order is bit7~bit0. - *! when using index2, the parsing order is bit7:6,bit5:4,bit3:2.bit1:0. - *! when using index4, the parsing order is bit4:7,bit0:3. - */ - } vg_lite_index_endian_t; - - /* Map flag*/ - typedef enum vg_lite_map_flag - { - VG_LITE_MAP_USER_MEMORY = 0, - VG_LITE_MAP_DMABUF = 0x01, - } vg_lite_map_flag_t; - - /*VGLite parameters variable*/ - typedef enum vg_lite_param_type - { - VG_LITE_SCISSOR_RECT, /*! count must be 4n for x, y, right, bottom */ - VG_LITE_GPU_IDLE_STATE, /*! 0: busy, 1: idle */ - } vg_lite_param_type_t; - -/* VGLite API Structures ******************************************************************************************************************/ - - /* VGLite driver information */ - typedef struct vg_lite_info { - vg_lite_uint32_t api_version; - vg_lite_uint32_t header_version; - vg_lite_uint32_t release_version; - vg_lite_uint32_t reserved; - } vg_lite_info_t; - - /* A 2D Point definition. */ - typedef struct vg_lite_point { - vg_lite_int32_t x; - vg_lite_int32_t y; - } vg_lite_point_t; - - /* Four 2D Point that form a polygon */ - typedef vg_lite_point_t vg_lite_point4_t[4]; - - /* A rectangle.*/ - typedef struct vg_lite_rectangle { - vg_lite_int32_t x; /*! Left coordinate of rectangle. */ - vg_lite_int32_t y; /*! Top coordinate of rectangle. */ - vg_lite_int32_t width; /*! Width of rectangle. */ - vg_lite_int32_t height; /*! Height of rectangle. */ - } vg_lite_rectangle_t; - - typedef struct vg_lite_matrix { - vg_lite_float_t m[3][3]; /*! The 3x3 matrix is in [row][column] order. */ - vg_lite_float_t scaleX; - vg_lite_float_t scaleY; - vg_lite_float_t angle; - } vg_lite_matrix_t; - - typedef struct vg_lite_yuvinfo - { - vg_lite_swizzle_t swizzle; /*! UV swizzle. */ - vg_lite_yuv2rgb_t yuv2rgb; /*! 601 or 709 conversion standard. */ - vg_lite_uint32_t uv_planar; /*! UV(U) planar address. */ - vg_lite_uint32_t v_planar; /*! V planar address. */ - vg_lite_uint32_t alpha_planar; /*! Alpha planar address. */ - vg_lite_uint32_t uv_stride; /*! UV(U) stride. */ - vg_lite_uint32_t v_stride; /*! V stride. */ - vg_lite_uint32_t alpha_stride; /*! Alpha stride. */ - vg_lite_uint32_t uv_height; /*! UV(U) height. */ - vg_lite_uint32_t v_height; /*! V height. */ - vg_lite_pointer uv_memory; /*! The logical pointer to the UV(U) planar memory. */ - vg_lite_pointer v_memory; /*! The logical pointer to the V planar memory. */ - vg_lite_pointer uv_handle; /*! The memory handle of the UV(U) planar. */ - vg_lite_pointer v_handle; /*! The memory handle of the V planar. */ - } vg_lite_yuvinfo_t; - - typedef struct vg_lite_path_point* vg_lite_path_point_ptr; - typedef struct vg_lite_path_point - { - /* X coordinate. */ - vg_lite_float_t x; - - /* Y coordinate. */ - vg_lite_float_t y; - - /* Flatten flag for flattened path. */ - vg_lite_uint8_t flatten_flag; - - /* Curve type for stroke path. */ - vg_lite_uint8_t curve_type; - - /* X tangent. */ - vg_lite_float_t tangentX; - - /* Y tangent. */ - vg_lite_float_t tangentY; - - /* Length of the line. */ - vg_lite_float_t length; - - /* Pointer to next point node. */ - vg_lite_path_point_ptr next; - - /* Pointer to previous point node. */ - vg_lite_path_point_ptr prev; - - } vg_lite_path_point_t; - - typedef struct vg_lite_sub_path* vg_lite_sub_path_ptr; - typedef struct vg_lite_sub_path - { - /* Pointer to next sub path. */ - vg_lite_sub_path_ptr next; - - /* Number of points. */ - vg_lite_uint32_t point_count; - - /* Point list. */ - vg_lite_path_point_ptr point_list; - - /* Last point. */ - vg_lite_path_point_ptr end_point; - - /* Whether is path is closed. */ - vg_lite_uint8_t closed; - - /* Sub path length. */ - vg_lite_float_t length; - - } vg_lite_sub_path_t; - - /* Save divided path data according to MOVE/MOVE_REL. */ - typedef struct vg_lite_path_list* vg_lite_path_list_ptr; - typedef struct vg_lite_path_list - { - vg_lite_path_point_ptr path_points; - vg_lite_path_point_ptr path_end; - vg_lite_uint32_t point_count; - vg_lite_path_list_ptr next; - vg_lite_uint8_t closed; - - } vg_lite_path_list_t; - - typedef struct vg_lite_stroke - { - /* Stroke parameters */ - vg_lite_cap_style_t cap_style; - vg_lite_join_style_t join_style; - vg_lite_float_t line_width; - vg_lite_float_t miter_limit; - vg_lite_float_t *dash_pattern; - vg_lite_uint32_t pattern_count; - vg_lite_float_t dash_phase; - vg_lite_float_t dash_length; - vg_lite_uint32_t dash_index; - vg_lite_float_t half_width; - - /* Total length of stroke dash patterns. */ - vg_lite_float_t pattern_length; - - /* For fast checking. */ - vg_lite_float_t miter_square; - - /* Temp storage of stroke subPath. */ - vg_lite_path_point_ptr path_points; - vg_lite_path_point_ptr path_end; - vg_lite_uint32_t point_count; - vg_lite_path_point_ptr left_point; - vg_lite_path_point_ptr right_point; - vg_lite_path_point_ptr stroke_points; - vg_lite_path_point_ptr stroke_end; - vg_lite_uint32_t stroke_count; - - /* Divide stroke path according to move or move_rel for avoiding implicit closure. */ - vg_lite_path_list_ptr path_list_divide; - - /* pointer to current divided path data. */ - vg_lite_path_list_ptr cur_list; - - /* Flag that add end_path in driver. */ - vg_lite_uint8_t add_end; - vg_lite_uint8_t dash_reset; - - /* Sub path list. */ - vg_lite_sub_path_ptr stroke_paths; - - /* Last sub path. */ - vg_lite_sub_path_ptr last_stroke; - - /* Swing area handling. */ - vg_lite_uint32_t swing_handling; - vg_lite_float_t swing_deltax; - vg_lite_float_t swing_deltay; - vg_lite_path_point_ptr swing_start; - vg_lite_path_point_ptr swing_stroke; - vg_lite_float_t swing_length; - vg_lite_float_t swing_centlen; - vg_lite_uint32_t swing_count; - vg_lite_uint8_t need_swing; - vg_lite_uint8_t swing_ccw; - - vg_lite_float_t stroke_length; - vg_lite_uint32_t stroke_size; - - /* The stroke line is fat line. */ - vg_lite_uint8_t fattened; - vg_lite_uint8_t closed; - - } vg_lite_stroke_t; - - /* Fast clear buffer. */ - typedef struct vg_lite_fc_buffer - { - vg_lite_int32_t width; /*! Width of the buffer in pixels. */ - vg_lite_int32_t height; /*! height of the buffer in pixels. */ - vg_lite_int32_t stride; /*! The number of bytes to move from one line in the buffer to the next line. */ - vg_lite_pointer handle; /*! The memory handle of the buffer's memory as allocated by the VGLite kernel. */ - vg_lite_pointer memory; /*! The logical pointer to the buffer's memory for the CPU. */ - vg_lite_uint32_t address; /*! The address to the buffer's memory for the hardware. */ - vg_lite_uint32_t color; /*! The fastclear color value. */ - } vg_lite_fc_buffer_t; - - /* Structure for any image or render target. */ - typedef struct vg_lite_buffer - { - vg_lite_int32_t width; /*! Width of the buffer in pixels. */ - vg_lite_int32_t height; /*! Height of the buffer in pixels. */ - vg_lite_int32_t stride; /*! The number of bytes to move from one line in the buffer to the next line. */ - vg_lite_buffer_layout_t tiled; /*! Indicating the buffer memory layout is linear or tiled. */ - vg_lite_buffer_format_t format; /*! The pixel format of the buffer. */ - vg_lite_pointer handle; /*! The memory handle of the buffer's memory as allocated by the VGLite kernel. */ - vg_lite_pointer memory; /*! The logical pointer to the buffer's memory for the CPU. */ - vg_lite_uint32_t address; /*! The address to the buffer's memory for the hardware. */ - vg_lite_yuvinfo_t yuv; /*! The yuv format details. */ - vg_lite_image_mode_t image_mode; /*! The blit image mode. */ - vg_lite_transparency_t transparency_mode; /*! image transparency mode. */ - vg_lite_fc_buffer_t fc_buffer[3]; /*! 3 fastclear buffers,reserved YUV format. */ - vg_lite_compress_mode_t compress_mode; /*! Refer to the definition by vg_lite_compress_mode_t. */ - vg_lite_index_endian_t index_endian; /*! Refer to the definition by vg_lite_index_endian_t. */ - vg_lite_paint_type_t paintType; /*! Get paintcolor from different paint types. */ - vg_lite_uint8_t fc_enable; /*! enable im fastclear. */ - vg_lite_uint8_t scissor_layer; /*! The buffer is scissor buffer. */ - vg_lite_uint8_t premultiplied; /*! The RGB pixel values are alpha-premultiplied */ - } vg_lite_buffer_t; - - /* Memory allocation info by kernel. */ - typedef struct vg_lite_hw_memory - { - vg_lite_pointer handle; /*! gpu memory object handle. */ - vg_lite_pointer memory; /*! logical memory address. */ - vg_lite_uint32_t address; /*! GPU memory address. */ - vg_lite_uint32_t bytes; /*! Size of memory. */ - vg_lite_uint32_t property; /*! Currently bit0 is used for path upload state: - *! 1 : enable auto path data uploading. - *! 0 : disable path data uploading. path data is embedded in command buffer. */ - } vg_lite_hw_memory_t; - - /* Path info for drawing command. */ - typedef struct vg_lite_path - { - vg_lite_float_t bounding_box[4]; /*! Bounding box specified as left, top, right, and bottom. */ - vg_lite_quality_t quality; /*! Quality hint for the path. */ - vg_lite_format_t format; /*! Coordinate format. */ - vg_lite_hw_memory_t uploaded; /*! Path data that has been upload into GPU addressable memory. */ - vg_lite_uint32_t path_length; /*! Number of bytes in the path data. */ - vg_lite_pointer path; /*! Pointer to the physical description of the path. */ - vg_lite_int8_t path_changed; /*! Indicate whether path data is synced with command buffer (uploaded) or not. */ - vg_lite_int8_t pdata_internal; /*! Indicate whether path data memory is allocated by driver. */ - vg_lite_path_type_t path_type; /*! Refer to the definition by vg_lite_path_type_t. */ - vg_lite_stroke_t *stroke; /*! Pointer to a vg_lite_stroke_t structure.*/ - vg_lite_pointer stroke_path; /*! Pointer to the physical description of the stroke path. */ - vg_lite_uint32_t stroke_size; /*! Number of bytes in the stroke path data. */ - vg_lite_color_t stroke_color; /*! The stroke path fill color. */ - vg_lite_int8_t add_end; /*! Flag that add end_path in driver. */ - } vg_lite_path_t; - - /* Color ramp definition. */ - typedef struct vg_lite_color_ramp - { - vg_lite_float_t stop; /*! Value for the color stop. */ - vg_lite_float_t red; /*! Red color channel value for the color stop. */ - vg_lite_float_t green; /*! Green color channel value for the color stop. */ - vg_lite_float_t blue; /*! Blue color channel value for the color stop. */ - vg_lite_float_t alpha; /*! Alpha color channel value for the color stop. */ - } vg_lite_color_ramp_t; - - /* Linear gradient parameter */ - typedef struct vg_lite_linear_gradient_parameter - { - vg_lite_float_t X0; - vg_lite_float_t Y0; - vg_lite_float_t X1; - vg_lite_float_t Y1; - } vg_lite_linear_gradient_parameter_t; - - typedef struct vg_lite_radial_gradient_parameter - { - vg_lite_float_t cx; /*! x coordinate of the center point. */ - vg_lite_float_t cy; /*! y coordinate of the center point. */ - vg_lite_float_t r; /*! radius. */ - vg_lite_float_t fx; /*! x coordinate of the focal point. */ - vg_lite_float_t fy; /*! y coordinate of the focal point. */ - } vg_lite_radial_gradient_parameter_t; - - /* Linear gradient definition. */ - typedef struct vg_lite_linear_gradient { - vg_lite_uint32_t colors[VLC_MAX_GRADIENT_STOPS]; /*! Colors for stops. */ - vg_lite_uint32_t count; /*! Count of colors, up to 16. */ - vg_lite_uint32_t stops[VLC_MAX_GRADIENT_STOPS]; /*! Color stops, value from 0 to 255. */ - vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ - vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ - } vg_lite_linear_gradient_t; - - /* Extended linear gradient definition. */ - typedef struct vg_lite_ext_linear_gradient { - vg_lite_uint32_t count; /*! Count of colors, up to 256. */ - vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ - vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ - vg_lite_linear_gradient_parameter_t linear_grad; /*! Include center point,focal point and radius.*/ - - vg_lite_uint32_t ramp_length; /*! Color ramp for gradient paints provided to driver. */ - vg_lite_color_ramp_t color_ramp[VLC_MAX_COLOR_RAMP_STOPS]; - - vg_lite_uint32_t converted_length; /*! Converted internal color ramp. */ - vg_lite_color_ramp_t converted_ramp[VLC_MAX_COLOR_RAMP_STOPS + 2]; - - vg_lite_uint8_t pre_multiplied; /*! If color values of color_ramp[] are multiply by alpha value of color_ramp[]. */ - vg_lite_gradient_spreadmode_t spread_mode; /*! The spread mode that applied to the pixels out of the image after transformed. */ - } vg_lite_ext_linear_gradient_t; - - /* Radial gradient definition. */ - typedef struct vg_lite_radial_gradient - { - vg_lite_uint32_t count; /*! Count of colors, up to 256. */ - vg_lite_matrix_t matrix; /*! The matrix to transform the gradient. */ - vg_lite_buffer_t image; /*! The image for rendering as gradient pattern. */ - vg_lite_radial_gradient_parameter_t radial_grad; /*! Include center point,focal point and radius.*/ - - vg_lite_uint32_t ramp_length; /*! Color ramp for gradient paints provided to the driver. */ - vg_lite_color_ramp_t color_ramp[VLC_MAX_COLOR_RAMP_STOPS]; - - vg_lite_uint32_t converted_length; /*! Converted internal color ramp. */ - vg_lite_color_ramp_t converted_ramp[VLC_MAX_COLOR_RAMP_STOPS + 2]; - - vg_lite_uint8_t pre_multiplied; /*! If color values of color_ramp[] are multiply by alpha value of color_ramp[]. */ - vg_lite_gradient_spreadmode_t spread_mode; /*! The spread mode that applied to the pixels out of the image after transformed. */ - } vg_lite_radial_gradient_t; - - /* Colorkey definition */ - typedef struct vg_lite_color_key - { - vg_lite_uint8_t enable; /*! The color key is effective only when "enable" is true, */ - vg_lite_uint8_t low_r; /*! The R channel of low_rgb. */ - vg_lite_uint8_t low_g; /*! The G channel of low_rgb. */ - vg_lite_uint8_t low_b; /*! The B channel of low_rgb. */ - vg_lite_uint8_t alpha; /*! The alpha channel to replace destination pixel alpha channel.*/ - vg_lite_uint8_t high_r; /*! The R channel of high_rgb. */ - vg_lite_uint8_t high_g; /*! The G channel of high_rgb. */ - vg_lite_uint8_t high_b; /*! The B channel of high_rgb. */ - } vg_lite_color_key_t; - - /* Four colorkey definition. - * rgb_hi_0, rgb_lo_0, alpha_0, enable_0; - * rgb_hi_1, rgb_lo_1, alpha_1, enable_1; - * rgb_hi_2, rgb_lo_2, alpha_2, enable_2; - * rgb_hi_3, rgb_lo_3, alpha_3, enable_3; - * Priority order: color_key_0 > color_key_1 > color_key_2 > color_key_3. - */ - typedef vg_lite_color_key_t vg_lite_color_key4_t[4]; - - /* Pixel matrix values */ - typedef vg_lite_float_t vg_lite_pixel_matrix_t[20]; - - /* HW pixel channel enable flags */ - typedef struct vg_lite_pixel_channel_enable - { - vg_lite_uint8_t enable_a; /*! Enable A channel.*/ - vg_lite_uint8_t enable_b; /*! Enable B channel. */ - vg_lite_uint8_t enable_g; /*! Enable G channel. */ - vg_lite_uint8_t enable_r; /*! Enable R channel. */ - } vg_lite_pixel_channel_enable_t; - - /* Pixel color transform */ - typedef struct vg_lite_color_transform - { - vg_lite_float_t a_scale; - vg_lite_float_t a_bias; - vg_lite_float_t r_scale; - vg_lite_float_t r_bias; - vg_lite_float_t g_scale; - vg_lite_float_t g_bias; - vg_lite_float_t b_scale; - vg_lite_float_t b_bias; - } vg_lite_color_transform_t; - -/* VGLite API Functions *******************************************************************************************************************/ - - /* Initialize a vglite context. */ - vg_lite_error_t vg_lite_init(vg_lite_int32_t tess_width, vg_lite_int32_t tess_height); - - /* Destroy a vglite context. */ - vg_lite_error_t vg_lite_close(void); - - /* Get the VGLite driver information. */ - vg_lite_error_t vg_lite_get_info(vg_lite_info_t* info); - - /* Get the GPU chip information. */ - vg_lite_uint32_t vg_lite_get_product_info(vg_lite_char *name, vg_lite_uint32_t *chip_id, vg_lite_uint32_t *chip_rev); - - /* Query if a specific feature is supported. */ - vg_lite_uint32_t vg_lite_query_feature(vg_lite_feature_t feature); - - /* Flush command buffer and wait for GPU to complete. */ - vg_lite_error_t vg_lite_finish(void); - - /* Flush the command buffer without waiting for GPU to complete. */ - vg_lite_error_t vg_lite_flush(void); - - /* Get the value of register from register's address. */ - vg_lite_error_t vg_lite_get_register(vg_lite_uint32_t address, vg_lite_uint32_t* result); - - /* Generate a 3x3 homogeneous matrix to transform 4 source coordinates to 4 target coordinates. */ - vg_lite_error_t vg_lite_get_transform_matrix(vg_lite_point4_t src, vg_lite_point4_t dst, vg_lite_matrix_t *mat); - - /* Allocate a buffer from GPU hardware accessible memory. */ - vg_lite_error_t vg_lite_allocate(vg_lite_buffer_t *buffer); - - /* Free a buffer allocated by vg_lite_allocate() */ - vg_lite_error_t vg_lite_free(vg_lite_buffer_t *buffer); - - /* Upload RGB or YUV pixel data to an allocated buffer. */ - vg_lite_error_t vg_lite_upload_buffer(vg_lite_buffer_t *buffer, vg_lite_uint8_t *data[3], vg_lite_uint32_t stride[3]); - - /* Map a buffer into hardware accessible address space. */ - vg_lite_error_t vg_lite_map(vg_lite_buffer_t *buffer, vg_lite_map_flag_t flag, int32_t fd); - - /* Unmap a buffer that is mapped */ - vg_lite_error_t vg_lite_unmap(vg_lite_buffer_t *buffer); - - /* flush cache */ - vg_lite_error_t vg_lite_flush_mapped_buffer(vg_lite_buffer_t * buffer); - - /* Fill a buffer rectangle area with a specified color. */ - vg_lite_error_t vg_lite_clear(vg_lite_buffer_t *target, vg_lite_rectangle_t *rect, vg_lite_color_t color); - - /* Copy a source image to target buffer with transformation, blending, color mixing, and filtering. */ - vg_lite_error_t vg_lite_blit(vg_lite_buffer_t *target, - vg_lite_buffer_t *source, - vg_lite_matrix_t *matrix, - vg_lite_blend_t blend, - vg_lite_color_t color, - vg_lite_filter_t filter); - - /* Copy a rectangle area of source image to target buffer with transformation, blending, color mixing, and filtering. */ - vg_lite_error_t vg_lite_blit_rect(vg_lite_buffer_t *target, - vg_lite_buffer_t *source, - vg_lite_rectangle_t *rect, - vg_lite_matrix_t *matrix, - vg_lite_blend_t blend, - vg_lite_color_t color, - vg_lite_filter_t filter); - - /* Copy two source images to the target buffer with transformation, blending, and filtering. */ - vg_lite_error_t vg_lite_blit2(vg_lite_buffer_t *target, - vg_lite_buffer_t *source0, - vg_lite_buffer_t *source1, - vg_lite_matrix_t *matrix0, - vg_lite_matrix_t *matrix1, - vg_lite_blend_t blend, - vg_lite_filter_t filter); - - /* Copy a rectangle area of source image to target buffer without transformation, blending, color mixing, and filtering. */ - vg_lite_error_t vg_lite_copy_image(vg_lite_buffer_t *target, - vg_lite_buffer_t *source, - vg_lite_int32_t sx, - vg_lite_int32_t sy, - vg_lite_int32_t dx, - vg_lite_int32_t dy, - vg_lite_int32_t width, - vg_lite_int32_t height); - - /* Draw a path to a target buffer with transformation, color, and blending */ - vg_lite_error_t vg_lite_draw(vg_lite_buffer_t *target, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_matrix_t *matrix, - vg_lite_blend_t blend, - vg_lite_color_t color); - - /* Set stroke path attributes. */ - vg_lite_error_t vg_lite_set_stroke(vg_lite_path_t *path, - vg_lite_cap_style_t cap_style, - vg_lite_join_style_t join_style, - vg_lite_float_t line_width, - vg_lite_float_t miter_limit, - vg_lite_float_t *dash_pattern, - vg_lite_uint32_t pattern_count, - vg_lite_float_t dash_phase, - vg_lite_color_t color); - - /* Update stroke path. */ - vg_lite_error_t vg_lite_update_stroke(vg_lite_path_t *path); - - /* Set path type. */ - vg_lite_error_t vg_lite_set_path_type(vg_lite_path_t *path, vg_lite_path_type_t path_type); - - /* Clears all attributes of a path. */ - vg_lite_error_t vg_lite_clear_path(vg_lite_path_t *path); - - /* Upload a path to GPU memory so GPU can access it directly. */ - vg_lite_error_t vg_lite_upload_path(vg_lite_path_t *path); - - /* Initialize a path object with attributes. */ - vg_lite_error_t vg_lite_init_path(vg_lite_path_t *path, - vg_lite_format_t format, - vg_lite_quality_t quality, - vg_lite_uint32_t length, - vg_lite_pointer data, - vg_lite_float_t min_x, - vg_lite_float_t min_y, - vg_lite_float_t max_x, - vg_lite_float_t max_y); - - /* Initializes a arc path with attributes. */ - vg_lite_error_t vg_lite_init_arc_path(vg_lite_path_t *path, - vg_lite_format_t format, - vg_lite_quality_t quality, - vg_lite_uint32_t length, - vg_lite_pointer data, - vg_lite_float_t min_x, - vg_lite_float_t min_y, - vg_lite_float_t max_x, - vg_lite_float_t max_y); - - /* Return the size (in bytes) of command buffer for a path opcode array. */ - vg_lite_uint32_t vg_lite_get_path_length(vg_lite_uint8_t *opcode, - vg_lite_uint32_t count, - vg_lite_format_t format); - - /* Generate command buffer for the (path) based on input opcodes (opcode) and coordinates (data). */ - vg_lite_error_t vg_lite_append_path(vg_lite_path_t *path, - vg_lite_uint8_t *opcode, - vg_lite_pointer data, - vg_lite_uint32_t seg_count); - - /* Set CLUT (Color Look Up Table) for index image. The (colors) is in ARGB format. */ - vg_lite_error_t vg_lite_set_CLUT(vg_lite_uint32_t count, vg_lite_uint32_t *colors); - - /* Draw a path that is filled by a transformed image pattern. */ - vg_lite_error_t vg_lite_draw_pattern(vg_lite_buffer_t *target, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_matrix_t *path_matrix, - vg_lite_buffer_t *pattern_image, - vg_lite_matrix_t *pattern_matrix, - vg_lite_blend_t blend, - vg_lite_pattern_mode_t pattern_mode, - vg_lite_color_t pattern_color, - vg_lite_color_t color, - vg_lite_filter_t filter); - - /* Initialize a linear gradient object with default attributes. */ - vg_lite_error_t vg_lite_init_grad(vg_lite_linear_gradient_t *grad); - - /* Reset a linear gradient object attributes. */ - vg_lite_error_t vg_lite_clear_grad(vg_lite_linear_gradient_t *grad); - - /* Update a linear gradient object. */ - vg_lite_error_t vg_lite_update_grad(vg_lite_linear_gradient_t *grad); - - /* Return pointer to a linear gradient object's matrix. */ - vg_lite_matrix_t* vg_lite_get_grad_matrix(vg_lite_linear_gradient_t *grad); - - /* Set attributes for a linear gradient object. */ - vg_lite_error_t vg_lite_set_grad(vg_lite_linear_gradient_t *grad, - vg_lite_uint32_t count, - vg_lite_uint32_t *colors, - vg_lite_uint32_t *stops); - - /* Draw a path with a linear gradient object pattern. */ - vg_lite_error_t vg_lite_draw_grad(vg_lite_buffer_t *target, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_matrix_t *matrix, - vg_lite_linear_gradient_t *grad, - vg_lite_blend_t blend); - - /* Reset an extended linear gradient object attributes and free image buffer. */ - vg_lite_error_t vg_lite_clear_linear_grad(vg_lite_ext_linear_gradient_t *grad); - - /* Update an extended linear gradient object. */ - vg_lite_error_t vg_lite_update_linear_grad(vg_lite_ext_linear_gradient_t *grad); - - /* Return pointer to an extended linear gradient object's matrix. */ - vg_lite_matrix_t* vg_lite_get_linear_grad_matrix(vg_lite_ext_linear_gradient_t *grad); - - /* Set attributes for an extended linear gradient object. */ - vg_lite_error_t vg_lite_set_linear_grad(vg_lite_ext_linear_gradient_t *grad, - vg_lite_uint32_t count, - vg_lite_color_ramp_t *color_ramp, - vg_lite_linear_gradient_parameter_t grad_param, - vg_lite_gradient_spreadmode_t spread_mode, - vg_lite_uint8_t pre_mult); - - /* Draw a path with an extended linear gradient object. */ - vg_lite_error_t vg_lite_draw_linear_grad(vg_lite_buffer_t *target, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_matrix_t *path_matrix, - vg_lite_ext_linear_gradient_t *grad, - vg_lite_color_t paint_color, - vg_lite_blend_t blend, - vg_lite_filter_t filter); - - /* Reset a radial gradient object attributes and free image buffer. */ - vg_lite_error_t vg_lite_clear_radial_grad(vg_lite_radial_gradient_t *grad); - - /* Update a radial gradient object. */ - vg_lite_error_t vg_lite_update_radial_grad(vg_lite_radial_gradient_t *grad); - - /* Return pointer to a radial gradient object's matrix. */ - vg_lite_matrix_t* vg_lite_get_radial_grad_matrix(vg_lite_radial_gradient_t *grad); - - /* Set attributes for a radial gradient object. */ - vg_lite_error_t vg_lite_set_radial_grad(vg_lite_radial_gradient_t *grad, - vg_lite_uint32_t count, - vg_lite_color_ramp_t *color_ramp, - vg_lite_radial_gradient_parameter_t grad_param, - vg_lite_gradient_spreadmode_t spread_mode, - vg_lite_uint8_t pre_mult); - - /* Draw a path with a radial gradient object pattern. */ - vg_lite_error_t vg_lite_draw_radial_grad(vg_lite_buffer_t *target, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_matrix_t *path_matrix, - vg_lite_radial_gradient_t *grad, - vg_lite_color_t paint_color, - vg_lite_blend_t blend, - vg_lite_filter_t filter); - - /* Load an identity matrix. */ - vg_lite_error_t vg_lite_identity(vg_lite_matrix_t *matrix); - - /* Translate a matrix. */ - vg_lite_error_t vg_lite_translate(vg_lite_float_t x, vg_lite_float_t y, vg_lite_matrix_t *matrix); - - /* Scale a matrix. */ - vg_lite_error_t vg_lite_scale(vg_lite_float_t scale_x, vg_lite_float_t scale_y, vg_lite_matrix_t *matrix); - - /* Rotate a matrix. */ - vg_lite_error_t vg_lite_rotate(vg_lite_float_t degrees, vg_lite_matrix_t *matrix); - - /* Set and enable a scissor rectangle for render target. */ - vg_lite_error_t vg_lite_set_scissor(vg_lite_int32_t x, vg_lite_int32_t y, vg_lite_int32_t right, vg_lite_int32_t bottom); - - /* Set scissor rectangles on mask layer. Scissor rects are enabled/disabled by following APIs. */ - vg_lite_error_t vg_lite_scissor_rects(vg_lite_uint32_t nums, vg_lite_rectangle_t rect[]); - - /* Enable scissor rects defined on mask layer. */ - vg_lite_error_t vg_lite_enable_scissor(void); - - /* Disable scissor rects defined on mask layer. */ - vg_lite_error_t vg_lite_disable_scissor(void); - - /* Query size of available contiguous video memory. */ - vg_lite_error_t vg_lite_get_mem_size(vg_lite_uint32_t *size); - - /* Set global alpha value for source image */ - vg_lite_error_t vg_lite_source_global_alpha(vg_lite_global_alpha_t alpha_mode, vg_lite_uint8_t alpha_value); - - /* Set global alpha value for destination image. */ - vg_lite_error_t vg_lite_dest_global_alpha(vg_lite_global_alpha_t alpha_mode, vg_lite_uint8_t alpha_value); - - /* Set colorkey. */ - vg_lite_error_t vg_lite_set_color_key(vg_lite_color_key4_t colorkey); - - /* Enable dither function. Dither is OFF by default. */ - vg_lite_error_t vg_lite_enable_dither(void); - - /* Disable dither function. Dither is OFF by default. */ - vg_lite_error_t vg_lite_disable_dither(void); - - /* Set a 64-byte aligned memory buffer (physical) as VGLite tessellation buffer. */ - vg_lite_error_t vg_lite_set_tess_buffer(vg_lite_uint32_t physical, vg_lite_uint32_t size); - - /* Can be called before vg_lite_init() to overwrite the default VG_LITE_COMMAND_BUFFER_SIZE */ - vg_lite_error_t vg_lite_set_command_buffer_size(vg_lite_uint32_t size); - - /* Set a user-defined external memory buffer (physical, 64-byte aligned) as VGLite command buffer. */ - vg_lite_error_t vg_lite_set_command_buffer(vg_lite_uint32_t physical, vg_lite_uint32_t size); - - /* Setup a pixel transform matrix m[20] which transforms each pixel as following: - * - * |a'| |m0 m1 m2 m3 m4 | |a| - * |r'| |m5 m6 m7 m8 m9 | |r| - * |g'| = |m10 m11 m12 m13 m14|.|g| - * |b'| |m15 m16 m17 m18 m19| |b| - * |1 | |0 0 0 0 1 | |1| - * - * The pixel transform for A, R, G, B channel can be enabled/disabled individually with (channel) parameter. - */ - vg_lite_error_t vg_lite_set_pixel_matrix(vg_lite_pixel_matrix_t matrix, vg_lite_pixel_channel_enable_t *channel); - - /* Setup 3x3 gaussian blur weight values to filter image pixels. - * - * Parameters w0, w1, w2 define a 3x3 gaussian blur weight matrix as below - * - * | w2 w1 w2 | - * | w1 w0 w1 | - * | w2 w1 w2 | - * - * The sum of 9 kernel weights must be 1.0 to avoid convolution overflow ( w0 + 4*w1 + 4*w2 = 1.0 ). - * The 3x3 weight matrix applies to a 3x3 pixel block - * - * | pixel[i-1][j-1] pixel[i][j-1] pixel[i+1][j-1]| - * | pixel[i-1][j] pixel[i][j] pixel[i+1][j] | - * | pixel[i-1][j+1] pixel[i][j+1] pixel[i+1][j+1]| - * - * With the following dot product equation: - * - * color[i][j] = w2*pixel[i-1][j-1] + w1*pixel[i][j-1] + w2*pixel[i+1][j-1] - * + w1*pixel[i-1][j] + w0*pixel[i][j] + w1*pixel[i+1][j] - * + w2*pixel[i-1][j+1] + w1*pixel[i][j+1] + w2*pixel[i+1][j+1]; - */ - vg_lite_error_t vg_lite_gaussian_filter(vg_lite_float_t w0, vg_lite_float_t w1, vg_lite_float_t w2); - - /* Enable masklayer function. Masklayer is OFF by default. */ - vg_lite_error_t vg_lite_enable_masklayer(void); - - /* Disable masklayer function. Masklayer is OFF by default. */ - vg_lite_error_t vg_lite_disable_masklayer(void); - - /* Setup a masklayer. */ - vg_lite_error_t vg_lite_set_masklayer(vg_lite_buffer_t *masklayer); - - /* Free a masklayer and disable mask operation. */ - vg_lite_error_t vg_lite_destroy_masklayer(vg_lite_buffer_t *masklayer); - - /* Create a masklayer with default format A8 and default pixel value 255. */ - vg_lite_error_t vg_lite_create_masklayer(vg_lite_buffer_t *masklayer, - vg_lite_uint32_t width, - vg_lite_uint32_t height); - - /* Set pixel values for a rectangle area in a masklayer */ - vg_lite_error_t vg_lite_fill_masklayer(vg_lite_buffer_t *masklayer, - vg_lite_rectangle_t *rect, - vg_lite_uint8_t value); - - /* Blend a rectangle area of src masklayer with dst masklayer according to (operation). */ - vg_lite_error_t vg_lite_blend_masklayer(vg_lite_buffer_t *dst, - vg_lite_buffer_t *src, - vg_lite_mask_operation_t operation, - vg_lite_rectangle_t *rect); - - /* Render a (path) with (fill_rule), (color), (matrix) to the masklayer. */ - vg_lite_error_t vg_lite_render_masklayer(vg_lite_buffer_t *masklayer, - vg_lite_mask_operation_t operation, - vg_lite_path_t *path, - vg_lite_fill_t fill_rule, - vg_lite_color_t color, - vg_lite_matrix_t *matrix); - - /* Set mirror orientation. */ - vg_lite_error_t vg_lite_set_mirror(vg_lite_orientation_t orientation); - - /* Set gamma value. */ - vg_lite_error_t vg_lite_set_gamma(vg_lite_gamma_conversion_t gamma_value); - - /* Enable color transformation, which is OFF by default. */ - vg_lite_error_t vg_lite_enable_color_transform(void); - - /* Disable color transformation, which is OFF by default. */ - vg_lite_error_t vg_lite_disable_color_transform(void); - - /* Set pixel color transformation scale and bias values for each pixel channel. */ - vg_lite_error_t vg_lite_set_color_transform(vg_lite_color_transform_t *values); - - /* Set flexa stream id. */ - vg_lite_error_t vg_lite_flexa_set_stream(vg_lite_uint8_t stream_id); - - /* set flexa background buffer.*/ - vg_lite_error_t vg_lite_flexa_bg_buffer(vg_lite_uint8_t stream_id, - vg_lite_buffer_t *buffer, - vg_lite_uint32_t seg_count, - vg_lite_uint32_t seg_size); - - /* Enable flexa. */ - vg_lite_error_t vg_lite_flexa_enable(void); - - /* Disable flexa.*/ - vg_lite_error_t vg_lite_flexa_disable(void); - - /* Set flexa stop flag after the last frame. */ - vg_lite_error_t vg_lite_flexa_stop_frame(void); - - /* Dump command buffer */ - vg_lite_error_t vg_lite_dump_command_buffer(void); - - /* Return VGLite parameters in params[] array */ - vg_lite_error_t vg_lite_get_parameter(vg_lite_param_type_t type, - vg_lite_int32_t count, - vg_lite_float_t* params); - -#endif /* VGLITE_VERSION_3_0 */ - -#ifdef __cplusplus -} -#endif -#endif /* _vg_lite_h_ */ diff --git a/src/widgets/arc/lv_arc.c b/src/widgets/arc/lv_arc.c index 4a683ee4b8..44aaa4e4f4 100644 --- a/src/widgets/arc/lv_arc.c +++ b/src/widgets/arc/lv_arc.c @@ -18,7 +18,7 @@ #include "../../misc/lv_assert.h" #include "../../misc/lv_math.h" #include "../../draw/lv_draw_arc.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" /********************* * DEFINES diff --git a/src/widgets/arc/lv_arc.h b/src/widgets/arc/lv_arc.h index 1cae09cc34..50b740acd7 100644 --- a/src/widgets/arc/lv_arc.h +++ b/src/widgets/arc/lv_arc.h @@ -18,7 +18,7 @@ extern "C" { #if LV_USE_ARC != 0 #include "../../core/lv_obj.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" /********************* * DEFINES diff --git a/src/widgets/bar/lv_bar.c b/src/widgets/bar/lv_bar.c index 91012061af..242bef9f9e 100644 --- a/src/widgets/bar/lv_bar.c +++ b/src/widgets/bar/lv_bar.c @@ -14,7 +14,7 @@ #if LV_USE_BAR != 0 #include "../../draw/lv_draw.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #include "../../misc/lv_assert.h" #include "../../misc/lv_anim_private.h" #include "../../misc/lv_math.h" diff --git a/src/widgets/bar/lv_bar.h b/src/widgets/bar/lv_bar.h index 5d34e0a74e..ba7a2ef1df 100644 --- a/src/widgets/bar/lv_bar.h +++ b/src/widgets/bar/lv_bar.h @@ -20,7 +20,7 @@ extern "C" { #include "../../core/lv_obj.h" #include "../../misc/lv_anim.h" #include "../label/lv_label.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" /********************* * DEFINES diff --git a/src/widgets/dropdown/lv_dropdown.c b/src/widgets/dropdown/lv_dropdown.c index 27659aca42..38dc7657ae 100644 --- a/src/widgets/dropdown/lv_dropdown.c +++ b/src/widgets/dropdown/lv_dropdown.c @@ -22,7 +22,7 @@ #include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" #include "../../misc/lv_text_private.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #include "../../stdlib/lv_string.h" /********************* diff --git a/src/widgets/image/lv_image.c b/src/widgets/image/lv_image.c index 62b0d0125c..425549022c 100644 --- a/src/widgets/image/lv_image.c +++ b/src/widgets/image/lv_image.c @@ -15,7 +15,7 @@ #include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj_draw_private.h" #include "../../core/lv_obj_class_private.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #if LV_USE_IMAGE != 0 diff --git a/src/widgets/image/lv_image.h b/src/widgets/image/lv_image.h index 9ee3e37284..a057aba512 100644 --- a/src/widgets/image/lv_image.h +++ b/src/widgets/image/lv_image.h @@ -25,7 +25,7 @@ extern "C" { #include "../../core/lv_obj.h" #include "../../misc/lv_fs.h" #include "../../draw/lv_draw.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" /********************* * DEFINES diff --git a/src/others/ime/lv_ime_pinyin.c b/src/widgets/ime/lv_ime_pinyin.c similarity index 100% rename from src/others/ime/lv_ime_pinyin.c rename to src/widgets/ime/lv_ime_pinyin.c diff --git a/src/others/ime/lv_ime_pinyin.h b/src/widgets/ime/lv_ime_pinyin.h similarity index 100% rename from src/others/ime/lv_ime_pinyin.h rename to src/widgets/ime/lv_ime_pinyin.h diff --git a/src/others/ime/lv_ime_pinyin_private.h b/src/widgets/ime/lv_ime_pinyin_private.h similarity index 100% rename from src/others/ime/lv_ime_pinyin_private.h rename to src/widgets/ime/lv_ime_pinyin_private.h diff --git a/src/widgets/label/lv_label.c b/src/widgets/label/lv_label.c index bcb2670967..becd757e9d 100644 --- a/src/widgets/label/lv_label.c +++ b/src/widgets/label/lv_label.c @@ -24,7 +24,7 @@ #include "../../misc/lv_text_private.h" #include "../../stdlib/lv_sprintf.h" #include "../../stdlib/lv_string.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #include "../../others/translation/lv_translation.h" /********************* diff --git a/src/widgets/label/lv_label.h b/src/widgets/label/lv_label.h index 6d96d3b9bb..92f846ac73 100644 --- a/src/widgets/label/lv_label.h +++ b/src/widgets/label/lv_label.h @@ -23,7 +23,7 @@ extern "C" { #include "../../font/lv_symbol_def.h" #include "../../misc/lv_text.h" #include "../../draw/lv_draw.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" /********************* * DEFINES diff --git a/src/widgets/roller/lv_roller.c b/src/widgets/roller/lv_roller.c index df3cbc9f93..a6caa9f820 100644 --- a/src/widgets/roller/lv_roller.c +++ b/src/widgets/roller/lv_roller.c @@ -22,7 +22,7 @@ #include "../../indev/lv_indev_scroll.h" #include "../../indev/lv_indev_private.h" #include "../../stdlib/lv_string.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" /********************* * DEFINES diff --git a/src/widgets/scale/lv_scale.c b/src/widgets/scale/lv_scale.c index 09fbb2c646..a9a8f08e2d 100644 --- a/src/widgets/scale/lv_scale.c +++ b/src/widgets/scale/lv_scale.c @@ -15,7 +15,7 @@ #include "../../misc/lv_assert.h" #include "../../misc/lv_math.h" #include "../../misc/lv_text_private.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #include "../../draw/lv_draw_arc.h" /********************* diff --git a/src/widgets/scale/lv_scale.h b/src/widgets/scale/lv_scale.h index 642259a3b7..52e0e4870b 100644 --- a/src/widgets/scale/lv_scale.h +++ b/src/widgets/scale/lv_scale.h @@ -20,7 +20,7 @@ extern "C" { #include "../../core/lv_obj.h" #include "../line/lv_line.h" #include "../image/lv_image.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" /********************* * DEFINES diff --git a/src/widgets/slider/lv_slider.c b/src/widgets/slider/lv_slider.c index 89fe595d80..93c16330f8 100644 --- a/src/widgets/slider/lv_slider.c +++ b/src/widgets/slider/lv_slider.c @@ -22,7 +22,7 @@ #include "../../stdlib/lv_string.h" #include "../../misc/lv_math.h" #include "../image/lv_image.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" /********************* * DEFINES diff --git a/src/widgets/span/lv_span.c b/src/widgets/span/lv_span.c index 3d70674c81..9f4d94a857 100644 --- a/src/widgets/span/lv_span.c +++ b/src/widgets/span/lv_span.c @@ -16,7 +16,7 @@ #include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_bidi_private.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" #include "../../misc/lv_text_ap.h" #include "../../core/lv_global.h" diff --git a/src/widgets/span/lv_span.h b/src/widgets/span/lv_span.h index cf20dd05c1..ee6816bd1f 100644 --- a/src/widgets/span/lv_span.h +++ b/src/widgets/span/lv_span.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../lv_conf_internal.h" #include "../../core/lv_obj.h" -#include "../../others/observer/lv_observer.h" +#include "../../core/lv_observer.h" #if LV_USE_SPAN != 0 diff --git a/src/widgets/spinbox/lv_spinbox.c b/src/widgets/spinbox/lv_spinbox.c index 7daf0969ac..5c9bb58e3e 100644 --- a/src/widgets/spinbox/lv_spinbox.c +++ b/src/widgets/spinbox/lv_spinbox.c @@ -13,7 +13,7 @@ #include "../../misc/lv_assert.h" #include "../../indev/lv_indev.h" #include "../../stdlib/lv_string.h" -#include "../../others/observer/lv_observer_private.h" +#include "../../core/lv_observer_private.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml.c b/src/xml/lv_xml.c similarity index 99% rename from src/others/xml/lv_xml.c rename to src/xml/lv_xml.c index 48a42939c4..32f36117c5 100644 --- a/src/others/xml/lv_xml.c +++ b/src/xml/lv_xml.c @@ -53,10 +53,10 @@ #include "parsers/lv_xml_calendar_parser.h" #include "parsers/lv_xml_spinner_parser.h" #include "parsers/lv_xml_qrcode_parser.h" -#include "../../libs/expat/expat.h" -#include "../../draw/lv_draw_image.h" -#include "../../core/lv_global.h" -#include "../../misc/lv_anim_timeline_private.h" +#include "../libs/expat/expat.h" +#include "../draw/lv_draw_image.h" +#include "../core/lv_global.h" +#include "../misc/lv_anim_timeline_private.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml.h b/src/xml/lv_xml.h similarity index 97% rename from src/others/xml/lv_xml.h rename to src/xml/lv_xml.h index 59a5f619c0..51dce09dff 100644 --- a/src/others/xml/lv_xml.h +++ b/src/xml/lv_xml.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML -#include "../../misc/lv_event.h" -#include "../../others/observer/lv_observer.h" +#include "../misc/lv_event.h" +#include "../core/lv_observer.h" #include "lv_xml_test.h" #include "lv_xml_translation.h" #include "lv_xml_component.h" diff --git a/src/others/xml/lv_xml_base_types.c b/src/xml/lv_xml_base_types.c similarity index 100% rename from src/others/xml/lv_xml_base_types.c rename to src/xml/lv_xml_base_types.c diff --git a/src/others/xml/lv_xml_base_types.h b/src/xml/lv_xml_base_types.h similarity index 98% rename from src/others/xml/lv_xml_base_types.h rename to src/xml/lv_xml_base_types.h index a8cc90efa3..5bfe941902 100644 --- a/src/others/xml/lv_xml_base_types.h +++ b/src/xml/lv_xml_base_types.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" -#include "../../misc/lv_style.h" +#include "../misc/lv_types.h" +#include "../misc/lv_style.h" #if LV_USE_XML /********************** diff --git a/src/others/xml/lv_xml_component.c b/src/xml/lv_xml_component.c similarity index 99% rename from src/others/xml/lv_xml_component.c rename to src/xml/lv_xml_component.c index 6c441d60d9..9805170fac 100644 --- a/src/others/xml/lv_xml_component.c +++ b/src/xml/lv_xml_component.c @@ -9,7 +9,7 @@ #include "lv_xml_component.h" #if LV_USE_XML -#include "../../lvgl.h" +#include "../lvgl.h" #include "lv_xml_component_private.h" #include "lv_xml_private.h" #include "lv_xml_parser.h" @@ -17,9 +17,9 @@ #include "lv_xml_base_types.h" #include "lv_xml_widget.h" #include "parsers/lv_xml_obj_parser.h" -#include "../../libs/expat/expat.h" -#include "../../misc/lv_fs.h" -#include "../../core/lv_global.h" +#include "../libs/expat/expat.h" +#include "../misc/lv_fs.h" +#include "../core/lv_global.h" #include /********************* diff --git a/src/others/xml/lv_xml_component.h b/src/xml/lv_xml_component.h similarity index 98% rename from src/others/xml/lv_xml_component.h rename to src/xml/lv_xml_component.h index c1c71d515e..04be0debed 100644 --- a/src/others/xml/lv_xml_component.h +++ b/src/xml/lv_xml_component.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML /********************** diff --git a/src/others/xml/lv_xml_component_private.h b/src/xml/lv_xml_component_private.h similarity index 94% rename from src/others/xml/lv_xml_component_private.h rename to src/xml/lv_xml_component_private.h index 90fbf525b3..957d11230d 100644 --- a/src/others/xml/lv_xml_component_private.h +++ b/src/xml/lv_xml_component_private.h @@ -17,9 +17,9 @@ extern "C" { #if LV_USE_XML #include "lv_xml_utils.h" -#include "../../misc/lv_ll.h" -#include "../../misc/lv_style.h" -#include "../../others/observer/lv_observer.h" +#include "../misc/lv_ll.h" +#include "../misc/lv_style.h" +#include "../core/lv_observer.h" /********************** * TYPEDEFS diff --git a/src/others/xml/lv_xml_load.c b/src/xml/lv_xml_load.c similarity index 98% rename from src/others/xml/lv_xml_load.c rename to src/xml/lv_xml_load.c index 98691e99fe..289daa79f3 100644 --- a/src/others/xml/lv_xml_load.c +++ b/src/xml/lv_xml_load.c @@ -11,11 +11,11 @@ #if LV_USE_XML #include "lv_xml_private.h" -#include "../../core/lv_global.h" -#include "../../misc/lv_fs.h" -#include "../../libs/fsdrv/lv_fsdrv.h" -#include "../../misc/lv_ll.h" -#include "../../libs/expat/expat.h" +#include "../core/lv_global.h" +#include "../misc/lv_fs.h" +#include "../libs/fsdrv/lv_fsdrv.h" +#include "../misc/lv_ll.h" +#include "../libs/expat/expat.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml_load.h b/src/xml/lv_xml_load.h similarity index 98% rename from src/others/xml/lv_xml_load.h rename to src/xml/lv_xml_load.h index 9cbcaff0a3..c450b90684 100644 --- a/src/others/xml/lv_xml_load.h +++ b/src/xml/lv_xml_load.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML /********************* diff --git a/src/others/xml/lv_xml_load_private.h b/src/xml/lv_xml_load_private.h similarity index 100% rename from src/others/xml/lv_xml_load_private.h rename to src/xml/lv_xml_load_private.h diff --git a/src/others/xml/lv_xml_parser.c b/src/xml/lv_xml_parser.c similarity index 100% rename from src/others/xml/lv_xml_parser.c rename to src/xml/lv_xml_parser.c diff --git a/src/others/xml/lv_xml_parser.h b/src/xml/lv_xml_parser.h similarity index 96% rename from src/others/xml/lv_xml_parser.h rename to src/xml/lv_xml_parser.h index 520f32ad60..6561d4563c 100644 --- a/src/others/xml/lv_xml_parser.h +++ b/src/xml/lv_xml_parser.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" -#include "../../misc/lv_style.h" +#include "../misc/lv_types.h" +#include "../misc/lv_style.h" #if LV_USE_XML #include "lv_xml_component.h" diff --git a/src/others/xml/lv_xml_private.h b/src/xml/lv_xml_private.h similarity index 100% rename from src/others/xml/lv_xml_private.h rename to src/xml/lv_xml_private.h diff --git a/src/others/xml/lv_xml_style.c b/src/xml/lv_xml_style.c similarity index 100% rename from src/others/xml/lv_xml_style.c rename to src/xml/lv_xml_style.c diff --git a/src/others/xml/lv_xml_style.h b/src/xml/lv_xml_style.h similarity index 95% rename from src/others/xml/lv_xml_style.h rename to src/xml/lv_xml_style.h index 27e4dfbf2a..f0d9c095db 100644 --- a/src/others/xml/lv_xml_style.h +++ b/src/xml/lv_xml_style.h @@ -13,9 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" -#include "../../misc/lv_style.h" -#include "../../core/lv_obj_style.h" +#include "../misc/lv_types.h" +#include "../misc/lv_style.h" +#include "../core/lv_obj_style.h" #if LV_USE_XML diff --git a/src/others/xml/lv_xml_test.c b/src/xml/lv_xml_test.c similarity index 99% rename from src/others/xml/lv_xml_test.c rename to src/xml/lv_xml_test.c index 8c395c216f..cf62be84f9 100644 --- a/src/others/xml/lv_xml_test.c +++ b/src/xml/lv_xml_test.c @@ -13,10 +13,10 @@ #include "lv_xml.h" #include "lv_xml_utils.h" #include "lv_xml_component_private.h" -#include "../../misc/lv_fs.h" -#include "../../libs/expat/expat.h" -#include "../../display/lv_display_private.h" -#include "../../core/lv_obj_private.h" +#include "../misc/lv_fs.h" +#include "../libs/expat/expat.h" +#include "../display/lv_display_private.h" +#include "../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml_test.h b/src/xml/lv_xml_test.h similarity index 99% rename from src/others/xml/lv_xml_test.h rename to src/xml/lv_xml_test.h index f2f495db9b..d51b671397 100644 --- a/src/others/xml/lv_xml_test.h +++ b/src/xml/lv_xml_test.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML && LV_USE_TEST /********************** diff --git a/src/others/xml/lv_xml_translation.c b/src/xml/lv_xml_translation.c similarity index 97% rename from src/others/xml/lv_xml_translation.c rename to src/xml/lv_xml_translation.c index 4a66de48c9..2688f8639e 100644 --- a/src/others/xml/lv_xml_translation.c +++ b/src/xml/lv_xml_translation.c @@ -9,11 +9,11 @@ #include "../../lvgl.h" #if LV_USE_XML && LV_USE_TRANSLATION -#include "../translation/lv_translation_private.h" +#include "../others/translation/lv_translation_private.h" #include "lv_xml_widget.h" #include "lv_xml_parser.h" -#include "../../others/translation/lv_translation.h" -#include "../../libs/expat/expat.h" +#include "../others/translation/lv_translation.h" +#include "../libs/expat/expat.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml_translation.h b/src/xml/lv_xml_translation.h similarity index 96% rename from src/others/xml/lv_xml_translation.h rename to src/xml/lv_xml_translation.h index fb9561b98f..3cfd77198c 100644 --- a/src/others/xml/lv_xml_translation.h +++ b/src/xml/lv_xml_translation.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML && LV_USE_TRANSLATION /********************** diff --git a/src/others/xml/lv_xml_update.c b/src/xml/lv_xml_update.c similarity index 98% rename from src/others/xml/lv_xml_update.c rename to src/xml/lv_xml_update.c index 5741e5e9f0..87c85c81ee 100644 --- a/src/others/xml/lv_xml_update.c +++ b/src/xml/lv_xml_update.c @@ -9,10 +9,10 @@ #include "lv_xml_update.h" #if LV_USE_XML && LV_USE_OBJ_NAME -#include "../../lvgl.h" +#include "../lvgl.h" #include "lv_xml_widget.h" #include "lv_xml_parser.h" -#include "../../libs/expat/expat.h" +#include "../libs/expat/expat.h" /********************* * DEFINES diff --git a/src/others/xml/lv_xml_update.h b/src/xml/lv_xml_update.h similarity index 96% rename from src/others/xml/lv_xml_update.h rename to src/xml/lv_xml_update.h index 10eac5da7c..6f57912e40 100644 --- a/src/others/xml/lv_xml_update.h +++ b/src/xml/lv_xml_update.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML && LV_USE_OBJ_NAME /********************** diff --git a/src/others/xml/lv_xml_utils.c b/src/xml/lv_xml_utils.c similarity index 99% rename from src/others/xml/lv_xml_utils.c rename to src/xml/lv_xml_utils.c index d599fa06bb..27546ffbac 100644 --- a/src/others/xml/lv_xml_utils.c +++ b/src/xml/lv_xml_utils.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ #include "lv_xml_utils.h" -#include "../../stdlib/lv_string.h" +#include "../stdlib/lv_string.h" #if LV_USE_XML #if LV_USE_STDLIB_STRING == LV_STDLIB_CLIB diff --git a/src/others/xml/lv_xml_utils.h b/src/xml/lv_xml_utils.h similarity index 96% rename from src/others/xml/lv_xml_utils.h rename to src/xml/lv_xml_utils.h index 31bb2df969..37ede7b8cf 100644 --- a/src/others/xml/lv_xml_utils.h +++ b/src/xml/lv_xml_utils.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../lv_conf_internal.h" #if LV_USE_XML #include LV_STDINT_INCLUDE -#include "../../misc/lv_color.h" +#include "../misc/lv_color.h" /********************** * GLOBAL PROTOTYPES diff --git a/src/others/xml/lv_xml_widget.c b/src/xml/lv_xml_widget.c similarity index 97% rename from src/others/xml/lv_xml_widget.c rename to src/xml/lv_xml_widget.c index 59ecd82b85..9060e733ee 100644 --- a/src/others/xml/lv_xml_widget.c +++ b/src/xml/lv_xml_widget.c @@ -8,8 +8,8 @@ *********************/ #include "lv_xml_widget.h" #include "lv_xml_parser.h" -#include "../../stdlib/lv_string.h" -#include "../../stdlib/lv_mem.h" +#include "../stdlib/lv_string.h" +#include "../stdlib/lv_mem.h" #if LV_USE_XML diff --git a/src/others/xml/lv_xml_widget.h b/src/xml/lv_xml_widget.h similarity index 98% rename from src/others/xml/lv_xml_widget.h rename to src/xml/lv_xml_widget.h index afd0300164..fa5484bead 100644 --- a/src/others/xml/lv_xml_widget.h +++ b/src/xml/lv_xml_widget.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../misc/lv_types.h" #if LV_USE_XML #include "lv_xml_utils.h" diff --git a/src/others/xml/parsers/lv_xml_arc_parser.c b/src/xml/parsers/lv_xml_arc_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_arc_parser.c rename to src/xml/parsers/lv_xml_arc_parser.c diff --git a/src/others/xml/parsers/lv_xml_arc_parser.h b/src/xml/parsers/lv_xml_arc_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_arc_parser.h rename to src/xml/parsers/lv_xml_arc_parser.h diff --git a/src/others/xml/parsers/lv_xml_bar_parser.c b/src/xml/parsers/lv_xml_bar_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_bar_parser.c rename to src/xml/parsers/lv_xml_bar_parser.c diff --git a/src/others/xml/parsers/lv_xml_bar_parser.h b/src/xml/parsers/lv_xml_bar_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_bar_parser.h rename to src/xml/parsers/lv_xml_bar_parser.h diff --git a/src/others/xml/parsers/lv_xml_button_parser.c b/src/xml/parsers/lv_xml_button_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_button_parser.c rename to src/xml/parsers/lv_xml_button_parser.c diff --git a/src/others/xml/parsers/lv_xml_button_parser.h b/src/xml/parsers/lv_xml_button_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_button_parser.h rename to src/xml/parsers/lv_xml_button_parser.h diff --git a/src/others/xml/parsers/lv_xml_buttonmatrix_parser.c b/src/xml/parsers/lv_xml_buttonmatrix_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_buttonmatrix_parser.c rename to src/xml/parsers/lv_xml_buttonmatrix_parser.c diff --git a/src/others/xml/parsers/lv_xml_buttonmatrix_parser.h b/src/xml/parsers/lv_xml_buttonmatrix_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_buttonmatrix_parser.h rename to src/xml/parsers/lv_xml_buttonmatrix_parser.h diff --git a/src/others/xml/parsers/lv_xml_calendar_parser.c b/src/xml/parsers/lv_xml_calendar_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_calendar_parser.c rename to src/xml/parsers/lv_xml_calendar_parser.c diff --git a/src/others/xml/parsers/lv_xml_calendar_parser.h b/src/xml/parsers/lv_xml_calendar_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_calendar_parser.h rename to src/xml/parsers/lv_xml_calendar_parser.h diff --git a/src/others/xml/parsers/lv_xml_canvas_parser.c b/src/xml/parsers/lv_xml_canvas_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_canvas_parser.c rename to src/xml/parsers/lv_xml_canvas_parser.c diff --git a/src/others/xml/parsers/lv_xml_canvas_parser.h b/src/xml/parsers/lv_xml_canvas_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_canvas_parser.h rename to src/xml/parsers/lv_xml_canvas_parser.h diff --git a/src/others/xml/parsers/lv_xml_chart_parser.c b/src/xml/parsers/lv_xml_chart_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_chart_parser.c rename to src/xml/parsers/lv_xml_chart_parser.c diff --git a/src/others/xml/parsers/lv_xml_chart_parser.h b/src/xml/parsers/lv_xml_chart_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_chart_parser.h rename to src/xml/parsers/lv_xml_chart_parser.h diff --git a/src/others/xml/parsers/lv_xml_checkbox_parser.c b/src/xml/parsers/lv_xml_checkbox_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_checkbox_parser.c rename to src/xml/parsers/lv_xml_checkbox_parser.c diff --git a/src/others/xml/parsers/lv_xml_checkbox_parser.h b/src/xml/parsers/lv_xml_checkbox_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_checkbox_parser.h rename to src/xml/parsers/lv_xml_checkbox_parser.h diff --git a/src/others/xml/parsers/lv_xml_dropdown_parser.c b/src/xml/parsers/lv_xml_dropdown_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_dropdown_parser.c rename to src/xml/parsers/lv_xml_dropdown_parser.c diff --git a/src/others/xml/parsers/lv_xml_dropdown_parser.h b/src/xml/parsers/lv_xml_dropdown_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_dropdown_parser.h rename to src/xml/parsers/lv_xml_dropdown_parser.h diff --git a/src/others/xml/parsers/lv_xml_image_parser.c b/src/xml/parsers/lv_xml_image_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_image_parser.c rename to src/xml/parsers/lv_xml_image_parser.c diff --git a/src/others/xml/parsers/lv_xml_image_parser.h b/src/xml/parsers/lv_xml_image_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_image_parser.h rename to src/xml/parsers/lv_xml_image_parser.h diff --git a/src/others/xml/parsers/lv_xml_keyboard_parser.c b/src/xml/parsers/lv_xml_keyboard_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_keyboard_parser.c rename to src/xml/parsers/lv_xml_keyboard_parser.c diff --git a/src/others/xml/parsers/lv_xml_keyboard_parser.h b/src/xml/parsers/lv_xml_keyboard_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_keyboard_parser.h rename to src/xml/parsers/lv_xml_keyboard_parser.h diff --git a/src/others/xml/parsers/lv_xml_label_parser.c b/src/xml/parsers/lv_xml_label_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_label_parser.c rename to src/xml/parsers/lv_xml_label_parser.c diff --git a/src/others/xml/parsers/lv_xml_label_parser.h b/src/xml/parsers/lv_xml_label_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_label_parser.h rename to src/xml/parsers/lv_xml_label_parser.h diff --git a/src/others/xml/parsers/lv_xml_obj_parser.c b/src/xml/parsers/lv_xml_obj_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_obj_parser.c rename to src/xml/parsers/lv_xml_obj_parser.c diff --git a/src/others/xml/parsers/lv_xml_obj_parser.h b/src/xml/parsers/lv_xml_obj_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_obj_parser.h rename to src/xml/parsers/lv_xml_obj_parser.h diff --git a/src/others/xml/parsers/lv_xml_qrcode_parser.c b/src/xml/parsers/lv_xml_qrcode_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_qrcode_parser.c rename to src/xml/parsers/lv_xml_qrcode_parser.c diff --git a/src/others/xml/parsers/lv_xml_qrcode_parser.h b/src/xml/parsers/lv_xml_qrcode_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_qrcode_parser.h rename to src/xml/parsers/lv_xml_qrcode_parser.h diff --git a/src/others/xml/parsers/lv_xml_roller_parser.c b/src/xml/parsers/lv_xml_roller_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_roller_parser.c rename to src/xml/parsers/lv_xml_roller_parser.c diff --git a/src/others/xml/parsers/lv_xml_roller_parser.h b/src/xml/parsers/lv_xml_roller_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_roller_parser.h rename to src/xml/parsers/lv_xml_roller_parser.h diff --git a/src/others/xml/parsers/lv_xml_scale_parser.c b/src/xml/parsers/lv_xml_scale_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_scale_parser.c rename to src/xml/parsers/lv_xml_scale_parser.c diff --git a/src/others/xml/parsers/lv_xml_scale_parser.h b/src/xml/parsers/lv_xml_scale_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_scale_parser.h rename to src/xml/parsers/lv_xml_scale_parser.h diff --git a/src/others/xml/parsers/lv_xml_slider_parser.c b/src/xml/parsers/lv_xml_slider_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_slider_parser.c rename to src/xml/parsers/lv_xml_slider_parser.c diff --git a/src/others/xml/parsers/lv_xml_slider_parser.h b/src/xml/parsers/lv_xml_slider_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_slider_parser.h rename to src/xml/parsers/lv_xml_slider_parser.h diff --git a/src/others/xml/parsers/lv_xml_spangroup_parser.c b/src/xml/parsers/lv_xml_spangroup_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_spangroup_parser.c rename to src/xml/parsers/lv_xml_spangroup_parser.c diff --git a/src/others/xml/parsers/lv_xml_spangroup_parser.h b/src/xml/parsers/lv_xml_spangroup_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_spangroup_parser.h rename to src/xml/parsers/lv_xml_spangroup_parser.h diff --git a/src/others/xml/parsers/lv_xml_spinbox_parser.c b/src/xml/parsers/lv_xml_spinbox_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_spinbox_parser.c rename to src/xml/parsers/lv_xml_spinbox_parser.c diff --git a/src/others/xml/parsers/lv_xml_spinbox_parser.h b/src/xml/parsers/lv_xml_spinbox_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_spinbox_parser.h rename to src/xml/parsers/lv_xml_spinbox_parser.h diff --git a/src/others/xml/parsers/lv_xml_spinner_parser.c b/src/xml/parsers/lv_xml_spinner_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_spinner_parser.c rename to src/xml/parsers/lv_xml_spinner_parser.c diff --git a/src/others/xml/parsers/lv_xml_spinner_parser.h b/src/xml/parsers/lv_xml_spinner_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_spinner_parser.h rename to src/xml/parsers/lv_xml_spinner_parser.h diff --git a/src/others/xml/parsers/lv_xml_switch_parser.c b/src/xml/parsers/lv_xml_switch_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_switch_parser.c rename to src/xml/parsers/lv_xml_switch_parser.c diff --git a/src/others/xml/parsers/lv_xml_switch_parser.h b/src/xml/parsers/lv_xml_switch_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_switch_parser.h rename to src/xml/parsers/lv_xml_switch_parser.h diff --git a/src/others/xml/parsers/lv_xml_table_parser.c b/src/xml/parsers/lv_xml_table_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_table_parser.c rename to src/xml/parsers/lv_xml_table_parser.c diff --git a/src/others/xml/parsers/lv_xml_table_parser.h b/src/xml/parsers/lv_xml_table_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_table_parser.h rename to src/xml/parsers/lv_xml_table_parser.h diff --git a/src/others/xml/parsers/lv_xml_tabview_parser.c b/src/xml/parsers/lv_xml_tabview_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_tabview_parser.c rename to src/xml/parsers/lv_xml_tabview_parser.c diff --git a/src/others/xml/parsers/lv_xml_tabview_parser.h b/src/xml/parsers/lv_xml_tabview_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_tabview_parser.h rename to src/xml/parsers/lv_xml_tabview_parser.h diff --git a/src/others/xml/parsers/lv_xml_textarea_parser.c b/src/xml/parsers/lv_xml_textarea_parser.c similarity index 100% rename from src/others/xml/parsers/lv_xml_textarea_parser.c rename to src/xml/parsers/lv_xml_textarea_parser.c diff --git a/src/others/xml/parsers/lv_xml_textarea_parser.h b/src/xml/parsers/lv_xml_textarea_parser.h similarity index 100% rename from src/others/xml/parsers/lv_xml_textarea_parser.h rename to src/xml/parsers/lv_xml_textarea_parser.h