Bad apple tcl

This commit is contained in:
2026-03-26 16:40:35 +01:00
commit 92848bc56d
10 changed files with 104 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "badapple_tcl"
version = "0.1.0"

6
Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "badapple_tcl"
version = "0.1.0"
edition = "2024"
[dependencies]

BIN
b.mp4 Normal file

Binary file not shown.

BIN
bsmall.mp4 Normal file

Binary file not shown.

1
convert.sh Normal file
View File

@ -0,0 +1 @@
ffmpeg -i input_video.mp4 -vf "format=gray,format=monob" -f rawvideo pipe:1 > output.bin

BIN
main Executable file

Binary file not shown.

21
main.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
int main()
{
printf("skibidi all message \e[5m\e[40m\e[37m⣿⣿⣿⣿⣿⠟⠋⠄⠄⠄⠄⠄⠄⠄⢁⠈⢻⢿⣿⣿⣿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⡀⠭⢿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⡟⠄⢀⣾⣿⣿⣿⣷⣶⣿⣷⣶⣶⡆⠄⠄⠄⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⡇⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠄⠄⢸⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣇⣼⣿⣿⠿⠶⠙⣿⡟⠡⣴⣿⣽⣿⣧⠄⢸⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⣾⣿⣿⣟⣭⣾⣿⣷⣶⣶⣴⣶⣿⣿⢄⣿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⣿⣿⣿⡟⣩⣿⣿⣿⡏⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⣿⣹⡋⠘⠷⣦⣀⣠⡶⠁⠈⠁⠄⣿⣿⣿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⣿⣍⠃⣴⣶⡔⠒⠄⣠⢀⠄⠄⠄⡨⣿⣿⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⣿⣿⣿⣦⡘⠿⣷⣿⠿⠟⠃⠄⠄⣠⡇⠈⠻⣿⣿⣿⣿\n"
"⣿⣿⣿⣿⡿⠟⠋⢁⣷⣠⠄⠄⠄⠄⣀⣠⣾⡟⠄⠄⠄⠄⠉⠙⠻\n"
"⡿⠟⠋⠁⠄⠄⠄⢸⣿⣿⡯⢓⣴⣾⣿⣿⡟⠄⠄⠄⠄⠄⠄⠄⠄\n"
"⠄⠄⠄⠄⠄⠄⠄⣿⡟⣷⠄⠹⣿⣿⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄\n"
"⠄⠄⠄⠄⠄⠄⣸⣿⡷⡇⠄⣴⣾⣿⣿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄\n"
"⠄⠄⠄⠄⠄⠄⣿⣿⠃⣦⣄⣿⣿⣿⠇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄\n"
"⠄⠄⠄⠄⠄⢸⣿⠗⢈⡶⣷⣿⣿⡏⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄\n");
}

68
src/main.rs Normal file
View File

@ -0,0 +1,68 @@
use std::{fs::File, io::Read, time::Duration};
const WIDTH: usize = 160;
const HEIGHT: usize = 120;
fn main()
{
let mut data = vec![];
File::open("v.bin").unwrap().read_to_end(&mut data).unwrap();
let mut k = 0;
print!("\x1B[40m\x1B[37m");
for frame in data.chunks((WIDTH * HEIGHT) / 8)
{
print!("\x1B[H");
for j in 0..(HEIGHT / 4)
{
for i in 0..(WIDTH / 2)
{
let offset = retrieve_braille_bits(frame, i, j);
let char = char::from_u32(0x2800 + offset as u32).unwrap();
print!("{}", char);
}
println!();
}
std::thread::sleep(Duration::from_millis(50));
}
}
fn data_index(data: &[u8], x: usize, y: usize) -> bool
{
let bit_index = x + y * WIDTH;
let byte_index = bit_index / 8;
let shift_index = 7 - bit_index % 8;
((data[byte_index] >> shift_index) & 1) != 0
}
fn retrieve_braille_bits(data: &[u8], bx: usize, by: usize) -> u8
{
let bitmap = [0, 1, 2, 6, 3, 4, 5, 7];
let mut offset = 0u8;
for i in 0..2
{
for j in 0..4
{
let pixel = data_index(data, bx * 2 + i, by * 4 + j);
if pixel
{
offset |= 1 << bitmap[j + 4 * i];
}
}
}
offset
}
fn bit_to_bytes(byte: u8) -> [bool; 8]
{
[
((byte >> 7) & 1) != 0,
((byte >> 6) & 1) != 0,
((byte >> 5) & 1) != 0,
((byte >> 4) & 1) != 0,
((byte >> 3) & 1) != 0,
((byte >> 2) & 1) != 0,
((byte >> 1) & 1) != 0,
(byte & 1) != 0,
]
}

BIN
v.bin Normal file

Binary file not shown.