Skip to content

Commit

Permalink
add module media::image::sixel and related types
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluis committed Feb 11, 2025
1 parent 92032d0 commit 9b9a80d
Show file tree
Hide file tree
Showing 19 changed files with 3,950 additions and 11 deletions.
3 changes: 2 additions & 1 deletion DOCS/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- data:
- xifer: `DataValue*`, `DataType*`, `DataRaw*`, `NoData`, `Base`, `Crockford`, `Rfc4648`, `Rfc4648Hex`.
- lang: `g_*`.
- media: `BitmapFont`.
- media: `BitmapFont`, `Sixel`, `Dither`, `PixelFormat`, `SixelError`, `SixelMean`, `SixelQuality`, `SixelSplit`.
- sys: `DirApple`, `DirWindows`, `DirUnix`, `DirXdg`, `LogConfig`,
- ui: `UiCap`, `UiCapImage`, `UiCapInput`, `UiCapSound`, `UiCapSystem`, `UiCapWindow`.
- `CrosstermService`.
Expand All @@ -25,6 +25,7 @@
- new modules:
- `data::{codec::{self, radix}, list, key, table, uid, xipher}`.
- `lang::{c, glsl}`.
- `media::image::sixel`.
- `sys::{log, net}`.
- `ui::service::{self, crossterm, miniquad}`.
- new macro arms:
Expand Down
14 changes: 10 additions & 4 deletions DOCS/VENDORED.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See the linked modifications for detailed changes.
- <i id="fxhash"></i>[fxhash] by Christopher Breeden,
as the [`HasherFx`] struct ([*modifications*][M_fxhash]).
- <i id="no_std_io"></i>[no_std_io]|[core2] by Brendan Molloy,
as part of the [`io`] module ([*modifications*][M_no_std_io]).
as part of the [`sys::io`] module ([*modifications*][M_no_std_io]).
- <i id="numtoa"></i>[numtoa] by Michael Murphy,
as the [`NumToStr`] trait ([*modifications*][M_numtoa]).
- <i id="pollster"></i>[pollster] by Joshua Barretto,
Expand Down Expand Up @@ -55,9 +55,9 @@ See the linked modifications for detailed changes.
[M_fxhash]: https://github.com/andamira/devela/blob/main/src/data/codec/hash/fx/MODIFICATIONS.md
[`HasherFx`]: https://docs.rs/devela/latest/devela/data/codec/hash/struct.HasherFx.html
[no_std_io]: https://crates.io/crates/no_std_io/0.6.0
[M_no_std_io]: https://github.com/andamira/devela/blob/main/src/sys/io/define_no_std_io/MODIFICATIONS.md
[core2]: https://crates.io/crates/core2/0.4.0
[`io`]: https://docs.rs/devela/latest/devela/sys/io/
[M_no_std_io]: https://github.com/andamira/devela/blob/main/src/sys/io/define_no_std_io/MODIFICATIONS.md
[`sys::io`]: https://docs.rs/devela/latest/devela/sys/io/
[numtoa]: https://crates.io/crates/numtoa/0.2.4
[M_numtoa]: https://github.com/andamira/devela/blob/main/src/text/fmt/num_to_str/MODIFICATIONS.md
[`NumToStr`]: https://docs.rs/devela/latest/devela/text/fmt/trait.NumToStr.html
Expand Down Expand Up @@ -89,6 +89,8 @@ See the linked modifications for detailed changes.
as the [`cfor`] macro.
- <i id="crunchy"></i>[crunchy] by Eira Fransham,
as the [`unroll`] macro ([*modifications*][M_crunchy]).
- <i id="icy_sixel"></i>[icy_sixel] by Mike Krüger, based on [libsixel] by Hayaki Saito,
as the [`media::image::sixel`] module ([*modifications*][M_icy_sixel]).
- <i id="object-id"></i>[object-id] by *Altertech*,
as part of the [`IdPinBox`] and [`IdPin`] structs ([*modifications*][M_object-id]).
- <i id="rawbytes"></i>[rawbytes] by Frank Denis,
Expand All @@ -99,8 +101,12 @@ See the linked modifications for detailed changes.
[const_for]: https://crates.io/crates/const_for/0.1.4
[`cfor`]: https://docs.rs/devela/latest/devela/code/util/macro.cfor.html
[crunchy]: https://crates.io/crates/crunchy/0.2.3
[`unroll`]: https://docs.rs/devela/latest/devela/code/util/macro.unroll.html
[M_crunchy]: https://github.com/andamira/devela/blob/main/build/generate/unroll/MODIFICATIONS.md
[`unroll`]: https://docs.rs/devela/latest/devela/code/util/macro.unroll.html
[icy_sixel]: https://crates.io/crates/icy_sixel/0.1.3
[libsixel]: https://github.com/saitoha/libsixel
[M_icy_sixel]: https://github.com/andamira/devela/blob/main/src/media/image/sixel/MODIFICATIONS.md
[`media::image::sixel`]: https://docs.rs/devela/latest/devela/media/image/sixel
[object-id]: https://crates.io/crates/object-id/0.1.4
[M_object-id]: https://github.com/andamira/devela/blob/main/src/data/uid/pin/MODIFICATIONS.md
[`IdPin`]: https://docs.rs/devela/latest/devela/data/uid/struct.IdPin.html
Expand Down
6 changes: 4 additions & 2 deletions DOCS/VENDORED_rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@

