diff --git a/Makefile b/Makefile index 3405940..f4d5fa3 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ HOST := plot_widget_host # provides them. Kryon's modules are named by their import paths. BINDS := \ --bind kryon/font_metrics:MeasureGlyphWidth=$(HOST):MeasureGlyphWidth \ + --bind kryon/font_metrics:MeasureGlyphLineHeight=$(HOST):MeasureGlyphLineHeight \ + --bind kryon/paint_queue:RasterImageMesh=$(HOST):RasterImageMesh \ + --bind kryon/raster_text:RasterTextRotated=$(HOST):RasterTextRotated \ --bind kryon/raster_text:RasterText=$(HOST):RasterText \ --bind kryon/raster_text:RasterTextClipped=$(HOST):RasterTextClipped \ --bind kryon/raster_shape:RasterRoundedRectangle=$(HOST):RasterRoundedRectangle \ @@ -26,6 +29,9 @@ BINDS := \ HOSTED_HOST := band_chart_host_provider HOSTED_BINDS := \ --bind kryon/font_metrics:MeasureGlyphWidth=$(HOSTED_HOST):MeasureGlyphWidth \ + --bind kryon/font_metrics:MeasureGlyphLineHeight=$(HOSTED_HOST):MeasureGlyphLineHeight \ + --bind kryon/paint_queue:RasterImageMesh=$(HOSTED_HOST):RasterImageMesh \ + --bind kryon/raster_text:RasterTextRotated=$(HOSTED_HOST):RasterTextRotated \ --bind kryon/raster_text:RasterText=$(HOSTED_HOST):RasterText \ --bind kryon/raster_text:RasterTextClipped=$(HOSTED_HOST):RasterTextClipped \ --bind kryon/raster_shape:RasterRoundedRectangle=$(HOSTED_HOST):RasterRoundedRectangle \ diff --git a/src/band_chart_codec.zi b/src/band_chart_codec.zi index 6eb2f1d..f463fc0 100644 --- a/src/band_chart_codec.zi +++ b/src/band_chart_codec.zi @@ -8,6 +8,9 @@ #import "band_chart_props" using HostValueKind; +WidgetTypeBandChartProps :: "band_chart_props.BandChartProps" +WidgetSliceTypeBandChartProps :: "[]band_chart_props.BandChartProps" + WidgetBandChartPropsCodec :: struct { fields: [16]HostField bounds: WidgetRectangleCodec @@ -20,7 +23,7 @@ WidgetBandChartPropsCodec :: struct { } WidgetEncodeBandChartProps :: (data: BandChartProps, codec: *WidgetBandChartPropsCodec) -> HostValue { - value := HostRecordValue("BandChartProps", codec.fields[:]) + value := HostRecordValue("band_chart_props.BandChartProps", codec.fields[:]) codec.fields[0] = HostField.{.name = HostTextData("key"), .value = HostScalar("u64", cast(s64)data.key)} codec.fields[1].name = HostTextData("bounds") codec.fields[1].value = WidgetEncodeRectangle(data.bounds, *codec.bounds) @@ -70,7 +73,7 @@ WidgetDecodeBandChartProps :: (value: HostValue, codec: *WidgetBandChartPropsCod } WidgetValidBandChartProps :: (value: HostValue) -> bool { - if !HostRecordValid(*value, "BandChartProps") { return false } + if !HostRecordValid(*value, "band_chart_props.BandChartProps") { return false } if !HostFieldScalarValid(*value, 0, "key", "u64", cast(s32)HostUnsigned) { return false } if !HostFieldRecordValid(*value, 1, "bounds", WidgetValidRectangle) { return false } if !HostFieldScalarValid(*value, 2, "semantic_label", "string", cast(s32)HostString) { return false } @@ -90,12 +93,15 @@ WidgetValidBandChartProps :: (value: HostValue) -> bool { return true } +WidgetTypeBandChartPoint :: "band_chart_props.BandChartPoint" +WidgetSliceTypeBandChartPoint :: "[]band_chart_props.BandChartPoint" + WidgetBandChartPointCodec :: struct { fields: [4]HostField } WidgetEncodeBandChartPoint :: (data: BandChartPoint, codec: *WidgetBandChartPointCodec) -> HostValue { - value := HostRecordValue("BandChartPoint", codec.fields[:]) + value := HostRecordValue("band_chart_props.BandChartPoint", codec.fields[:]) codec.fields[0] = HostField.{.name = HostTextData("slot"), .value = HostScalar("s32", cast(s64)data.slot)} codec.fields[1] = HostField.{.name = HostTextData("value"), .value = HostValue.{.kind = cast(s32)HostReal, .type_name = HostTextData("float32"), .real = cast(float64)data.value}} codec.fields[2] = HostField.{.name = HostTextData("good"), .value = HostScalar("s32", cast(s64)data.good)} @@ -115,7 +121,7 @@ WidgetDecodeBandChartPoint :: (value: HostValue, codec: *WidgetBandChartPointCod } WidgetValidBandChartPoint :: (value: HostValue) -> bool { - if !HostRecordValid(*value, "BandChartPoint") { return false } + if !HostRecordValid(*value, "band_chart_props.BandChartPoint") { return false } if !HostFieldScalarValid(*value, 0, "slot", "s32", cast(s32)HostInteger) { return false } if !HostFieldScalarValid(*value, 1, "value", "float32", cast(s32)HostReal) { return false } if !HostFieldScalarValid(*value, 2, "good", "s32", cast(s32)HostInteger) { return false } @@ -123,12 +129,15 @@ WidgetValidBandChartPoint :: (value: HostValue) -> bool { return true } +WidgetTypeBandChartBand :: "band_chart_props.BandChartBand" +WidgetSliceTypeBandChartBand :: "[]band_chart_props.BandChartBand" + WidgetBandChartBandCodec :: struct { fields: [6]HostField } WidgetEncodeBandChartBand :: (data: BandChartBand, codec: *WidgetBandChartBandCodec) -> HostValue { - value := HostRecordValue("BandChartBand", codec.fields[:]) + value := HostRecordValue("band_chart_props.BandChartBand", codec.fields[:]) codec.fields[0] = HostField.{.name = HostTextData("from"), .value = HostScalar("s32", cast(s64)data.from)} codec.fields[1] = HostField.{.name = HostTextData("low"), .value = HostValue.{.kind = cast(s32)HostReal, .type_name = HostTextData("float32"), .real = cast(float64)data.low}} codec.fields[2] = HostField.{.name = HostTextData("high"), .value = HostValue.{.kind = cast(s32)HostReal, .type_name = HostTextData("float32"), .real = cast(float64)data.high}} @@ -152,7 +161,7 @@ WidgetDecodeBandChartBand :: (value: HostValue, codec: *WidgetBandChartBandCodec } WidgetValidBandChartBand :: (value: HostValue) -> bool { - if !HostRecordValid(*value, "BandChartBand") { return false } + if !HostRecordValid(*value, "band_chart_props.BandChartBand") { return false } if !HostFieldScalarValid(*value, 0, "from", "s32", cast(s32)HostInteger) { return false } if !HostFieldScalarValid(*value, 1, "low", "float32", cast(s32)HostReal) { return false } if !HostFieldScalarValid(*value, 2, "high", "float32", cast(s32)HostReal) { return false } @@ -162,12 +171,15 @@ WidgetValidBandChartBand :: (value: HostValue) -> bool { return true } +WidgetTypeBandChartResult :: "band_chart_props.BandChartResult" +WidgetSliceTypeBandChartResult :: "[]band_chart_props.BandChartResult" + WidgetBandChartResultCodec :: struct { fields: [1]HostField } WidgetEncodeBandChartResult :: (data: BandChartResult, codec: *WidgetBandChartResultCodec) -> HostValue { - value := HostRecordValue("BandChartResult", codec.fields[:]) + value := HostRecordValue("band_chart_props.BandChartResult", codec.fields[:]) codec.fields[0] = HostField.{.name = HostTextData("shown"), .value = HostScalar("s32", cast(s64)data.shown)} return value } @@ -181,7 +193,7 @@ WidgetDecodeBandChartResult :: (value: HostValue, codec: *WidgetBandChartResultC } WidgetValidBandChartResult :: (value: HostValue) -> bool { - if !HostRecordValid(*value, "BandChartResult") { return false } + if !HostRecordValid(*value, "band_chart_props.BandChartResult") { return false } if !HostFieldScalarValid(*value, 0, "shown", "s32", cast(s32)HostInteger) { return false } return true } diff --git a/tests/band_chart_host_provider.zi b/tests/band_chart_host_provider.zi index 6c01850..8d4ead3 100644 --- a/tests/band_chart_host_provider.zi +++ b/tests/band_chart_host_provider.zi @@ -72,3 +72,42 @@ RasterImage :: (path: string, texture_id: u32, source: Rectangle, destination: R unused radius unused tint } + +// Required raster capabilities; these charts never queue these operations. + +#program_export +RasterTextRotated :: (value: string, x: s32, y: s32, font: s32, color: Color, clip: Rectangle, origin: Vector2, rotation: float32, outer_clip: Rectangle, outer_clipped: bool, emphasis: bool, italic: bool) { + unused value + unused x + unused y + unused font + unused color + unused clip + unused origin + unused rotation + unused outer_clip + unused outer_clipped + unused emphasis + unused italic + band_chart_host_shapes += 1000 +} + +#program_export +RasterImageMesh :: (path: string, texture_id: u32, source: Rectangle, points: []Vector2, columns: s32, rows: s32, clip: Rectangle, tint: Color) { + unused path + unused texture_id + unused source + unused points + unused columns + unused rows + unused clip + unused tint + band_chart_host_shapes += 1000 +} + + +#program_export +MeasureGlyphLineHeight :: (font: s32, typeface: string) -> s32 { + unused typeface + return font +} diff --git a/tests/plot_widget_host.zi b/tests/plot_widget_host.zi index 9b669c0..ab0db1d 100644 --- a/tests/plot_widget_host.zi +++ b/tests/plot_widget_host.zi @@ -120,3 +120,42 @@ PlotLineCount :: () -> s32 { return lines } #program_export PlotLabels :: () -> s32 { return labels } + +// Required raster capabilities; these charts never queue these operations. + +#program_export +RasterTextRotated :: (value: string, x: s32, y: s32, font: s32, color: Color, clip: Rectangle, origin: Vector2, rotation: float32, outer_clip: Rectangle, outer_clipped: bool, emphasis: bool, italic: bool) { + unused value + unused x + unused y + unused font + unused color + unused clip + unused origin + unused rotation + unused outer_clip + unused outer_clipped + unused emphasis + unused italic + failed = true +} + +#program_export +RasterImageMesh :: (path: string, texture_id: u32, source: Rectangle, points: []Vector2, columns: s32, rows: s32, clip: Rectangle, tint: Color) { + unused path + unused texture_id + unused source + unused points + unused columns + unused rows + unused clip + unused tint + failed = true +} + + +#program_export +MeasureGlyphLineHeight :: (font: s32, typeface: string) -> s32 { + unused typeface + return font +} diff --git a/ziran.lock b/ziran.lock index 0d4924e..94df6f6 100644 --- a/ziran.lock +++ b/ziran.lock @@ -19,6 +19,15 @@ "source": true, "url": "https://github.com/libsdl-org/SDL.git" }, + { + "commit": "f26a552247e2cd367fd33def6860d903cac6ab8a", + "dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"}, + "dependency_refs": {"av1": "bd278217e2bac754d868b3d6502eac4257658d4b", "dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199"}, + "id": "p274c2dd6d03a7c0c", + "name": "avif", + "ref": "f26a552247e2cd367fd33def6860d903cac6ab8a", + "url": "https://github.com/ziranlang/avif.git" + }, { "commit": "1844042d1ca751e62e61df7617dba19c98588339", "dependencies": {}, @@ -64,13 +73,13 @@ "url": "https://aomedia.googlesource.com/aom" }, { - "commit": "f84c162594e518cb306bfd0ce41783ad55b6c730", - "dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"}, - "dependency_refs": {"av1": "bd278217e2bac754d868b3d6502eac4257658d4b", "dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199"}, - "id": "p872d871f84f2284f", - "name": "avif", - "ref": "f84c162594e518cb306bfd0ce41783ad55b6c730", - "url": "https://github.com/ziranlang/avif.git" + "commit": "1b290f19aa1a4069c908a4687f04458c58a2b658", + "dependencies": {"audio": "pb46a53117b2530ce", "avif": "p274c2dd6d03a7c0c", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "raylib": "pcc7aa76725f2fb2f", "sdl3": "p16cd0434af3dff7b", "webp": "pa068bd09450b2a80"}, + "dependency_refs": {"audio": "ce5837f80e8ce6cb8d2d9f77915095d764da3485", "avif": "f26a552247e2cd367fd33def6860d903cac6ab8a", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "raylib": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "02145a00a1f0df2a111da04a75f3fef260883897"}, + "id": "p8f647d8005d4c2a7", + "name": "kryon", + "ref": "1b290f19aa1a4069c908a4687f04458c58a2b658", + "url": "https://github.com/kryonlabs/kryon.git" }, { "commit": "02145a00a1f0df2a111da04a75f3fef260883897", @@ -90,6 +99,24 @@ "source": true, "url": "https://github.com/videolan/dav1d.git" }, + { + "commit": "ce5837f80e8ce6cb8d2d9f77915095d764da3485", + "dependencies": {"dr_libs": "pb7c2dd1c09da0c1c", "libopus": "pe1fe9bbe80bf1d6d", "libsamplerate": "p0dd67588478f9a3e", "stb": "pe4a63e2d6e0424e7"}, + "dependency_refs": {"dr_libs": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c", "libopus": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6", "libsamplerate": "c96f5e3de9c4488f4e6c97f59f5245f22fda22f7", "stb": "9600522de53973336fa033a289858a4354cbb04c"}, + "id": "pb46a53117b2530ce", + "name": "audio", + "ref": "ce5837f80e8ce6cb8d2d9f77915095d764da3485", + "url": "https://github.com/ziranlang/audio.git" + }, + { + "commit": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c", + "dependencies": {}, + "id": "pb7c2dd1c09da0c1c", + "name": "dr_libs", + "ref": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c", + "source": true, + "url": "https://github.com/mackron/dr_libs.git" + }, { "commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "dependencies": {}, @@ -99,15 +126,6 @@ "source": true, "url": "https://github.com/raysan5/raylib.git" }, - { - "commit": "f5eed1e6c817997d51508f9c3c7b948a0bb4ad0b", - "dependencies": {"libopus": "pe1fe9bbe80bf1d6d", "libsamplerate": "p0dd67588478f9a3e"}, - "dependency_refs": {"libopus": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6", "libsamplerate": "c96f5e3de9c4488f4e6c97f59f5245f22fda22f7"}, - "id": "pd258d453b63edc1f", - "name": "audio", - "ref": "f5eed1e6c817997d51508f9c3c7b948a0bb4ad0b", - "url": "https://github.com/ziranlang/audio.git" - }, { "commit": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6", "dependencies": {}, @@ -118,23 +136,23 @@ "url": "https://github.com/xiph/opus.git" }, { - "commit": "0fbdc938841475589d21384e441087ca98e2cc11", - "dependencies": {"audio": "pd258d453b63edc1f", "avif": "p872d871f84f2284f", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "raylib": "pcc7aa76725f2fb2f", "sdl3": "p16cd0434af3dff7b", "webp": "pa068bd09450b2a80"}, - "dependency_refs": {"audio": "f5eed1e6c817997d51508f9c3c7b948a0bb4ad0b", "avif": "f84c162594e518cb306bfd0ce41783ad55b6c730", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "raylib": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "02145a00a1f0df2a111da04a75f3fef260883897"}, - "id": "pf9c1f08949b64182", - "name": "kryon", - "ref": "master", - "url": "https://github.com/kryonlabs/kryon.git" + "commit": "9600522de53973336fa033a289858a4354cbb04c", + "dependencies": {}, + "id": "pe4a63e2d6e0424e7", + "name": "stb", + "ref": "9600522de53973336fa033a289858a4354cbb04c", + "source": true, + "url": "https://github.com/nothings/stb.git" } ], "root": { - "dependencies": {"kryon": "pf9c1f08949b64182"}, - "dependency_refs": {"kryon": "master"}, + "dependencies": {"kryon": "p8f647d8005d4c2a7"}, + "dependency_refs": {"kryon": "1b290f19aa1a4069c908a4687f04458c58a2b658"}, "name": "plot" }, "toolchain": { - "commit": "c6bf5cbf5dc6782f819580b3db488d223002076e", - "ref": "master", + "commit": "d17c7aa1e093066ef03f307a45f6966dd9b29d4b", + "ref": "d17c7aa1e093066ef03f307a45f6966dd9b29d4b", "url": "https://github.com/ziranlang/ziran.git" } } diff --git a/ziran.toml b/ziran.toml index 3ae8c2b..a9dd385 100644 --- a/ziran.toml +++ b/ziran.toml @@ -6,11 +6,11 @@ bridge_modules = ["app"] [toolchain] git = "https://github.com/ziranlang/ziran.git" -ref = "master" +ref = "d17c7aa1e093066ef03f307a45f6966dd9b29d4b" [dependencies.kryon] git = "https://github.com/kryonlabs/kryon.git" -ref = "master" +ref = "1b290f19aa1a4069c908a4687f04458c58a2b658" [exports] # Public module is Plot; the lowercase export is retained for older imports.