Skip to content

Instantly share code, notes, and snippets.

const m1 = 0.1593017578125;
const m2 = 78.84375;
const c1 = 0.8359375;
const c2 = 18.851525;
const c3 = 18.6875;
double inversePq(double n) {
final top = max(
pow(n, 1 / m2) - c1,
0,
@damywise
damywise / tonemap_2446c.dart
Created November 28, 2023 09:12
Dart ITU-R BT.2446 Conversion Method C, From HDR Toys glsl
// ---------------------------------------------------------------------------------------------------------------------------------------
// ITU-R BT.2446 Conversion Method C
// https://www.itu.int/pub/R-REP-BT.2446
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC tone mapping (bt.2446c)
@damywise
damywise / main.dart
Last active October 21, 2023 08:44
Using SDL to generate images with dart and isolates.
import 'dart:ffi';
import 'dart:io';
import 'dart:math';
import 'package:ffi/ffi.dart';
import 'package:sdl2/sdl2.dart';
class FontData {
FontData(this.fontSource, this.fontSize);
@damywise
damywise / error.txt
Created July 3, 2023 10:18
v cross compiling error
% sudo v main.v -prod -os windows -arch amd64 -cflags -I./bin
Cross compiling for Windows...
In file included from ./bin/SDL.h:78,
from /tmp/v_0/main.11578763869071359096.tmp.c:823:
./bin/SDL3/SDL_oldnames.h:544:24: error: 'SDL_FIRSTEVENT_renamed_SDL_EVENT_FIRS' undeclared here (not in a function)
544 | #define SDL_FIRSTEVENT SDL_FIRSTEVENT_renamed_SDL_EVENT_FIRST
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v_0/main.11578763869071359096.tmp.c:1116:38: note: in expansion of macro 'SDL_FIRSTEVENT'
1116 | sdl__EventType__firstevent = SDL_FIRSTEVENT, // SDL_FIRSTEVENT
| ^~~~~~~~~~~~~~
@damywise
damywise / main.dart
Created April 10, 2023 16:43
fl_chart reveal animation
import 'dart:math';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@damywise
damywise / v_error_stbi_ttf_test.v
Last active January 31, 2023 11:07
Not working as expected
import os
import x.ttf
import stbi
fn main() {
mut ttf_font := ttf.TTF_File{}
ttf_font.buf = os.read_bytes('assets/fonts/ALS-Script.ttf') or { panic(err) }
ttf_font.init()
// print font info
println(ttf_font.get_info_string())