Add document

This commit is contained in:
2025-08-10 16:58:44 +08:00
parent f602ddb4b5
commit cfc1dbf507
43 changed files with 516 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
//! Buriko General Interpreter/Ethornell Compressed Image File
use crate::ext::atomic::*;
use crate::ext::io::*;
use crate::scripts::base::*;
@@ -12,9 +13,11 @@ use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex};
#[derive(Debug)]
/// Builder for BGI Compressed Image scripts.
pub struct BgiCBGBuilder {}
impl BgiCBGBuilder {
/// Creates a new instance of `BgiCBGBuilder`.
pub const fn new() -> Self {
BgiCBGBuilder {}
}
@@ -125,6 +128,7 @@ fn convert_bgr565_to_bgr24(input: Vec<u8>, width: u16, height: u16) -> ImageData
}
#[derive(Debug)]
/// BGI Compressed Image script.
pub struct BgiCBG {
header: BgiCBGHeader,
data: MemReader,
@@ -132,6 +136,10 @@ pub struct BgiCBG {
}
impl BgiCBG {
/// Creates a new instance of `BgiCBG` from a buffer.
///
/// * `data` - The buffer containing the script data.
/// * `config` - Extra configuration options.
pub fn new(data: Vec<u8>, _config: &ExtraConfig) -> Result<Self> {
let mut reader = MemReader::new(data);
let mut magic = [0u8; 16];

View File

@@ -1,3 +1,4 @@
//! Buriko General Interpreter/Ethornell Uncompressed Image File
use crate::ext::io::*;
use crate::scripts::base::*;
use crate::types::*;
@@ -31,9 +32,11 @@ fn try_parse(buf: &[u8]) -> Result<u8> {
}
#[derive(Debug)]
/// Builder for BGI Uncompressed Image scripts.
pub struct BgiImageBuilder {}
impl BgiImageBuilder {
/// Creates a new instance of `BgiImageBuilder`.
pub const fn new() -> Self {
BgiImageBuilder {}
}
@@ -90,6 +93,7 @@ impl ScriptBuilder for BgiImageBuilder {
}
#[derive(Debug)]
/// BGI Uncompressed Image script.
pub struct BgiImage {
data: MemReader,
width: u32,
@@ -162,6 +166,10 @@ fn create_image<'a>(
}
impl BgiImage {
/// Creates a new instance of `BgiImage` from a buffer.
///
/// * `buf` - The buffer containing the script data.
/// * `config` - Extra configuration options.
pub fn new(buf: Vec<u8>, config: &ExtraConfig) -> Result<Self> {
let mut reader = MemReader::new(buf);
let width = reader.read_u16()? as u32;

View File

@@ -1,2 +1,3 @@
//! Buriko General Interpreter/Ethornell Image
pub mod cbg;
pub mod img;