<!-- orig: MIT -->
[`cfor`]: crate::code::util::cfor
[`unroll`]: crate::code::util::unroll
[M_crunchy]: crate::_info::vendored::modifications#crunchy
[`IdPin`]: crate::data::uid::IdPin
[`unroll`]: crate::code::util::unroll
[M_icy_sixel]: crate::_info::vendored::modifications#icy_sixel
[`media::image::sixel`]: crate::media::image::sixel
[M_object-id]: crate::_info::vendored::modifications#object-id
[`IdPin`]: crate::data::uid::IdPin
[`IdPinBox`]: crate::IdPinBox
[`as_bytes`]: crate::sys::mem::Mem::as_bytes
[`as_bytes_mut`]: crate::sys::mem::Mem::as_bytes_mut
Expand Down
1 change: 1 addition & 0 deletions src/_info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub mod vendored {
#[doc = crate::doc_!(vendor_mod: "tupl", "../data/list/tuple/MODIFICATIONS.md")]
// MIT:
#[doc = crate::doc_!(vendor_mod: "crunchy", "../code/util/unroll/MODIFICATIONS.md")]
#[doc = crate::doc_!(vendor_mod: "icy_sixel", "../media/image/sixel/MODIFICATIONS.md")]
#[doc = crate::doc_!(vendor_mod: "object-id", "../data/uid/pin/MODIFICATIONS.md")]
// other:
// #[doc = crate::doc_!(vendor_mod: "blit-fonts", "../media/font/bitmap/MODS_BLIT.md")] // WIP
Expand Down
22 changes: 18 additions & 4 deletions src/media/image/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,32 @@
mod error;
mod pnm;

crate::items! { // structural access: _mods, _all, _always
#[cfg(all(feature = "alloc", feature = "term"))]
#[cfg(any(feature = "io", feature = "std"))]
#[cfg(any(feature = "dep_hashbrown", feature = "std"))]
#[cfg_attr(feature = "nightly_doc", doc(cfg(all(feature = "alloc", feature = "term"))))]
#[cfg_attr(feature = "nightly_doc", doc(cfg(any(feature = "io", feature = "std"))))]
#[cfg_attr(feature = "nightly_doc", doc(cfg(any(feature = "dep_hashbrown", feature = "std"))))]
pub mod sixel;

crate::items! { // structural access: _mods, _pub_mods, _all, _always
#[allow(unused)]
pub use _mods::*;
#[allow(unused)] #[doc(hidden, no_inline)]
pub use _always::*;
pub use {_always::*, _pub_mods::*};

mod _mods {
pub use super::{error::*, pnm::*};
}
pub(super) mod _all {
mod _pub_mods { #![allow(unused)]
#[cfg(all(feature = "alloc", feature = "term"))]
#[cfg(any(feature = "io", feature = "std"))]
#[cfg(any(feature = "dep_hashbrown", feature = "std"))]
pub use super::sixel::_all::*;
}
pub(super) mod _all { #![allow(unused)]
#[doc(inline)]
pub use super::_mods::*;
pub use super::{_mods::*, _pub_mods::*};
}
pub(super) mod _always { #![allow(unused)]
}
Expand Down
22 changes: 22 additions & 0 deletions src/media/image/sixel/MODIFICATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This is derived work from the
[`icy_sixel`](https://crates.io/crates/icy_sixel/0.1.3) crate,
(a Rust port of [`libsixel`](https://github.com/saitoha/libsixel))
including the following modifications:

- make it work with `no_std`.
- make several functions `const`.
- rename `sixel_dither` to `DitherConf`.
- rename `MethodForRep` to `SixelMean`.
- rename `MethodForLargest` to `SixelSplit`.
- rename `BuiltinDither` to `SixelPalette`, and associate the palettes.
- rename `PaletteType` to `SixelColorModel` and its `ColorBox` variant to `Colors`.
- add new methods to `PixelFormat`: `bits_per_pixel`, `bytes_per_pixel`, `required_bytes`.
- make private: `SixelPalette`, `SixelNode`, `SixelOutput`, `SixelEncodePolicy`, `SixelColorModel`, `FormatType`, many functions.
- new `Sixel` builder struct and make the `sixel_string` function private.
- derive `Default` and `ConstDefault`, when possible.
- rename many items according to rust guidelines.
- simplify lints, comments and attributes.
- improve docs, also for private items.
- improve and simplify error types.
- remove commented-out code.
- big refactor, modularize.
Loading

0 comments on commit 9b9a80d

Please sign in to comment.