Skip to main content

ImageConfig

Struct ImageConfig 

Source
pub struct ImageConfig {
    pub lv_conf_dir: PathBuf,
    pub lvgl_include_dir: PathBuf,
    pub converter: PathBuf,
}
Expand description

Build-time configuration for LVGL image asset compilation.

Fields§

§lv_conf_dir: PathBuf

Path to directory containing lv_conf.h.

§lvgl_include_dir: PathBuf

Path to LVGL header root (directory containing lvgl.h).

§converter: PathBuf

Path to LVGLImage.py converter script.

Implementations§

Source§

impl ImageConfig

Source

pub fn from_env() -> Self

Create config from environment.

  • lv_conf_dir from DEP_LV_CONFIG_PATH env var
  • lvgl_include_dir and converter discovered from the oxivgl_sys cargo git checkout or thirdparty fallback.
§Panics

If DEP_LV_CONFIG_PATH is not set or LVGL source tree not found.

Source

pub fn image_asset(&self, name: &str, png_path: &str)

Convert a PNG to an LVGL C image source, compile it, and link it.

  • name: C symbol name (e.g. "cogwheel"). Must be a valid C identifier.
  • png_path: path to PNG file, relative to CARGO_MANIFEST_DIR.

Color format is derived from LV_COLOR_DEPTH in lv_conf.h.

§Build requirements

Python 3 with pypng and lz4 packages.

§Panics
  • PNG file not found
  • LVGLImage.py exits non-zero
  • cc compilation fails

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.