Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/omega/allen/paint.om # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / omega / allen / paint.om` 100 lines ยท 2154 bytes Raw Blame History 1 note Handwritten Omega port of paint.h ck_add, ck_scale, ck_mix and paint.c ck_glow. 2 note Bounded192x128 RAM canvas. This is rendering core, not full sky/font/device UI. 3 global Frame uint 24576 4 global G ulong 6 5 global Fb uchar 73728 6 fn channel c uint shift uint to uint 7 ret and shr c shift 255 8 end 9 fn addcolor d uint c uint a uint to uint 10 v = uint 0 11 for i uint 3 12 s = mul i 8 13 n = add channel d s shr mul channel c s a 8 14 if gt n 255 15 n = 255 16 end 17 v = or v shl n s 18 end 19 ret v 20 end 21 fn scale c uint f uint to uint 22 ret or and shr mul and c `16711935` f 8 `16711935` and shr mul and c 65280 f 8 65280 23 end 24 fn mix d uint c uint a uint to uint 25 if ge a 256 26 ret c 27 end 28 ret add scale d sub uint 256 a scale c a 29 end 30 fn distance x ulong y ulong to ulong 31 dx = sub add mul long x 16 8 long get G 0 32 dy = sub add mul long y 16 8 long get G 1 33 ret ulong add mul dx dx mul dy dy 34 end 35 fn weight d2 ulong r2 ulong to ulong 36 inv = div ulong `1099511627776` r2 37 f = sub ulong 256 shr mul d2 inv 32 38 w = shr mul shr mul f f 8 f 8 39 ret shr mul w get G 4 8 40 end 41 fn glowpix x ulong y ulong to void 42 d2 = distance x y 43 r2 = mul get G 2 get G 2 44 if ge d2 r2 45 ret 46 end 47 a = uint weight d2 r2 48 at = add mul y 192 x 49 put Frame at addcolor get Frame at uint get G 3 a 50 end 51 fn glow cx ulong cy ulong radius ulong color ulong alpha ulong to bool 52 if or eq radius 0 gt radius 8192 53 ret false 54 end 55 if or gt cx 8192 gt cy 8192 56 ret false 57 end 58 if or gt color `16777215` gt alpha 512 59 ret false 60 end 61 put G 0 cx 62 put G 1 cy 63 put G 2 radius 64 put G 3 color 65 put G 4 alpha 66 for y ulong 128 67 for x ulong 192 68 glowpix x y 69 end 70 end 71 ret true 72 end 73 fn render to void 74 for i ulong 24576 75 put Frame i 0 76 end 77 note Frozen component pose; same halo and heart colors/weights as ck_mind_draw. 78 b = glow 1536 1024 1088 `3951314` 68 79 b = glow 1536 1024 640 `7363839` 46 80 b = glow 1536 1024 400 `16765610` 89 81 b = glow 1536 1024 160 `16772310` 218 82 b = glow 1536 1024 50 `16775920` 230 83 end 84 fn frameout to bool 85 for i ulong 24576 86 c = get Frame i 87 put Fb mul i 3 uchar channel c 16 88 put Fb add mul i 3 1 uchar channel c 8 89 put Fb add mul i 3 2 uchar channel c 0 90 end 91 n = ulong 0 92 while lt n len Fb 93 w = write 1 Fb n sub len Fb n 94 if le w 0 95 ret false 96 end 97 n = add n ulong w 98 end 99 ret true 100 end