QR code improvements
This commit is contained in:
@@ -79,8 +79,8 @@ textures :: proc() {
|
||||
// -------------------------------------------------------------------------
|
||||
// QR code texture (R8_UNORM — see rendering note below)
|
||||
// -------------------------------------------------------------------------
|
||||
qr, _ := draw_qr.create_from_text("https://odin-lang.org/")
|
||||
defer draw_qr.destroy(&qr)
|
||||
qr_texture, _ := draw_qr.register_texture_from_text("https://x.com/miiilato/status/1880241066471051443")
|
||||
defer draw.unregister_texture(qr_texture)
|
||||
|
||||
spin_angle: f32 = 0
|
||||
|
||||
@@ -161,16 +161,12 @@ textures :: proc() {
|
||||
// =====================================================================
|
||||
ROW2_Y :: f32(190)
|
||||
|
||||
// QR code (R8_UNORM texture, nearest sampling)
|
||||
// NOTE: R8_UNORM samples as (r, 0, 0, 1) in Metal's default swizzle.
|
||||
// With WHITE tint: dark modules (R=1) → red, light modules (R=0) → black.
|
||||
// The result is a red-on-black QR code. The white bg rect below is
|
||||
// occluded by the fully-opaque texture but kept for illustration.
|
||||
// QR code (RGBA texture with baked colors, nearest sampling)
|
||||
draw.rectangle(base_layer, {COL1, ROW2_Y, ITEM_SIZE, ITEM_SIZE}, {255, 255, 255, 255}) // white bg
|
||||
draw.rectangle_texture(
|
||||
base_layer,
|
||||
{COL1, ROW2_Y, ITEM_SIZE, ITEM_SIZE},
|
||||
qr.texture_id,
|
||||
qr_texture,
|
||||
sampler = .Nearest_Clamp,
|
||||
)
|
||||
draw.text(
|
||||
|
||||
Reference in New Issue
Block a user