diff --git a/.gitignore b/.gitignore index 346c11d..3cef7be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ zig-cache/ -zig-out/ -*.mp3 -*.wav -build_runner.zig diff --git a/README.md b/README.md index 7d4da76..31e1e17 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,12 @@ glitch art "framework", ???????? language??? something? - zig at https://ziglang.org - libc, lilv and libsndfile - graphicsmagick for the `rotate` command - - readline (for repl) ## plugin depedencies (only required at runtime): - lv2 default plugins (most specifically the eg-amp plugin, will likely be there by default) - the SWH plugins ( https://github.com/swh/lv2 ) - the Invada Studio plugins ( https://launchpad.net/invada-studio/ ) - - abGate plugin - - MDA plugins - - Calf plugins ```bash # build and install @@ -45,23 +41,3 @@ scritcher examples/noise.scri blah.bmp // blah_g1.bmp, the second saves to blah_g2.bmp, etc. $your_image_viewer blah_g1.bmp ``` - -# using the repl - -using repl works via `scritcher repl scri_file.scri input_image.bmp` - -you type commands as you'd write the specific scritcher commands -(`doc/README.md`), with four repl-specific ones (semicolons do not apply): - - `push`, to push the last written command to the queue - - `save`, to write the queue to the given `scri_file.scri` file - - `list`, to print the current contents of the queue - - `quit`, to exit - -After a non-REPL command, such as an effect, the program pointed by -`SCRITCHER_RUNNER` will run as argument to the `runqs` command. By default, -the program run will be `ristretto` (as it is my preffered image viewer, -considering it was able to handle when some images went broke) - -this allows for quicker iteration of commands, as you can type a command, see -the image changes as fast as possible, tweak its arguments, -and when satisfied, `push` it, and work on the next command, etc. diff --git a/build.zig b/build.zig index 5f2ff5e..eebcb55 100644 --- a/build.zig +++ b/build.zig @@ -1,73 +1,37 @@ -const std = @import("std"); - -fn setupLinks(step: *std.Build.Step.Compile) void { - step.linkSystemLibrary("c"); +const builds = @import("std").build; +const Builder = @import("std").build.Builder; +fn setupLinks(step: *builds.LibExeObjStep) void { step.linkSystemLibrary("lilv-0"); step.linkSystemLibrary("sndfile"); - step.linkSystemLibrary("readline"); + + // TODO 2.30 glibc + step.linkSystemLibrary("c"); step.linkSystemLibrary("GraphicsMagickWand"); step.linkSystemLibrary("GraphicsMagick"); - step.addIncludePath(.{ .path = "/usr/include/GraphicsMagick" }); - step.addIncludePath(.{ .path = "/usr/include" }); - - const possible_lilv_include_dirs = [_][]const u8{ - "/usr/include/lilv-0/lilv", - "/usr/include/lilv-0", - }; - - var found_any_lilv = false; - - for (possible_lilv_include_dirs) |possible_lilv_dir| { - var possible_dir = std.fs.cwd().openDir(possible_lilv_dir, .{}) catch |err| { - std.debug.print("possible lilv {s} fail: {s}\n", .{ possible_lilv_dir, @errorName(err) }); - continue; - }; - - possible_dir.close(); - found_any_lilv = true; - - std.debug.print("found lilv at '{s}'\n", .{possible_lilv_dir}); - step.addIncludePath(.{ .path = possible_lilv_dir }); - } - - if (!found_any_lilv) { - std.debug.print("No LILV library was found :(\n", .{}); - @panic("no lilv found"); - } + step.addIncludeDir("/usr/include/lilv-0"); + step.addIncludeDir("/usr/include/GraphicsMagick"); } -pub fn build(b: *std.Build) void { - const target = b.standardTargetOptions(.{}); - const optimize = b.standardOptimizeOption(.{}); +pub fn build(b: *Builder) void { + const mode = b.standardReleaseOptions(); + const exe = b.addExecutable("scritcher", "src/main.zig"); + exe.setBuildMode(mode); + exe.install(); - const exe = b.addExecutable(.{ - .name = "scritcher", - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, - }); setupLinks(exe); - b.installArtifact(exe); - const run_cmd = b.addRunArtifact(exe); + const test_obj_step = b.addTest("src/main.zig"); + setupLinks(test_obj_step); - if (b.args) |args| { - run_cmd.addArgs(args); - } + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - const test_step = b.addTest(.{ - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, - }); - setupLinks(test_step); - const run_unit_tests = b.addRunArtifact(test_step); - const test_cmd = b.step("test", "run unit tests"); - test_cmd.dependOn(&run_unit_tests.step); + const test_step = b.step("test", "Run tests"); + test_step.dependOn(&test_obj_step.step); } diff --git a/doc/README.md b/doc/README.md index c02ebda..8330e43 100644 --- a/doc/README.md +++ b/doc/README.md @@ -23,8 +23,7 @@ where in the file you want the plugin to be ran. so, if you did `plugin 3 1...`, it would split the file in 3, then get the part that is of index 1 (starting at 0). -**Keep in mind parts can start from either top or bottom of the image, -it depends of the file format** +**Keep in mind parts start from the bottom of the file.** ## `load path_or_arg` @@ -47,6 +46,9 @@ Parameters: Run the DJ EQ plugin from the SWH plugins. +Parameters: + - `lo`: Low range + `lo`, `mid`, and `hi` are the respective dB gains for each frequency range. All three ranges accept gains from -70dB to +6dB. @@ -167,11 +169,6 @@ Rotate the image by `deg` degrees, filling the resulting triangles with `bgfill` `bgfill` is a hex string, e.g `#000000`. -## `embed split index path_to_file` - -embed an audio file in the given image. the file is opened with libsndfile, -which means some formats, like mp3, will not be opened. - ## `quicksave` Save the file on the same directory of the file specified by `load`, but @@ -179,201 +176,3 @@ with a suffix on the filename (before extension). Doing consecutive `quicksave`s will not overwrite any files, the suffixes will just be different. - -## `gate split index switch threshold attack hold decay gaterange` - -**TODO:** find good parameters - - - switch (bool): 0..1, default 0 - - threshold (dB): -70..12, default -70 - - attack (ms): 0.1..500, default 30 - - hold (ms): 5..3000, default 500 - - decay (ms): 5..4000, default 1000 - - gaterange (dB): -90..-20, default -90 - -## `detune split index detune mix output latency` - -> A low-quality stereo pitch shifter for the sort of chorus and detune effects found on multi-effects hardware. - - - detune (cents, left channel is lowered in pitch, right channel is raised): 0..1, default 0.2 - - mix (wet/dry mix): 0..1, default 0.9 - - output (level trim): 0..1, default 0.5 - - latency (trade-off between latency and low-freq response): 0..1, default 0.5 - -other presets: - - stereo detune: 0.2 0.9 0.5 0.5 - - out of tune: 0.8 0.7 0.5 0.5 - - -## `overdrive split index drive muffle output` - -> Possible uses include adding body to drum loops, fuzz guitar, and that 'standing outside a nightclub' sound. This plug does not simulate valve distortion, and any attempt to process organ sounds through it will be extremely unrewarding! - - - drive (amount of distortion): 0..1, default 0 - - muffle (gentle low-pass filter): 0..1, default 0 - - output (level trim): 0..1, default 0.5 - -## `degrade split index headroom quant rate post_filt non_lin output` - -> Sample quality reduction - -**NOTE:** finding the right parameters is HARD for this plugin. - - - headroom (peak clipping threshold): 0..1, default 0.8 - - quant (bit depth, typically 8 or below for "telephone" quality): 0..1, default 0.5 - - rate (sample rate): 0..1, default 0.65 - - post_filt (low-pass filter to muffle the distortion): 0..1, default 0.9 - - non_lin (additional harmonic distortion "thickening"): 0..1, default 0.58 - - output: 0..1, default 0.5 - -## `repsycho split index tune fine decay thresh hold mix quality` - -**NOTE:** HARD to find good parameters - - - tune (coarse tune, semitones): 0..1, default 1 - - fine (fine tune, cents): 0..1, default 1 - - decay (adjust envelope of each trunk, a fast decay can be useful while setting up): 0..1, default 0.5 - - thresh (trigger level to divide the input into chunks): 0..1, default 0.6 - - hold (minimum chunk length): 0..1, default 0.45 - - mix (mix original signal with output): 0..1, default 1 - - quality (quality, bool. the high=1 setting uses smoother pitch-shifting and allows stereo): 0..1, default 0 - -## `talkbox split index wet dry carrier quality` - -> High resolution vocoder - - - wet: 0..1, default 0.5 - - dry: 0..1, default 0 - - carrier: 0..1, default 0 - - quality: 0..1, default 1 - -## `dyncomp split index enable hold inputgain threshold ratio attack release gain_min gain_max rms` - - - enable (bool): 0..1, default 1 - - hold (bool): 0..1, default 0 - - inputgain (dB): -10..30, default 0 - - threshold (dB): -50..-10, default -30 - - ratio (???): 0..1, default 0 - - attack (seconds): 0.001..0.1, default 0.01 - - release (seconds): 0.03..3.0, default 0.3 - - gain\_min (dB): -20..40 - - gain\_max (dB): -20..40 - - rms (signal level, dB): -80..10 - -## `thruzero split index rate mix feedback depth_mod` - -> Tape flanger and ADT - -> This plug simulates tape-flanging, where two copies of a signal cancel out completely as the tapes pass each other. It can also be used for other "modulated delay" effects such as phasing and simple chorusing. - - - rate (modulation rate, set to minimum for static comb filtering): 0..1, default 0.3 - - mix (wet/dry mix, set to 50% for complete cancelling): 0..1, default 0.47 - - feedback (add positive or negative feedback for harsher or "ringing" sound): 0..1, default 0.3 - - depth_mod (modulation depth, set to less than 100% to limit build up of low frequencies with feedback): 0..1, default 1 - -## `foverdrive split index drive` - -Fast Overdrive from SWH plugins. - - - drive: 1..3, default 1 - -## `gverb split index roomsize revtime damping drylevel earlylevel taillevel` - -GVerb algorithm from SWH plugins. - - - roomsize (meters): 1..300, default 75.75 - - revtime (reverb time, seconds): 0.1..30, default 7.575 - - damping: 0..1, default 0.5 - - inputbandwidth: 0..1, default 0.75 - - drylevel (dB): -70..0, default 0 - - earlylevel (dB): -70..0, default 0 - - taillevel (dB): -70..0, default -17.5 - -## `invert split index` - -> A utility plugin that inverts the signal, also (wrongly) known as a 180 degree phase shift. - -## `tapedelay split index speed da_db t1d t1a_db...` - -**TODO:** gives 0 output - -> Correctly models the tape motion and some of the smear effect, there is no simulation fo the head saturation yet, as I don't have a good model of it. When I get one I will add it. - -> The way the tape accelerates and decelerates gives a nicer delay effect for many purposes. - - - speed (inches/sec, 1=normal): 0..10, default 1 - - da\_db (dry level, dB): -90..0, default -90 - - t1d (tap 1 distance, inches): 0..4, default 0 - - t1a\_db (tap 1 level, dB): -90..0, default 0 - - t2d (tap 2 distance, inches): 0..4, default 1 - - t2a\_db (tap 2 level, dB): -90..0, default -90 - - t3d (tap 3 distance, inches): 0..4, default 2 - - t3a\_db (tap 3 level, dB): -90..0, default -90 - - t4d (tap 4 distance, inches): 0..4, default 3 - - t4a\_db (tap 4 level, dB): -90..0, default -90 - -## `moddelay split index base` - -> A delay whose tap can be modulated at audio rate. - - - base (base delay, seconds): 0..1, default 1 - -## `multichorus split index min_delay mod_depth mod_rate stereo voices vphase amount dry freq freq2 q overlap level_in level_out lfo` - -Calf Multi Chorus - - - `min_delay` (ms): 0.1..10, default 5 - - `mod_depth` (ms): 0.1..10, default 6 - - `mod_rate` (hz): 0.1..20, default 0.1 - - `stereo` (degrees): 0..360, default 180 - - `voices`: 1..8, default 4 - - `vphase` (inter-voice phase, degrees): 0..360, default 64 - - `amount`: 0..4, default 0.5 - - `dry`: 0..4, default 0.5 - - `freq` (center frq 1, hz): 10..20000, default 100 - - `freq2` (center frq 2, hz): 10..20000, default 5000 - - `q` (???): 0.125..8, default 0.125 - - `overlap`: 0..1, default 0.75 - - `level_in` (Input Gain): 0.0156250..64, default 1 - - `level_out` (Output Gain): 0.0156250..64, default 1 - - `lfo` (toggle): 0..1, default 1 - -## `saturator split index bypass level_in level_out mix drive blend lp_pre_freq hp_pre_fre lp_post_freq hp_post_freq p_freq p_level p_q pre post` - - - `bypass` (toggle): 0..1, default 0 - - `level_in` (Input Gain): 0.0156250..64, default 1 - - `level_out` (Output Gain): 0.0156250..64, default 1 - - `mix`: 0..1, default 1 - - `drive` (saturation, coef): 0.1..10, default 5 - - `blend` (coef): -10..10, default 10 - - `lp_pre_freq` (lowpass, hz): 10..20000, default 20000 - - `hp_pre_freq` (highpass, hz): 10..20000, default 10 - - `lp_post_freq` (lowpass, hz): 10..20000, default 20000 - - `hp_post_freq` (highpass, hz): 10..20000, default 10 - - `p_freq` (Tone, hz): 80..8000, default 2000 - - `p_level` (Amount): 0.0625..16, default 1 - - `p_q` (???, coef): 0.1..10, default 1 - - `pre` (Activate Pre, toggle): 0..1, default 0 - - `post` (Activate Post, toggle): 0..1, default 0 - -## `vintagedelay split index ...` - - - `level_in` (Input Gain): 0.0156250..64, default 1 - - `level_out` (Output Gain): 0.0156250..64, default 1 - - `subdiv` (int): 1..16, default 4 - - `time_l` (int): 1..16, default 3 - - `time_r` (int): 1..16, default 5 - - `feedback`: 0..1, default 0.5 - - `amount` (Wet): 0..4, default 0.25 - - `mix_mode` (enum): Stereo=0, Ping-Pong=1, L then R=2, R then L=3, default 1 - - `medium` (enum): Plain=0, Tape=1, Old Tape=2, default 1 - - `dry` (dry): 0..4, default 1 - - `width` (stereo width, strict): -1..1, default 1 - - `fragmentation` (enum): Repeating=0, Pattern=1, default 0 - - `pbeats` (Pattern Beats, int): 1..8, default 4 - - `pfrag` (Pattern Fragmentation, int): 1..8, default 4 - - `timing` (enum): BPM=0, ms=1, Hz=2, Sync=3, default 0 - - `bpm`: 30..300, default 120 - - `ms` (int): 10..2000, default 500 - - `hz`: 0.01..100, default 2 - - `bpm_host` (strict): 1..300, default 120 diff --git a/examples/degrade.scri b/examples/degrade.scri deleted file mode 100644 index 09c04c0..0000000 --- a/examples/degrade.scri +++ /dev/null @@ -1,8 +0,0 @@ -load :0; -degrade 8 1 0.8 0.5 0.65 0.9 0.58 0.5; -degrade 8 2 0.1 1 0.65 0.5 0.5 0.4; -degrade 8 3 0.1 1 0.65 0.9 0.58 0.5; -degrade 8 4 0 1 1 0 0 1; -degrade 8 5 0 1 1 0 0 0; -degrade 8 6 0 0 0 0 0 0; -quicksave; diff --git a/examples/detune.scri b/examples/detune.scri deleted file mode 100644 index 269e80d..0000000 --- a/examples/detune.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -detune 3 1 0.2 0.9 0.5 0.5; -quicksave; diff --git a/examples/dyncomp.scri b/examples/dyncomp.scri deleted file mode 100644 index d1d9e7b..0000000 --- a/examples/dyncomp.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -dyncomp 3 1 1 0 0 -30 0 0.01 0.3 0 0 0; -quicksave; diff --git a/examples/embed.scri b/examples/embed.scri deleted file mode 100644 index b78f7c9..0000000 --- a/examples/embed.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -embed 3 1 ./file.wav; -quicksave; diff --git a/examples/foverdrive.scri b/examples/foverdrive.scri deleted file mode 100644 index a4ac785..0000000 --- a/examples/foverdrive.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -foverdrive 3 1 100; -quicksave; diff --git a/examples/gate.scri b/examples/gate.scri deleted file mode 100644 index 7299d00..0000000 --- a/examples/gate.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -gate 3 1 0 -70 30 500 1000 -90; -quicksave; diff --git a/examples/gverb.scri b/examples/gverb.scri deleted file mode 100644 index f9aced0..0000000 --- a/examples/gverb.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -gverb 3 1 75.75 7.575 0.5 0.75 0 0 -17.5; -quicksave; diff --git a/examples/invert.scri b/examples/invert.scri deleted file mode 100644 index bd7b695..0000000 --- a/examples/invert.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -invert 3 1; -quicksave; diff --git a/examples/mbeq.scri b/examples/mbeq.scri index de0eef4..9afbee1 100644 --- a/examples/mbeq.scri +++ b/examples/mbeq.scri @@ -1,3 +1,3 @@ load :0; -mbeq 3 1 0 0 0 0.3 0 0 7 0 0 0 0 0 0.1 0 0; +mbeq 3 1 1 4 0.2 2.1; quicksave; diff --git a/examples/moddelay.scri b/examples/moddelay.scri deleted file mode 100644 index 202cafb..0000000 --- a/examples/moddelay.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -moddelay 3 1 1; -quicksave; diff --git a/examples/multichorus.scri b/examples/multichorus.scri deleted file mode 100644 index 2355d16..0000000 --- a/examples/multichorus.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -multichorus 3 1 5 6 0.1 180 4 64 0.5 0.5 100 5000 0.125 0.75 1 1 1; -quicksave; diff --git a/examples/overdrive.scri b/examples/overdrive.scri deleted file mode 100644 index 585f8ad..0000000 --- a/examples/overdrive.scri +++ /dev/null @@ -1,5 +0,0 @@ -load :0; -overdrive 5 1 0.5 0 0.4; -overdrive 5 2 0.6 0.2 0.3; -overdrive 5 3 0.7 0.3 0.2; -quicksave; diff --git a/examples/pitchscaler.scri b/examples/pitch.scri similarity index 100% rename from examples/pitchscaler.scri rename to examples/pitch.scri diff --git a/examples/repsycho.scri b/examples/repsycho.scri deleted file mode 100644 index 757c728..0000000 --- a/examples/repsycho.scri +++ /dev/null @@ -1,8 +0,0 @@ -load :0; -repsycho 8 1 1 1 0.5 0.6 0.45 1 0; -repsycho 8 2 1 1 1 0.6 0.45 1 0; -repsycho 8 3 1 1 0.5 0.8 0.45 1 0; -repsycho 8 4 1 1 0.5 0.6 0.1 1 0; -repsycho 8 5 1 1 0.5 0.6 0.45 0.5 0; -repsycho 8 6 1 1 0.5 0.6 0.45 1 1; -quicksave; diff --git a/examples/rflanger.scri b/examples/rflanger.scri deleted file mode 100644 index f1fe18d..0000000 --- a/examples/rflanger.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -rflanger 3 1 2.5 1; -quicksave; diff --git a/examples/saturator.scri b/examples/saturator.scri deleted file mode 100644 index 864c27a..0000000 --- a/examples/saturator.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -saturator 3 1 0 1 1 1 5 10 20000 10 20000 10 2000 1 1 0 0; -quicksave; diff --git a/examples/talkbox.scri b/examples/talkbox.scri deleted file mode 100644 index 2f3c386..0000000 --- a/examples/talkbox.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -talkbox 3 1 0.5 0 0 1; -quicksave; diff --git a/examples/tapedelay.scri b/examples/tapedelay.scri deleted file mode 100644 index 4b5d8c0..0000000 --- a/examples/tapedelay.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -tapedelay 3 1 1 -90 0 0 1 -90 2 -90 3 -90; -quicksave; diff --git a/examples/thruzero.scri b/examples/thruzero.scri deleted file mode 100644 index 99b4899..0000000 --- a/examples/thruzero.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -thruzero 3 1 0.3 0.47 0.3 1; -quicksave; diff --git a/examples/vintagedelay.scri b/examples/vintagedelay.scri deleted file mode 100644 index 156638a..0000000 --- a/examples/vintagedelay.scri +++ /dev/null @@ -1,3 +0,0 @@ -load :0; -vintagedelay 3 1 1 1 4 3 5 0.5 0.25 1 1 1 1 0 4 4 0 120 500 2 120; -quicksave; diff --git a/src/bmp_valid.zig b/src/bmp_valid.zig deleted file mode 100644 index 6e256e8..0000000 --- a/src/bmp_valid.zig +++ /dev/null @@ -1,25 +0,0 @@ -const std = @import("std"); -const log = std.log.scoped(.scritcher_bmp); -pub const BMPValidError = error{InvalidMagic}; - -const VALID_MAGICS = [_][]const u8{ - "BM", - "BA", - "CI", - "CP", - "IC", - "PT", -}; - -pub fn magicValid(magic: []const u8) !void { - var valid = false; - - for (VALID_MAGICS) |valid_magic| { - if (std.mem.eql(u8, magic, valid_magic)) valid = true; - } - - if (!valid) { - log.debug("\tINVALID HEADER: '{s}'", .{magic}); - return BMPValidError.InvalidMagic; - } -} diff --git a/src/custom.zig b/src/custom.zig index d942a3b..3f57a4b 100644 --- a/src/custom.zig +++ b/src/custom.zig @@ -2,9 +2,7 @@ const std = @import("std"); const lv2 = @import("lv2_helpers.zig"); const plugins = @import("plugin.zig"); -const image = @import("image.zig"); -const log = std.log.scoped(.scritcher_custom); const c = lv2.c; const RunBuffers = plugins.RunBuffers; @@ -12,20 +10,23 @@ const RunBuffers = plugins.RunBuffers; pub const RandomNoise = struct { r: std.rand.DefaultPrng, rand_buf: ?[]f32 = null, - allocator: ?std.mem.Allocator = null, + allocator: ?*std.mem.Allocator = null, cnt: usize = 0, pub fn init( - allocator: std.mem.Allocator, - params: anytype, + allocator: *std.mem.Allocator, + params: *plugins.ParamMap, ) ?RandomNoise { - var r = std.rand.DefaultPrng.init(params.seed); + const seed = @floatToInt(u64, params.get("seed").?.value); + const fillbytes = @floatToInt(usize, params.get("fill_bytes").?.value); - if (params.fill_bytes > 0) { - var rand_buf = allocator.alloc(f32, params.fill_bytes) catch return null; + var r = std.rand.DefaultPrng.init(seed); - for (rand_buf, 0..) |_, idx| { - rand_buf[idx] = r.random().float(f32); + if (fillbytes > 0) { + var rand_buf = allocator.alloc(f32, fillbytes) catch return null; + + for (rand_buf) |_, idx| { + rand_buf[idx] = r.random.float(f32); } return RandomNoise{ @@ -52,7 +53,7 @@ pub const RandomNoise = struct { bufs.out[0] = rand_buf[self.cnt]; self.cnt += 1; } else { - bufs.out[0] = self.r.random().float(f32); + bufs.out[0] = self.r.random.float(f32); } } }; @@ -60,20 +61,23 @@ pub const RandomNoise = struct { pub const WildNoise = struct { r: std.rand.DefaultPrng, rand_buf: ?[]f32 = null, - allocator: ?std.mem.Allocator = null, + allocator: ?*std.mem.Allocator = null, cnt: usize = 0, pub fn init( - allocator: std.mem.Allocator, - params: anytype, + allocator: *std.mem.Allocator, + params: *plugins.ParamMap, ) ?WildNoise { - var r = std.rand.DefaultPrng.init(params.seed); + const seed = @floatToInt(u64, params.get("seed").?.value); + const fillbytes = @floatToInt(usize, params.get("fill_bytes").?.value); - if (params.fill_bytes > 0) { - var rand_buf = allocator.alloc(f32, params.fill_bytes) catch return null; + var r = std.rand.DefaultPrng.init(seed); - for (rand_buf, 0..) |_, idx| { - rand_buf[idx] = @as(f32, @floatFromInt(r.random().int(u1))); + if (fillbytes > 0) { + var rand_buf = allocator.alloc(f32, fillbytes) catch return null; + + for (rand_buf) |_, idx| { + rand_buf[idx] = @intToFloat(f32, r.random.int(u1)); } return WildNoise{ @@ -99,7 +103,7 @@ pub const WildNoise = struct { bufs.out[0] = rand_buf[self.cnt]; self.cnt += 1; } else { - bufs.out[0] = @as(f32, @floatFromInt(self.r.random().int(u1))); + bufs.out[0] = @intToFloat(f32, self.r.random.int(u1)); } } }; @@ -112,81 +116,18 @@ pub const Write = struct { data: f32, pub fn init( - allocator: std.mem.Allocator, - params: anytype, + allocator: *std.mem.Allocator, + params: *plugins.ParamMap, ) Write { - _ = allocator; + const data = params.get("data").?; return Write{ - .data = params.data, + .data = data.value, }; } - pub fn deinit(self: *Write) void { - _ = self; - } + pub fn deinit(self: *Write) void {} pub fn run(self: *Write, bufs: *RunBuffers) void { bufs.out[0] = self.data; } }; - -pub const Embed = struct { - allocator: std.mem.Allocator, - filepath: []const u8, - - sndfile: *c.SNDFILE = undefined, - buf: []f32 = undefined, - - pub fn init(allocator: std.mem.Allocator, params: anytype) @This() { - return Embed{ - .allocator = allocator, - .filepath = params.path, - }; - } - - pub fn setup(self: *@This()) !void { - var in_fmt = c.SF_INFO{ - .frames = @as(c_int, 0), - .samplerate = @as(c_int, 0), - .channels = @as(c_int, 0), - .format = @as(c_int, 0), - .sections = @as(c_int, 0), - .seekable = @as(c_int, 0), - }; - - self.sndfile = try image.sopen( - self.allocator, - self.filepath, - c.SFM_READ, - &in_fmt, - ); - - image.sseek(self.sndfile, 0); - - self.buf = try self.allocator.alloc(f32, @as(usize, @intCast(in_fmt.channels))); - } - - pub fn deinit(self: *@This()) void { - _ = self; - } - - pub fn run(self: *@This(), bufs: *RunBuffers) void { - const read_bytes = c.sf_readf_float(self.sndfile, self.buf.ptr, 1); - - if (read_bytes == 0) { - bufs.out[0] = bufs.in[0]; - return; - } - - if (read_bytes < 0) { - const st: i32 = c.sf_error(self.sndfile); - log.debug("Failed to read {s} ({s})", .{ - self.filepath, - c.sf_error_number(st), - }); - return; - } - - bufs.out[0] = bufs.in[0] + self.buf[0]; - } -}; diff --git a/src/image.zig b/src/image.zig index e20cfe7..16e682f 100644 --- a/src/image.zig +++ b/src/image.zig @@ -1,11 +1,13 @@ const std = @import("std"); const lv2 = @import("lv2_helpers.zig"); const c = lv2.c; -const bmp = @import("bmp_valid.zig"); +const custom = @import("custom.zig"); -const log = std.log.scoped(.scritcher_image); const plugins = @import("plugin.zig"); +/// Approximate size of the BMP header, in bytes. +pub const BMPHeaderSize: usize = 82000; + /// Buffer size for main image copying. pub const BufferSize: usize = 300000; @@ -20,109 +22,98 @@ pub const ImageError = error{ }; /// Low level integration function with libsndfile. -pub fn sopen( - allocator: std.mem.Allocator, +fn sopen( + allocator: *std.mem.Allocator, path: []const u8, mode: i32, fmt: *c.SF_INFO, ) !*c.SNDFILE { - const cstr_path = try allocator.dupeZ(u8, path); + var cstr_path = try std.cstr.addNullByte(allocator, path); defer allocator.free(cstr_path); - const file = c.sf_open(cstr_path.ptr, mode, fmt); + var file = c.sf_open(cstr_path.ptr, mode, fmt); const st: i32 = c.sf_error(file); if (st != 0) { - log.debug("Failed to open {s} ({s})", .{ + std.debug.warn( + "Failed to open {} ({})\n", path, c.sf_error_number(st), - }); + ); return ImageError.OpenFail; } - const frames_on_end = c.sf_seek(file, 0, c.SEEK_END); - _ = c.sf_seek(file, 0, c.SEEK_SET); - try std.testing.expectEqual(fmt.frames, frames_on_end); - - const frames_on_end_by_end = c.sf_seek(file, frames_on_end, c.SEEK_SET); - try std.testing.expectEqual(frames_on_end, frames_on_end_by_end); - - log.debug("frames on end: {}, frame on end (2): {}", .{ frames_on_end, frames_on_end_by_end }); - return file.?; } -pub fn swrite(file: *c.SNDFILE, buf: [*]f32, frames: i64) !void { +fn swrite(file: *c.SNDFILE, buf: [*]f32, frames: i64) !void { const count = c.sf_writef_float(file, buf, frames); if (count != frames) { - log.debug("Wanted to write {}, got {}", .{ frames, count }); + std.debug.warn("Wanted to read {}, got {}\n", frames, count); return ImageError.WriteFail; } } -pub fn sseek(file: *c.SNDFILE, offset: usize) void { - const offset_i64 = @as(i64, @intCast(offset)); - const frames = c.sf_seek(file, offset_i64, c.SEEK_SET); - const frames_current = c.sf_seek(file, 0, c.SEEK_CUR); - std.debug.assert(frames == frames_current); - - if (frames != offset_i64) { - log.debug("failed to seek to {} (seeked {} frames, offset_i64={})", .{ offset, frames, offset_i64 }); +fn sseek(file: *c.SNDFILE, offset: usize) void { + const frames = c.sf_seek(file, @intCast(i64, offset), c.SEEK_SET); + if (frames != @intCast(i64, offset)) { + std.debug.warn("failed to seek to {}\n", offset); } } -/// Caller owns the returned memory. -pub fn temporaryName(allocator: std.mem.Allocator) ![]u8 { - const template_start = "/temp/temp_"; - const template = "/tmp/temp_XXXXXXXXXXXXXXXXXXXXX"; - var nam = try allocator.alloc(u8, template.len); - std.mem.copyForwards(u8, nam, template); +fn sf_tell(file: *c.SNDFILE) i64 { + var frames = c.sf_seek(file, 0, c.SEEK_CUR); + std.debug.warn("\t\t{} frames\n", frames); + return -frames; +} - const seed = @as(u64, @truncate(@as(u128, @bitCast(std.time.nanoTimestamp())))); - var r = std.rand.DefaultPrng.init(seed); +/// Caller owns the returned memory. +pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 { + const template_start = "/temp/temp_"; + const template = "/tmp/temp_XXXXXXXXXXX"; + var nam = try allocator.alloc(u8, template.len); + std.mem.copy(u8, nam, template); + + var r = std.rand.DefaultPrng.init(std.time.timestamp()); var fill = nam[template_start.len..nam.len]; var i: usize = 0; while (i < 100) : (i += 1) { + // generate a random uppercase letter, that is, 65 + random number. - for (fill, 0..) |_, f_idx| { - const idx = @as(u8, @intCast(r.random().uintLessThan(u5, 24))); - const letter = @as(u8, 65) + idx; + for (fill) |_, f_idx| { + var idx = @intCast(u8, r.random.uintLessThan(u5, 24)); + var letter = u8(65) + idx; fill[f_idx] = letter; } // if we fail to access it, we assume it doesn't exist and return it. - var tmp_file: std.fs.File = std.fs.cwd().openFile( - nam, - .{ .mode = .read_only }, - ) catch |err| { - if (err == error.FileNotFound) return nam else continue; + std.fs.File.access(nam) catch |err| { + if (err == error.FileNotFound) { + return nam; + } }; - - // if we actually found someone, close the handle so that we don't - // get EMFILE later on. - tmp_file.close(); } return error.TempGenFail; } -pub fn mkSfInfo() c.SF_INFO { +fn mkSfInfo() c.SF_INFO { return c.SF_INFO{ - .frames = @as(c_int, 0), - .samplerate = @as(c_int, 44100), - .channels = @as(c_int, 1), + .frames = c_int(0), + .samplerate = c_int(44100), + .channels = c_int(1), .format = c.SF_FORMAT_ULAW | c.SF_FORMAT_RAW | c.SF_ENDIAN_BIG, - .sections = @as(c_int, 0), - .seekable = @as(c_int, 0), + .sections = c_int(0), + .seekable = c_int(0), }; } pub const Image = struct { - allocator: std.mem.Allocator, + allocator: *std.mem.Allocator, /// Pointer to the underlying libsndfile's SNDFILE struct. sndfile: *c.SNDFILE, @@ -137,73 +128,50 @@ pub const Image = struct { curpath: []const u8, /// Open a BMP image for later. - pub fn open(allocator: std.mem.Allocator, path: []const u8) !*Image { + pub fn open(allocator: *std.mem.Allocator, path: []const u8) !*Image { var in_fmt = mkSfInfo(); - const sndfile = try sopen(allocator, path, c.SFM_READ, &in_fmt); - const image = try allocator.create(Image); + var sndfile = try sopen(allocator, path, c.SFM_READ, &in_fmt); + var image = try allocator.create(Image); - std.debug.assert(in_fmt.frames > @as(i64, 0)); - std.debug.assert(in_fmt.seekable == @as(i32, 1)); + std.debug.assert(in_fmt.frames > i64(0)); + std.debug.assert(in_fmt.seekable == i32(1)); image.* = Image{ .allocator = allocator, .sndfile = sndfile, .path = path, .curpath = path, - .frames = @as(usize, @intCast(in_fmt.frames)), - }; - - return image; - } - - pub fn clone(self: *Image) !*Image { - var in_fmt = mkSfInfo(); - // clone sndfile - const sndfile = try sopen(self.allocator, self.curpath, c.SFM_READ, &in_fmt); - std.debug.assert(self.frames == @as(usize, @intCast(in_fmt.frames))); - - const image = try self.allocator.create(Image); - - std.debug.assert(in_fmt.frames > @as(i64, 0)); - std.debug.assert(in_fmt.seekable == @as(i32, 1)); - - image.* = Image{ - .allocator = self.allocator, - .sndfile = sndfile, - .path = self.path, - .curpath = self.curpath, - .frames = @as(usize, @intCast(in_fmt.frames)), + .frames = @intCast(usize, in_fmt.frames), }; return image; } pub fn close(self: *Image) void { - const st: i32 = c.sf_close(self.sndfile); + //self.allocator.free(self.path); + //self.allocator.free(self.curpath); + var st: i32 = c.sf_close(self.sndfile); + if (st != 0) { - log.debug("Failed to close {s} ({s})", .{ + std.debug.warn( + "Failed to close {} ({})\n", self.path, c.sf_error_number(st), - }); + ); } - - self.allocator.free(self.path); - self.allocator.free(self.curpath); - - var allocator = self.allocator; - self.* = undefined; - allocator.destroy(self); } pub fn read(self: *Image, file_chans: c_int, buf: []f32) bool { - const n_read: c.sf_count_t = c.sf_readf_float(self.sndfile, buf.ptr, 1); - const buf_chans = @as(c_int, @intCast(buf.len)); + var file = file_opt.?; + + const n_read: c.sf_count_t = c.sf_readf_float(file, buf.ptr, 1); + const buf_chans = @intCast(c_int, buf.len); var i = file_chans - 1; while (i < buf_chans) : (i += 1) { //buf[@intCast(usize, i)] = buf[i % file_chans]; - buf[@as(usize, @intCast(i))] = buf[@as(usize, @intCast(@mod(i, file_chans)))]; + buf[@intCast(usize, i)] = buf[@intCast(usize, @mod(i, file_chans))]; } return n_read == 1; @@ -227,7 +195,7 @@ pub const Image = struct { sseek(out_file, start); while (i <= end) : (i += buf.len) { - log.debug("\t\ti={d}, buf.len={d}, end={d}", .{ i, buf.len, end }); + std.debug.warn("\t\ti={}, buf.len={}, end={}\n", i, buf.len, end); sseek(self.sndfile, i); sseek(out_file, i); @@ -237,13 +205,13 @@ pub const Image = struct { var view: []f32 = buf[0..buf.len]; if (bytes_until_end < buf.len) { - read_bytes = c.sf_readf_float(self.sndfile, buf.ptr, @as(i64, @intCast(bytes_until_end))); + read_bytes = c.sf_readf_float(self.sndfile, buf.ptr, @intCast(i64, bytes_until_end)); view = buf[0..bytes_until_end]; } else { - read_bytes = c.sf_readf_float(self.sndfile, buf.ptr, @as(i64, @intCast(buf.len))); + read_bytes = c.sf_readf_float(self.sndfile, buf.ptr, @intCast(i64, buf.len)); } - try swrite(out_file, view.ptr, @as(i64, @intCast(view.len))); + try swrite(out_file, view.ptr, @intCast(i64, view.len)); } sseek(self.sndfile, end); @@ -252,8 +220,8 @@ pub const Image = struct { fn getSeekPos(self: *Image, position: plugins.Position) plugins.SeekPos { const file_end = self.frames; - const seek_pos = position.seekPos(file_end); - log.debug("\tstart {d} end {d}", .{ seek_pos.start, seek_pos.end }); + var seek_pos = position.seekPos(file_end); + std.debug.warn("\tstart {} end {}\n", seek_pos.start, seek_pos.end); return seek_pos; } @@ -261,33 +229,10 @@ pub const Image = struct { var in_fmt = mkSfInfo(); self.sndfile = try sopen(self.allocator, path, c.SFM_READ, &in_fmt); - // std.testing.expectEqual(self.frames, @intCast(usize, in_fmt.frames)); - self.curpath = path; - self.frames = @as(usize, @intCast(in_fmt.frames)); + self.frames = @intCast(usize, in_fmt.frames); - log.debug("\timage: reopened on '{s}' (frames={d}, fmt.frames={d})", .{ - self.curpath, - self.frames, - in_fmt.frames, - }); - } - - pub fn checkValid(self: *Image) !void { - var file = try std.fs.cwd().openFile(self.path, .{ .mode = .read_only }); - defer file.close(); - - // main bmp header: - // 2 bytes for magic header - // 4 bytes for size in bytes - // 2 bytes ? - // 2 bytes ? - // 4 bytes for pixel array offset - var magic = [2]u8{ 0, 0 }; - _ = try file.read(&magic); - - if (std.mem.endsWith(u8, self.path, ".bmp")) - try bmp.magicValid(&magic); + std.debug.warn("\timage: reopened on '{}'\n", self.curpath); } /// Run a plugin over the image. @@ -306,48 +251,50 @@ pub const Image = struct { defer ctx.deinit(); var ports = try lv2.setupPorts(&ctx); - defer ctx.allocator.free(ports); if (ctx.n_audio_in > 2) { - log.debug("plugin <{s}> has more than two inputs.", .{plugin_uri}); + std.debug.warn("plugin <{}> has more than two inputs.\n", plugin_uri); return ImageError.InvalidPlugin; } if (ctx.n_audio_out > 2) { - log.debug("plugin <{s}> has more than two outputs.", .{plugin_uri}); + std.debug.warn("plugin <{}> has more than two outputs.\n", plugin_uri); return ImageError.InvalidPlugin; } // now, for each param for the plugin, we find its port, and set // the value for the port there. - for (params.items) |param| { - const sym_cstr = try self.allocator.dupeZ(u8, param.sym); + var it = params.iterator(); + + while (it.next()) |param| { + var sym_cstr = try std.cstr.addNullByte(self.allocator, param.sym); defer self.allocator.free(sym_cstr); - const sym = c.lilv_new_string(ctx.world, sym_cstr.ptr); - const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse { - log.debug("assert fail: symbol {s} not found on port", .{param.sym}); + var sym = c.lilv_new_string(ctx.world, sym_cstr.ptr); + const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse blk: { + std.debug.warn("assert fail: symbol {} not found on port\n", param.sym); return ImageError.InvalidSymbol; }; c.lilv_node_free(sym); - const idx = c.lilv_port_get_index(ctx.plugin, port); - log.debug("\tset sym={s}, idx={d} to val={}", .{ + var idx = c.lilv_port_get_index(ctx.plugin, port); + std.debug.warn( + "\tset sym={}, idx={} to val={}\n", param.sym, idx, param.value, - }); + ); (&ports[idx]).value = param.value; } // now we need to generate a temporary file and put the output of // running the plugin on that file - const tmpnam = try temporaryName(self.allocator); - log.debug("\trunning plugin from '{s}' to '{s}'", .{ self.curpath, tmpnam }); + var tmpnam = try temporaryName(self.allocator); + std.debug.warn("\trunning plugin from '{}' to '{}'\n", self.curpath, tmpnam); var out_fmt = mkSfInfo(); - const out_file = try sopen(self.allocator, tmpnam, c.SFM_WRITE, &out_fmt); + var out_file = try sopen(self.allocator, tmpnam, c.SFM_WRITE, &out_fmt); var rctx = try plugins.RunContext.init(self.allocator, ctx.plugin); defer rctx.deinit(); @@ -370,34 +317,27 @@ pub const Image = struct { // pre-plugin copy, merged with bmp header copy try self.copyBytes( out_file, - @as(usize, 0), + usize(0), seek_pos.start, ); sseek(self.sndfile, seek_pos.start); var i: usize = seek_pos.start; - log.debug("\tseek pos start: {d} end: {d}", .{ seek_pos.start, seek_pos.end }); + std.debug.warn("\tseek pos start: {} end: {}\n", seek_pos.start, seek_pos.end); - var inbuf = &rctx.buffers.in; - const outbuf = &rctx.buffers.out; + var inbuf = rctx.buffers.in; + var outbuf = rctx.buffers.out; while (i <= seek_pos.end) : (i += 1) { - inbuf[0] = 0; - inbuf[1] = 0; - - const read_bytes = c.sf_readf_float(self.sndfile, inbuf, 1); + const read_bytes = c.sf_readf_float(self.sndfile, inbuf.ptr, 1); if (read_bytes == 0) { - log.debug("WARN! reached EOF at idx={d}", .{i}); + std.debug.warn("WARN! reached EOF at idx={}\n", i); break; } - // trick plugins into having correct stereo signal from - // my mono input - inbuf[1] = inbuf[0]; - lv2.lilv_instance_run(rctx.instance, 1); - try swrite(out_file, outbuf, 1); + try swrite(out_file, outbuf.ptr, 1); } sseek(self.sndfile, seek_pos.end); @@ -414,24 +354,23 @@ pub const Image = struct { _ = c.sf_close(self.sndfile); try self.reopen(tmpnam); - try self.checkValid(); - const time_taken = timer.read(); - log.debug("\ttook {d:.2}ms running plugin", .{time_taken / std.time.us_per_ms}); + var time_taken = timer.read(); + std.debug.warn("\ttook {d:.2}ms running plugin\n", time_taken / std.time.millisecond); } pub fn saveTo(self: *Image, out_path: []const u8) !void { - log.debug("\timg: copy from '{s}' to '{s}'", .{ self.curpath, out_path }); - try std.fs.copyFileAbsolute(self.curpath, out_path, .{}); + std.debug.warn("\timg: copy from '{}' to '{}'\n", self.curpath, out_path); + try std.fs.copyFile(self.curpath, out_path); } pub fn runCustomPlugin( self: *Image, comptime Plugin: type, position: plugins.Position, - extra: anytype, + params: *plugins.ParamMap, ) !void { - const plugin_opt: ?Plugin = Plugin.init(self.allocator, extra); + var plugin_opt: ?Plugin = Plugin.init(self.allocator, params); if (plugin_opt == null) { return ImageError.PluginLoadFail; } @@ -439,22 +378,17 @@ pub const Image = struct { var plugin = plugin_opt.?; defer plugin.deinit(); - const decls = comptime std.meta.declarations(Plugin); - inline for (decls) |decl| { - if (comptime std.mem.eql(u8, decl.name, "setup")) { - try plugin.setup(); - } - } - // the code here is a copypaste of runPlugin() without the specific // lilv things. - const tmpnam = try temporaryName(self.allocator); - log.debug("\trunning CUSTOM plugin from '{s}' to '{s}'", .{ self.curpath, tmpnam }); + var tmpnam = try temporaryName(self.allocator); + std.debug.warn("\trunning CUSTOM plugin from '{}' to '{}'\n", self.curpath, tmpnam); var out_fmt = mkSfInfo(); - const out_file = try sopen(self.allocator, tmpnam, c.SFM_WRITE, &out_fmt); + var out_file = try sopen(self.allocator, tmpnam, c.SFM_WRITE, &out_fmt); + + var bufs = try plugins.RunBuffers.init(self.allocator); + defer bufs.deinit(); - var bufs = plugins.RunBuffers{}; const seek_pos = self.getSeekPos(position); // make sure we start from 0 @@ -469,27 +403,27 @@ pub const Image = struct { // pre-plugin copy, merged with bmp header copy try self.copyBytes( out_file, - @as(usize, 0), + usize(0), seek_pos.start, ); sseek(self.sndfile, seek_pos.start); var i: usize = seek_pos.start; - log.debug("\tseek pos start: {d} end: {d}", .{ seek_pos.start, seek_pos.end }); + std.debug.warn("\tseek pos start: {} end: {}\n", seek_pos.start, seek_pos.end); - const inbuf = &bufs.in; - const outbuf = &bufs.out; + var inbuf = bufs.in; + var outbuf = bufs.out; while (i <= seek_pos.end) : (i += 1) { - const read_bytes = c.sf_readf_float(self.sndfile, inbuf, 1); + const read_bytes = c.sf_readf_float(self.sndfile, bufs.in.ptr, 1); if (read_bytes == 0) { - log.debug("WARN! reached EOF at idx={d}", .{i}); + std.debug.warn("WARN! reached EOF at idx={}\n", i); break; } plugin.run(&bufs); - try swrite(out_file, outbuf, 1); + try swrite(out_file, bufs.out.ptr, 1); } sseek(self.sndfile, seek_pos.end); @@ -507,6 +441,5 @@ pub const Image = struct { // reopen the file as SFM_READ so we can run plugin chains etc try self.reopen(tmpnam); - try self.checkValid(); } }; diff --git a/src/lang.zig b/src/lang.zig index 31e5a73..26ed175 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -1,646 +1,330 @@ const std = @import("std"); const plugin = @import("plugin.zig"); -const custom = @import("custom.zig"); -const log = std.log.scoped(.scritcher_lang); -pub const ParseError = error{ParseFail}; +pub const ParseError = error{ + NoCommandGiven, + UnknownCommand, + ArgRequired, + FloatParseFail, + ParseFail, +}; pub const CommandType = enum { - /// "LV2 Commands" are commands that receive split, index, and then receive - /// any f64 arguments. - lv2_command, + Noop, + Load, + Quicksave, + RunQS, - custom_command, + Amp, + RFlanger, + Eq, + Phaser, + Mbeq, + Chorus, + PitchScaler, + Reverb, + Highpass, + Delay, + Vinyl, + RevDelay, + + Noise, + WildNoise, + Write, + + Rotate, }; -fn LV2Command( - comptime tag: Command.Tag, - comptime plugin_url: []const u8, - comptime LV2Parameters: type, -) type { - return struct { - pub const base_tag = tag; - pub const command_type = CommandType.lv2_command; - pub const lv2_url = plugin_url; - - base: Command, - split: usize, - index: usize, - parameters: LV2Parameters, - }; -} - -fn CustomCommand( - comptime tag: Command.Tag, - comptime Plugin: type, - comptime PluginParameters: type, -) type { - return struct { - pub const base_tag = tag; - pub const command_type = CommandType.custom_command; - pub const plugin_type = Plugin; - - base: Command, - split: usize, - index: usize, - parameters: PluginParameters, - }; -} - pub const Command = struct { - tag: Tag, + command: CommandType, + args: ArgList, + cur_idx: usize = 0, - pub const Tag = enum { - noop, - load, - quicksave, - runqs, - - amp, - rflanger, - eq, - phaser, - mbeq, - chorus, - pitchscaler, - reverb, - highpass, - delay, - vinyl, - revdelay, - gate, - detune, - overdrive, - degrade, - repsycho, - talkbox, - dyncomp, - thruzero, - foverdrive, - gverb, - invert, - tapedelay, - moddelay, - multichorus, - saturator, - vintagedelay, - - noise, - wildnoise, - write, - embed, - - rotate, - }; - - pub fn tagToType(comptime tag: Tag) type { - return switch (tag) { - .noop => Noop, - .load => Load, - .quicksave => Quicksave, - .runqs => RunQS, - - .amp => Amp, - .rflanger => RFlanger, - .eq => Eq, - .phaser => Phaser, - .mbeq => Mbeq, - .chorus => Chorus, - .pitchscaler => Pitchscaler, - .reverb => Reverb, - .highpass => Highpass, - .delay => Delay, - .vinyl => Vinyl, - .revdelay => Revdelay, - .gate => Gate, - .detune => Detune, - .overdrive => Overdrive, - .degrade => Degrade, - .repsycho => Repsycho, - .talkbox => Talkbox, - .dyncomp => Dyncomp, - .thruzero => Thruzero, - .foverdrive => Foverdrive, - .gverb => Gverb, - .invert => Invert, - .tapedelay => Tapedelay, - .moddelay => Moddelay, - .multichorus => Multichorus, - .saturator => Saturator, - .vintagedelay => Vintagedelay, - - .noise => Noise, - .wildnoise => Wildnoise, - .write => Write, - .embed => Embed, - - .rotate => Rotate, - }; + pub fn print(self: *const Command) void { + std.debug.warn("cmd:{}\n", self.command); } - pub fn cast(base: *const @This(), comptime T: type) ?*const T { - if (base.tag != T.base_tag) - return null; + pub fn argAt(self: *const Command, idx: usize) ![]const u8 { + const args = self.args.toSliceConst(); - //const baseInt = @intFromPtr(base); - - //log.debug("casting from {d}", .{baseInt}); - //log.debug("aligns from 8? {d}", .{baseInt % 8}); - //log.debug("align T: {d} {s}", .{ @alignOf(*T), @typeName(T) }); - //log.debug("align base: {d} {s}", .{ @alignOf(*const @This()), @typeName(@This()) }); - const base_aligned: *const @This() = @alignCast(base); - - const parented = @as(*const T, @alignCast(@fieldParentPtr("base", base_aligned))); - - const ptr: *const T = @alignCast(parented); - //log.debug("align: {d}\n", .{@alignOf(@TypeOf(ptr))}); - return ptr; - } - - pub fn print(base: *const @This()) void { - log.debug("tag: {}", .{base.tag}); - } - - pub const Noop = struct { - pub const base_tag = Tag.noop; - base: Command, - }; - - pub const Load = struct { - pub const base_tag = Tag.load; - base: Command, - path: []const u8, - }; - - pub const Quicksave = struct { - pub const base_tag = Tag.quicksave; - base: Command, - }; - - pub const RunQS = struct { - pub const base_tag = Tag.runqs; - base: Command, - program: []const u8, - }; - - pub const Noise = CustomCommand(Tag.noise, custom.RandomNoise, struct { - seed: u64, - fill_bytes: usize, - }); - - pub const Wildnoise = CustomCommand(Tag.wildnoise, custom.WildNoise, struct { - seed: u64, - fill_bytes: usize, - }); - - pub const Write = CustomCommand(Tag.write, custom.Write, struct { - data: f32, - }); - - pub const Embed = CustomCommand(Tag.write, custom.Embed, struct { - path: []const u8, - }); - - pub const Rotate = struct { - pub const base_tag = Tag.rotate; - base: Command, - deg: f32, - bgfill: []const u8, - }; - - pub const Amp = LV2Command( - .amp, - "http://lv2plug.in/plugins/eg-amp", - struct { gain: f32 }, - ); - - pub const RFlanger = LV2Command( - .rflanger, - "http://plugin.org.uk/swh-plugins/retroFlange", - struct { delay_depth_avg: f32, law_freq: f32 }, - ); - - pub const Eq = LV2Command( - .rflanger, - "http://plugin.org.uk/swh-plugins/dj_eq_mono", - struct { lo: f32, mid: f32, hi: f32 }, - ); - - pub const Phaser = LV2Command( - .phaser, - "http://plugin.org.uk/swh-plugins/lfoPhaser", - struct { lfo_rate: f32, lfo_depth: f32, fb: f32, spread: f32 }, - ); - - pub const Mbeq = LV2Command( - .mbeq, - "http://plugin.org.uk/swh-plugins/mbeq", - struct { - band_1: f32, - band_2: f32, - band_3: f32, - band_4: f32, - band_5: f32, - band_6: f32, - band_7: f32, - band_8: f32, - band_9: f32, - band_10: f32, - band_11: f32, - band_12: f32, - band_13: f32, - band_14: f32, - band_15: f32, - }, - ); - - pub const Chorus = LV2Command( - .chorus, - "http://plugin.org.uk/swh-plugins/multivoiceChorus", - struct { - voices: f32, - delay_base: f32, - voice_spread: f32, - detune: f32, - law_freq: f32, - attendb: f32, - }, - ); - - pub const Pitchscaler = LV2Command( - .pitchscaler, - "http://plugin.org.uk/swh-plugins/pitchScaleHQ", - struct { mult: f32 }, - ); - - pub const Reverb = LV2Command( - .reverb, - "http://invadarecords.com/plugins/lv2/erreverb/mono", - struct { - roomLength: f32, - roomWidth: f32, - roomHeight: f32, - sourceLR: f32, - sourceFB: f32, - listLR: f32, - listFB: f32, - hpf: f32, - warmth: f32, - diffusion: f32, - }, - ); - - pub const Highpass = LV2Command(.highpass, "http://invadarecords.com/plugins/lv2/filter/hpf/mono", struct { - freq: f32, - gain: f32, - noClip: f32, - }); - - pub const Delay = LV2Command(.delay, "http://plugin.org.uk/swh-plugins/delayorama", struct { - seed: f32, - gain: f32, - feedback_pc: f32, - tap_count: f32, - first_delay: f32, - delay_range: f32, - delay_scale: f32, - delay_rand_pc: f32, - gain_scale: f32, - wet: f32, - }); - - pub const Vinyl = LV2Command(.vinyl, "http://plugin.org.uk/swh-plugins/vynil", struct { - year: f32, - rpm: f32, - warp: f32, - click: f32, - wear: f32, - }); - - pub const Revdelay = LV2Command(.revdelay, "http://plugin.org.uk/swh-plugins/revdelay", struct { - delay_time: f32, - dry_level: f32, - wet_level: f32, - feedback: f32, - xfade_samp: f32, - }); - // pub const Noise= LV2Command(.,,struct{}); - pub const Gate = LV2Command(.gate, "http://hippie.lt/lv2/gate", struct { - @"switch": f32, - threshold: f32, - attack: f32, - hold: f32, - decay: f32, - gaterange: f32, - }); - pub const Detune = LV2Command(.detune, "http://drobilla.net/plugins/mda/Detune", struct { - detune: f32, - mix: f32, - output: f32, - latency: f32, - }); - pub const Overdrive = LV2Command(.overdrive, "http://drobilla.net/plugins/mda/Overdrive", struct { - drive: f32, - muffle: f32, - output: f32, - }); - pub const Degrade = LV2Command(.degrade, "http://drobilla.net/plugins/mda/Degrade", struct { - headroom: f32, - quant: f32, - rate: f32, - post_filt: f32, - non_lin: f32, - output: f32, - }); - pub const Repsycho = LV2Command(.repsycho, "http://drobilla.net/plugins/mda/RePsycho", struct { - tune: f32, - fine: f32, - decay: f32, - thresh: f32, - hold: f32, - mix: f32, - quality: f32, - }); - pub const Talkbox = LV2Command(.talkbox, "http://drobilla.net/plugins/mda/TalkBox", struct { - wet: f32, - dry: f32, - carrier: f32, - quality: f32, - }); - pub const Dyncomp = LV2Command(.dyncomp, "http://gareus.org/oss/lv2/darc#mono", struct { - enable: f32, - hold: f32, - inputgain: f32, - threshold: f32, - Ratio: f32, - attack: f32, - release: f32, - gain_min: f32, - gain_max: f32, - rms: f32, - }); - pub const Foverdrive = LV2Command(.foverdrive, "http://plugin.org.uk/swh-plugins/foverdrive", struct { - drive: f32, - }); - pub const Thruzero = LV2Command(.thruzero, "http://drobilla.net/plugins/mda/ThruZero", struct { rate: f32, mix: f32, feedback: f32, depth_mod: f32 }); - - pub const Gverb = LV2Command(.gverb, "http://plugin.org.uk/swh-plugins/gverb", struct { - roomsize: f32, - revtime: f32, - damping: f32, - inputbandwidth: f32, - drylevel: f32, - earlylevel: f32, - taillevel: f32, - }); - pub const Invert = LV2Command(.invert, "http://plugin.org.uk/swh-plugins/inv", struct {}); - pub const Tapedelay = LV2Command(.tapedelay, "http://plugin.org.uk/swh-plugins/tapeDelay", struct { - speed: f32, - da_db: f32, - - t1d: f32, - t1a_db: f32, - - t2d: f32, - t2a_db: f32, - - t3d: f32, - t3a_db: f32, - - t4d: f32, - t4a_db: f32, - }); - - pub const Moddelay = LV2Command( - .moddelay, - "http://plugin.org.uk/swh-plugins/modDelay", - struct { - base: f32, - }, - ); - - pub const Multichorus = LV2Command(.multichorus, "http://calf.sourceforge.net/plugins/MultiChorus", struct { - min_delay: f32, - mod_depth: f32, - mod_rate: f32, - stereo: f32, - voices: f32, - vphase: f32, - amount: f32, - dry: f32, - freq: f32, - freq2: f32, - q: f32, - overlap: f32, - level_in: f32, - level_out: f32, - lfo: f32, - }); - pub const Saturator = LV2Command(.saturator, "http://calf.sourceforge.net/plugins/Saturator", struct { - bypass: f32, - level_in: f32, - level_out: f32, - mix: f32, - drive: f32, - blend: f32, - lp_pre_freq: f32, - hp_pre_freq: f32, - lp_post_freq: f32, - hp_post_freq: f32, - p_freq: f32, - p_level: f32, - p_q: f32, - pre: f32, - post: f32, - }); - pub const Vintagedelay = LV2Command(.vintagedelay, "http://calf.sourceforge.net/plugins/VintageDelay", struct { - level_in: f32, - level_out: f32, - subdiv: f32, - time_l: f32, - time_r: f32, - feedback: f32, - amount: f32, - mix_mode: f32, - medium: f32, - dry: f32, - width: f32, - fragmentation: f32, - pbeats: f32, - pfrag: f32, - timing: f32, - bpm: f32, - ms: f32, - hz: f32, - bpm_host: f32, - }); -}; - -const CmdArrayList = std.ArrayList(*Command); - -pub const CommandList = struct { - list: CmdArrayList, - const Self = @This(); - - pub fn init(allocator: std.mem.Allocator) Self { - return .{ - .list = CmdArrayList.init(allocator), - }; - } - - pub fn deinit(self: *Self) void { - for (self.list.items) |cmd_ptr| { - inline for (@typeInfo(Command.Tag).Enum.fields) |field| { - if (cmd_ptr.tag == @field(Command.Tag, field.name)) { - const actual_tag = - @field(Command.Tag, field.name); - // if we find a match on the tag, we can get the type - const typ = Command.tagToType(actual_tag); - - const inner_command = cmd_ptr.cast(typ).?; - inline for (@typeInfo(typ).Struct.fields) |cmd_field| { - switch (cmd_field.type) { - []u8, []const u8 => self.list.allocator.free(@field(inner_command, cmd_field.name)), - else => {}, - } - } - } - } - - //TODO this is ian invalid free - //self.list.allocator.destroy(cmd_ptr); + if (idx > (args.len - 1)) { + std.debug.warn("Expected argument at index {}\n", idx); + return ParseError.ArgRequired; } - self.list.deinit(); + + return args[idx]; } - pub fn append(self: *Self, cmd: *Command) !void { - return try self.list.append(cmd); + pub fn usizeArgAt(self: *const Command, idx: usize) !usize { + var arg = try self.argAt(idx); + return try std.fmt.parseInt(usize, arg, 10); + } + + pub fn consumePosition(self: *Command) !plugin.Position { + self.cur_idx = 2; + return plugin.Position{ + .split = try self.usizeArgAt(0), + .index = try self.usizeArgAt(1), + }; + } + + pub fn intArgAt(self: *const Command, idx: usize) !i32 { + var arg = try self.argAt(idx); + return try std.fmt.parseInt(i32, arg, 10); + } + + pub fn floatArgAt(self: *const Command, idx: usize) !f32 { + var arg = try self.argAt(idx); + return try std.fmt.parseFloat(f32, arg); + } + + pub fn floatArgMany( + self: *const Command, + allocator: *std.mem.Allocator, + start_index: usize, + elements: usize, + default: f32, + ) ![]const f32 { + var i: usize = start_index; + var arr = std.ArrayList(f32).init(allocator); + + while (i < elements) : (i += 1) { + var value: f32 = self.floatArgAt(i) catch |err| blk: { + std.debug.warn("\tdoing default on arg {}\n", i); + break :blk default; + }; + + try arr.append(value); + } + + return arr.toSliceConst(); + } + + pub fn appendParam( + self: *Command, + params: *plugin.ParamList, + symbol: []const u8, + ) !void { + var val = try self.floatArgAt(self.cur_idx); + self.cur_idx += 1; + + try params.append(plugin.Param{ + .sym = symbol, + .value = val, + }); + } + + pub fn appendParamMap( + self: *Command, + map: *plugin.ParamMap, + symbol: []const u8, + ) !void { + var val = try self.floatArgAt(self.cur_idx); + self.cur_idx += 1; + _ = try map.put(symbol, val); } }; -/// A parser. +pub const CommandList = std.ArrayList(*Command); +pub const ArgList = std.ArrayList([]const u8); + +fn eqlu8(a: []const u8, b: []const u8) bool { + return std.mem.eql(u8, a, b); +} + +fn hashu8(key: []const u8) u32 { + var hasher = std.hash.Wyhash.init(0); + for (key) |value| { + std.hash.autoHash(&hasher, value); + } + + return @truncate(u32, hasher.final()); +} + +pub const KeywordMap = std.HashMap([]const u8, CommandType, hashu8, eqlu8); + pub const Lang = struct { - allocator: std.mem.Allocator, + allocator: *std.mem.Allocator, + keywords: KeywordMap, has_error: bool = false, line: usize = 0, - pub fn init(allocator: std.mem.Allocator) Lang { + pub fn init(allocator: *std.mem.Allocator) Lang { return Lang{ .allocator = allocator, + .keywords = KeywordMap.init(allocator), }; } pub fn deinit(self: *Lang) void { - _ = self; + self.keywords.deinit(); } - pub fn reset(self: *Lang) void { - self.has_error = false; - self.line = 0; + fn fillKeywords(self: *Lang) !void { + _ = try self.keywords.put("noop", .Noop); + _ = try self.keywords.put("load", .Load); + _ = try self.keywords.put("quicksave", .Quicksave); + _ = try self.keywords.put("runqs", .RunQS); + + _ = try self.keywords.put("amp", .Amp); + _ = try self.keywords.put("rflanger", .RFlanger); + _ = try self.keywords.put("eq", .Eq); + _ = try self.keywords.put("mbeq", .Mbeq); + _ = try self.keywords.put("phaser", .Phaser); + _ = try self.keywords.put("chorus", .Chorus); + _ = try self.keywords.put("pitchscaler", .PitchScaler); + _ = try self.keywords.put("reverb", .Reverb); + _ = try self.keywords.put("highpass", .Highpass); + _ = try self.keywords.put("delay", .Delay); + _ = try self.keywords.put("vinyl", .Vinyl); + _ = try self.keywords.put("revdelay", .RevDelay); + + // custom implementations (not lv2) + _ = try self.keywords.put("noise", .Noise); + _ = try self.keywords.put("wildnoise", .WildNoise); + _ = try self.keywords.put("write", .Write); + + // even more custom + _ = try self.keywords.put("rotate", .Rotate); } - fn doError(self: *Lang, comptime fmt: []const u8, args: anytype) void { - log.warn("ERROR! at line {}: ", .{self.line}); - log.warn(fmt, args); + pub fn getCommand(self: *Lang, stmt: []const u8) ?CommandType { + var kv_opt = self.keywords.get(stmt); + + if (kv_opt) |kv| { + return kv.value; + } else { + return null; + } + } + + // NOTE this is fallback since std.AutoHashMap does not follow + // pointers anymore (in master). + fn oldGetCommand(self: *Lang, stmt: []const u8) ?CommandType { + const commands = [_][]const u8{ + "noop", + "load", + "quicksave", + "runqs", + "amp", + "rflanger", + "eq", + "phaser", + "mbeq", + "chorus", + "pitchscaler", + "reverb", + "highpass", + "delay", + "vinyl", + "revdelay", + "noise", + "wildnoise", + "write", + "rotate", + }; + + const command_types = [_]CommandType{ + .Noop, + .Load, + .Quicksave, + .RunQS, + + .Amp, + .RFlanger, + .Eq, + .Phaser, + .Mbeq, + .Chorus, + .PitchScaler, + .Reverb, + .Highpass, + .Delay, + .Vinyl, + .RevDelay, + + .Noise, + .WildNoise, + .Write, + + .Rotate, + }; + + std.debug.assert(commands.len == command_types.len); + + for (commands) |command, idx| { + if (std.mem.eql(u8, stmt, command)) return command_types[idx]; + } + + return null; + } + + fn expectAny(self: *Lang, count: usize, args: ArgList) !void { + if (args.len != count) { + std.debug.warn("expected {} arguments, found {}\n", count, args.len); + return error.ArgRequired; + } + } + + fn expectSingle(self: *Lang, args: ArgList) !void { + return try self.expectAny(1, args); + } + + fn expectFloat(self: *Lang, count: usize, args: ArgList) !void { + var i: usize = 0; + + if (args.len != count) { + std.debug.warn("expected {} arguments, found {}\n", count, args.len); + return error.ArgRequired; + } + + while (i < count) : (i += 1) { + var arg = args.at(i); + + _ = std.fmt.parseFloat(f32, arg) catch |err| { + std.debug.warn("failed to parse f32: {}\n", err); + return error.FloatParseFail; + }; + } + } + + fn validateCommand(self: *Lang, cmd: *Command) !void { + switch (cmd.command) { + .Quicksave, .Noop => {}, + .Load, .RunQS => try self.expectSingle(cmd.args), + .Amp => try self.expectFloat(3, cmd.args), + .RFlanger => try self.expectFloat(4, cmd.args), + .Eq => try self.expectFloat(5, cmd.args), + .Phaser => try self.expectFloat(6, cmd.args), + .Mbeq => try self.expectFloat(17, cmd.args), + .Chorus => try self.expectFloat(8, cmd.args), + .PitchScaler => try self.expectFloat(3, cmd.args), + .Reverb => try self.expectFloat(12, cmd.args), + .Highpass => try self.expectFloat(5, cmd.args), + .Delay => try self.expectFloat(12, cmd.args), + .Vinyl => try self.expectFloat(7, cmd.args), + .RevDelay => try self.expectFloat(7, cmd.args), + .Noise => try self.expectFloat(4, cmd.args), + .WildNoise => try self.expectFloat(4, cmd.args), + .Write => try self.expectFloat(3, cmd.args), + .Rotate => try self.expectAny(2, cmd.args), + else => std.debug.warn("WARN unchecked command {}\n", cmd.command), + } + } + + fn doError(self: *Lang, comptime fmt: []const u8, args: ...) void { + std.debug.warn("error at line {}: ", self.line); + std.debug.warn(fmt, args); + std.debug.warn("\n"); self.has_error = true; } - fn parseCommandArguments( - self: *@This(), - comptime command_struct: type, - tok_it: *std.mem.SplitIterator(u8, .sequence), - commands: *CommandList, - ) !void { - // Based on the command struct fields, we can parse the arguments. - var cmd = try self.allocator.create(command_struct); - - // we already add the command to the list to prevent memory leaks - // by commands that error out - try commands.append(&cmd.base); - - const is_lv2_command = switch (command_struct.base_tag) { - .noop, .load, .quicksave, .runqs, .rotate => false, - else => true, - }; - - if (is_lv2_command) { - const split = tok_it.next(); - if (split == null) { - self.doError("Expected split parameter, got EOL", .{}); - return; - } - - const index = tok_it.next(); - if (index == null) { - self.doError("Expected index parameter, got EOL", .{}); - return; - } - - cmd.split = try std.fmt.parseInt(usize, split.?, 10); - cmd.index = try std.fmt.parseInt(usize, index.?, 10); - - inline for (@typeInfo(@TypeOf(cmd.parameters)).Struct.fields) |cmd_field| { - const maybe_arg = tok_it.next(); - if (maybe_arg == null) { - self.doError("Expected parameter for {s}, got nothing", .{cmd_field.name}); - return; - } - - const arg = maybe_arg.?; - const arg_value = switch (cmd_field.type) { - f32 => try std.fmt.parseFloat(f32, arg), - u64 => try std.fmt.parseInt(u64, arg, 10), - usize => try std.fmt.parseInt(usize, arg, 10), - []const u8 => @as([]const u8, try self.allocator.dupe(u8, arg)), - else => @compileError("parameter struct has unsupported type " ++ @typeName(cmd_field.field_type)), - }; - - @field(cmd.parameters, cmd_field.name) = arg_value; - } - } else { - inline for (@typeInfo(command_struct).Struct.fields) |cmd_field| { - comptime { - if (std.mem.eql(u8, cmd_field.name, "base")) { - continue; - } - } - - const arg_opt = tok_it.next(); - if (arg_opt == null) { - self.doError("Expected parameter for {s}, got nothing", .{cmd_field.name}); - return; - } - const arg = arg_opt.?; - - const argument_value = switch (cmd_field.type) { - usize => try std.fmt.parseInt(usize, arg, 10), - i32 => try std.fmt.parseInt(i32, arg, 10), - f32 => try std.fmt.parseFloat(f32, arg), - []const u8 => @as([]const u8, try self.allocator.dupe(u8, arg)), - else => @compileError("Invalid parameter type (" ++ @typeName(cmd_field.field_type) ++ ") left on command struct " ++ @typeName(command_struct) ++ "."), - }; - - log.debug("parsing {s}, arg of type {s} => {any}", .{ - @typeName(command_struct), - @typeName(@TypeOf(argument_value)), - argument_value, - }); - - @field(cmd, cmd_field.name) = argument_value; - } - } - - cmd.base.tag = command_struct.base_tag; - const command = cmd.base.cast(command_struct).?; - log.debug("cmd: {}", .{command}); - } - pub fn parse(self: *Lang, data: []const u8) !CommandList { - var splitted_it = std.mem.split(u8, data, ";"); + var splitted_it = std.mem.separate(data, ";"); + try self.fillKeywords(); var cmds = CommandList.init(self.allocator); - errdefer cmds.deinit(); while (splitted_it.next()) |stmt_orig| { self.line += 1; @@ -650,66 +334,41 @@ pub const Lang = struct { if (stmt.len == 0) continue; if (std.mem.startsWith(u8, stmt, "#")) continue; - // TODO better tokenizer instead of just tokenize(" ")...maybe???? - var tok_it = std.mem.splitSequence(u8, stmt, " "); + // TODO better tokenizer instead of just tokenize(" "); + var tok_it = std.mem.tokenize(stmt, " "); - const cmd_opt = tok_it.next(); + var cmd_opt = tok_it.next(); if (cmd_opt == null) { - self.doError("No command given", .{}); + self.doError("No command given"); continue; } - const command_string = cmd_opt.?; + var command = cmd_opt.?; - var found: bool = false; - - inline for (@typeInfo(Command).Struct.decls) |cmd_struct_decl| { - const struct_name = cmd_struct_decl.name; - const cmd_struct_type = @field(Command, struct_name); - - const info_of_info = @typeInfo(@TypeOf(cmd_struct_type)); - - switch (info_of_info) { - .Type => {}, - else => continue, - } - - const info = @typeInfo(cmd_struct_type); - - switch (info) { - .Struct => {}, - else => continue, - } - - comptime var lowered_command_name = [_]u8{0} ** struct_name.len; - var runtime_lowered_command_name = [_]u8{0} ** struct_name.len; - comptime { - for (struct_name, 0..) |c, i| { - lowered_command_name[i] = std.ascii.toLower(c); - } - } - const c_l = lowered_command_name; - std.mem.copyForwards(u8, &runtime_lowered_command_name, &c_l); - - // if we have a match, we know the proper struct type - // to use. this actually works compared to storing command_struct - // in a variable because then that variable must be comptime. - - // the drawback of this approach is that our emitted code is basically linear - // because we don't use the hashmap anymore. - // - // Attempting to use ComptimeHashMap hits compiler bugs and I'm - // not sure if we can map strings to *types* in it. - - if ((!found) and std.mem.eql(u8, &runtime_lowered_command_name, command_string)) { - found = true; - try self.parseCommandArguments(cmd_struct_type, &tok_it, &cmds); - } - } - - if (!found) { - self.doError("Unknown command '{s}' ({d} bytes)", .{ command_string, command_string.len }); + var ctype_opt = self.getCommand(command); + var ctype: CommandType = undefined; + if (ctype_opt) |ctype_val| { + ctype = ctype_val; + } else { + self.doError("Unknown command '{}' ({})", command, command.len); continue; } + + var args = ArgList.init(self.allocator); + while (tok_it.next()) |arg| { + try args.append(arg); + } + + // construct final Command based on command + var cmd_ptr = try self.allocator.create(Command); + //errdefer self.allocator.destroy(cmd_ptr); + + //cmd_ptr.* = Command{ .command = ctype, .args = args }; + //self.validateCommand(cmd_ptr) catch |err| { + // self.doError("Unknown command '{}' (length {})", command, command.len); + // continue; + //}; + + //try cmds.append(cmd_ptr); } if (self.has_error) return ParseError.ParseFail; @@ -719,18 +378,18 @@ pub const Lang = struct { }; test "noop" { - var lang = Lang.init(std.testing.allocator); + var lang = Lang.init(std.heap.direct_allocator); defer lang.deinit(); var cmds = try lang.parse("noop;"); defer cmds.deinit(); - try std.testing.expectEqual(cmds.list.items.len, 1); - try std.testing.expectEqual(cmds.list.items[0].tag, .noop); + std.testing.expectEqual(cmds.len, 1); + std.testing.expectEqual(cmds.at(0).command, .Noop); } test "load, phaser, quicksave" { - var lang = Lang.init(std.testing.allocator); + var lang = Lang.init(std.heap.direct_allocator); defer lang.deinit(); const prog = @@ -742,21 +401,8 @@ test "load, phaser, quicksave" { var cmds = try lang.parse(prog); defer cmds.deinit(); - try std.testing.expectEqual(cmds.list.items.len, 3); - try std.testing.expectEqual(cmds.list.items[0].tag, .load); - try std.testing.expectEqual(cmds.list.items[1].tag, .phaser); - try std.testing.expectEqual(cmds.list.items[2].tag, .quicksave); -} - -test "load, phaser with errors, quicksave" { - var lang = Lang.init(std.testing.allocator); - defer lang.deinit(); - - const prog = - \\load :0; - \\phaser 3 1 25; - \\quicksave; - ; - - try std.testing.expectError(error.ParseFail, lang.parse(prog)); + std.testing.expectEqual(cmds.len, 3); + std.testing.expectEqual(cmds.at(0).command, .Load); + std.testing.expectEqual(cmds.at(1).command, .Phaser); + std.testing.expectEqual(cmds.at(2).command, .Quicksave); } diff --git a/src/lv2_helpers.zig b/src/lv2_helpers.zig index a59babd..d9a89f5 100644 --- a/src/lv2_helpers.zig +++ b/src/lv2_helpers.zig @@ -1,12 +1,10 @@ const std = @import("std"); const plugin = @import("plugin.zig"); -const log = std.log.scoped(.scritcher_lv2); - pub const c = @cImport({ @cInclude("sndfile.h"); @cInclude("lilv/lilv.h"); - @cInclude("lv2.h"); + @cInclude("lv2/core/lv2.h"); }); pub fn Lv2Core(comptime ns: []const u8) []const u8 { @@ -23,7 +21,7 @@ const LV2_CORE__connectionOptional = Lv2Core("#connectionOptional"); pub fn lilv_instance_connect_port( instance: [*c]c.LilvInstance, port_index: u32, - data_location: ?*anyopaque, + data_location: ?*c_void, ) void { instance.?.*.lv2_descriptor.?.*.connect_port.?(instance.?.*.lv2_handle, port_index, data_location); } @@ -61,44 +59,42 @@ pub const Port = struct { /// Setup ports for a given plugin. Gives an array to pointers of Port structs. /// This setup is required so we link the plugin to the ports later on, and /// also link our buffers, and control values. -/// -/// Caller owns returned memory. pub fn setupPorts(ctx: *plugin.Context) ![]Port { - const world = ctx.world; + var world = ctx.world; const n_ports: u32 = c.lilv_plugin_get_num_ports(ctx.plugin); var ports = try ctx.allocator.alloc(Port, n_ports); - for (ports, 0..) |_, idx| { - const port: *Port = &ports[idx]; + for (ports) |_, idx| { + var port: *Port = &ports[idx]; port.* = Port{ .lilv_port = null, .ptype = .Control, - .index = @as(f32, 0), - .value = @as(f32, 0), + .index = f32(0), + .value = f32(0), .is_input = false, .optional = false, }; } - const values: []f32 = try ctx.allocator.alloc(f32, n_ports); + var values: []f32 = try ctx.allocator.alloc(f32, n_ports); defer ctx.allocator.free(values); c.lilv_plugin_get_port_ranges_float(ctx.plugin, null, null, values.ptr); - const lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr).?; - //defer std.heap.c_allocator.destroy(lv2_InputPort); + var lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr); + defer std.heap.c_allocator.destroy(lv2_InputPort); - const lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr).?; - //defer std.heap.c_allocator.destroy(lv2_OutputPort); + var lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr); + defer std.heap.c_allocator.destroy(lv2_OutputPort); - const lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr).?; - //defer std.heap.c_allocator.destroy(lv2_AudioPort); + var lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr); + defer std.heap.c_allocator.destroy(lv2_AudioPort); - const lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr).?; - //defer std.heap.c_allocator.destroy(lv2_ControlPort); + var lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr); + defer std.heap.c_allocator.destroy(lv2_ControlPort); - const lv2_connection_string = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr).?; - //defer std.heap.c_allocator.destroy(lv2_connection_string); + var lv2_connectionOptional = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr); + defer std.heap.c_allocator.destroy(lv2_connectionOptional); var i: u32 = 0; while (i < n_ports) : (i += 1) { @@ -110,17 +106,17 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port { port.index = i; if (std.math.isNan(values[i])) { - port.value = @as(f32, 0); + port.value = f32(0); } else { port.value = values[i]; } - port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connection_string); + port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connectionOptional); if (c.lilv_port_is_a(ctx.plugin, lport, lv2_InputPort)) { port.is_input = true; } else if (!c.lilv_port_is_a(ctx.plugin, lport, lv2_OutputPort) and !port.optional) { - log.debug("Port {d} is neither input or output", .{i}); + std.debug.warn("Port {} is neither input or output\n", i); return error.UnassignedIOPort; } @@ -136,7 +132,7 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port { ctx.n_audio_out += 1; } } else if (!port.optional) { - log.debug("Port {d} has unsupported type", .{i}); + std.debug.warn("Port {} has unsupported type\n", i); return error.UnsupportedPortType; } } diff --git a/src/magick.zig b/src/magick.zig index ab59f0a..fbaeef7 100644 --- a/src/magick.zig +++ b/src/magick.zig @@ -2,12 +2,9 @@ const std = @import("std"); const images = @import("image.zig"); -const log = std.log.scoped(.scritcher_magick); const Image = images.Image; -const mc = @cImport({ - @cInclude("wand/magick_wand.h"); -}); +const mc = @import("magick_wand.zig"); pub const MagickContext = struct { wand: *mc.MagickWand, @@ -15,7 +12,7 @@ pub const MagickContext = struct { pub fn init() !MagickContext { mc.InitializeMagick(null); - const wand = mc.NewMagickWand(); + var wand = mc.NewMagickWand(); if (wand == null) return error.WandCreateFail; return MagickContext{ @@ -29,7 +26,6 @@ pub const MagickContext = struct { } pub fn doErr(self: *MagickContext) !void { - _ = self; return error.WandError; } }; @@ -38,10 +34,10 @@ fn magickLoad(image: *Image) !MagickContext { var mctx = try MagickContext.init(); errdefer mctx.deinit(); - const curpath = try image.allocator.dupeZ(u8, image.curpath); + var curpath = try std.cstr.addNullByte(image.allocator, image.curpath); defer image.allocator.free(curpath); - log.debug("loading '{s}'", .{curpath}); + std.debug.warn("loading '{}'\n", curpath); if (mc.MagickReadImage(mctx.wand, curpath.ptr) != 1) return error.MagickReadFail; @@ -52,16 +48,16 @@ fn magickLoad(image: *Image) !MagickContext { fn magickSave(image: *Image, wand: *mc.MagickWand) !void { const allocator = image.allocator; - const tmpnam = try images.temporaryName(allocator); - const c_tmpnam = try allocator.dupeZ(u8, tmpnam); + var tmpnam = try images.temporaryName(allocator); + var c_tmpnam = try std.cstr.addNullByte(allocator, tmpnam); defer allocator.free(c_tmpnam); - log.debug("\tmagick: saving to '{s}'..", .{c_tmpnam}); + std.debug.warn("\tmagick: saving to '{}'..", c_tmpnam); if (mc.MagickWriteImage(wand, c_tmpnam.ptr) != 1) return error.MagickWriteFail; - log.debug("OK", .{}); + std.debug.warn("OK\n"); try image.reopen(tmpnam); } @@ -72,7 +68,7 @@ pub fn runRotate(image: *Image, deg: f32, bgfill: []const u8) !void { var mctx = try magickLoad(image); defer mctx.deinit(); - const bg = mc.NewPixelWand(); + var bg = mc.NewPixelWand(); defer mc.DestroyPixelWand(bg); if (mc.PixelSetColor(bg, bgfill.ptr) != 1) diff --git a/src/magick_wand.zig b/src/magick_wand.zig new file mode 100644 index 0000000..426dc06 --- /dev/null +++ b/src/magick_wand.zig @@ -0,0 +1,4124 @@ +pub const struct___va_list_tag = extern struct { + gp_offset: c_uint, + fp_offset: c_uint, + overflow_arg_area: ?*c_void, + reg_save_area: ?*c_void, +}; +pub const __builtin_va_list = [1]struct___va_list_tag; +pub const va_list = __builtin_va_list; +pub const __gnuc_va_list = __builtin_va_list; +pub const __u_char = u8; +pub const __u_short = c_ushort; +pub const __u_int = c_uint; +pub const __u_long = c_ulong; +pub const __int8_t = i8; +pub const __uint8_t = u8; +pub const __int16_t = c_short; +pub const __uint16_t = c_ushort; +pub const __int32_t = c_int; +pub const __uint32_t = c_uint; +pub const __int64_t = c_long; +pub const __uint64_t = c_ulong; +pub const __int_least8_t = __int8_t; +pub const __uint_least8_t = __uint8_t; +pub const __int_least16_t = __int16_t; +pub const __uint_least16_t = __uint16_t; +pub const __int_least32_t = __int32_t; +pub const __uint_least32_t = __uint32_t; +pub const __int_least64_t = __int64_t; +pub const __uint_least64_t = __uint64_t; +pub const __quad_t = c_long; +pub const __u_quad_t = c_ulong; +pub const __intmax_t = c_long; +pub const __uintmax_t = c_ulong; +pub const __dev_t = c_ulong; +pub const __uid_t = c_uint; +pub const __gid_t = c_uint; +pub const __ino_t = c_ulong; +pub const __ino64_t = c_ulong; +pub const __mode_t = c_uint; +pub const __nlink_t = c_ulong; +pub const __off_t = c_long; +pub const __off64_t = c_long; +pub const __pid_t = c_int; +pub const __fsid_t = extern struct { + __val: [2]c_int, +}; +pub const __clock_t = c_long; +pub const __rlim_t = c_ulong; +pub const __rlim64_t = c_ulong; +pub const __id_t = c_uint; +pub const __time_t = c_long; +pub const __useconds_t = c_uint; +pub const __suseconds_t = c_long; +pub const __daddr_t = c_int; +pub const __key_t = c_int; +pub const __clockid_t = c_int; +pub const __timer_t = ?*c_void; +pub const __blksize_t = c_long; +pub const __blkcnt_t = c_long; +pub const __blkcnt64_t = c_long; +pub const __fsblkcnt_t = c_ulong; +pub const __fsblkcnt64_t = c_ulong; +pub const __fsfilcnt_t = c_ulong; +pub const __fsfilcnt64_t = c_ulong; +pub const __fsword_t = c_long; +pub const __ssize_t = c_long; +pub const __syscall_slong_t = c_long; +pub const __syscall_ulong_t = c_ulong; +pub const __loff_t = __off64_t; +pub const __caddr_t = [*c]u8; +pub const __intptr_t = c_long; +pub const __socklen_t = c_uint; +pub const __sig_atomic_t = c_int; +pub const __mbstate_t = extern struct { + __count: c_int, + __value: extern union { + __wch: c_uint, + __wchb: [4]u8, + }, +}; +pub const struct__G_fpos_t = extern struct { + __pos: __off_t, + __state: __mbstate_t, +}; +pub const __fpos_t = struct__G_fpos_t; +pub const struct__G_fpos64_t = extern struct { + __pos: __off64_t, + __state: __mbstate_t, +}; +pub const __fpos64_t = struct__G_fpos64_t; +pub const struct__IO_marker = @OpaqueType(); +pub const _IO_lock_t = c_void; +pub const struct__IO_codecvt = @OpaqueType(); +pub const struct__IO_wide_data = @OpaqueType(); +pub const struct__IO_FILE = extern struct { + _flags: c_int, + _IO_read_ptr: [*c]u8, + _IO_read_end: [*c]u8, + _IO_read_base: [*c]u8, + _IO_write_base: [*c]u8, + _IO_write_ptr: [*c]u8, + _IO_write_end: [*c]u8, + _IO_buf_base: [*c]u8, + _IO_buf_end: [*c]u8, + _IO_save_base: [*c]u8, + _IO_backup_base: [*c]u8, + _IO_save_end: [*c]u8, + _markers: ?*struct__IO_marker, + _chain: [*c]struct__IO_FILE, + _fileno: c_int, + _flags2: c_int, + _old_offset: __off_t, + _cur_column: c_ushort, + _vtable_offset: i8, + _shortbuf: [1]u8, + _lock: ?*_IO_lock_t, + _offset: __off64_t, + _codecvt: ?*struct__IO_codecvt, + _wide_data: ?*struct__IO_wide_data, + _freeres_list: [*c]struct__IO_FILE, + _freeres_buf: ?*c_void, + __pad5: usize, + _mode: c_int, + _unused2: [20]u8, +}; +pub const __FILE = struct__IO_FILE; +pub const FILE = struct__IO_FILE; +pub const off_t = __off_t; +pub const fpos_t = __fpos_t; +pub extern var stdin: [*c]FILE; +pub extern var stdout: [*c]FILE; +pub extern var stderr: [*c]FILE; +pub extern fn remove(__filename: [*c]const u8) c_int; +pub extern fn rename(__old: [*c]const u8, __new: [*c]const u8) c_int; +pub extern fn renameat(__oldfd: c_int, __old: [*c]const u8, __newfd: c_int, __new: [*c]const u8) c_int; +pub extern fn tmpfile() [*c]FILE; +pub extern fn tmpnam(__s: [*c]u8) [*c]u8; +pub extern fn tmpnam_r(__s: [*c]u8) [*c]u8; +pub extern fn tempnam(__dir: [*c]const u8, __pfx: [*c]const u8) [*c]u8; +pub extern fn fclose(__stream: [*c]FILE) c_int; +pub extern fn fflush(__stream: [*c]FILE) c_int; +pub extern fn fflush_unlocked(__stream: [*c]FILE) c_int; +pub extern fn fopen(__filename: [*c]const u8, __modes: [*c]const u8) [*c]FILE; +pub extern fn freopen(noalias __filename: [*c]const u8, noalias __modes: [*c]const u8, noalias __stream: [*c]FILE) [*c]FILE; +pub extern fn fdopen(__fd: c_int, __modes: [*c]const u8) [*c]FILE; +pub extern fn fmemopen(__s: ?*c_void, __len: usize, __modes: [*c]const u8) [*c]FILE; +pub extern fn open_memstream(__bufloc: [*c]([*c]u8), __sizeloc: [*c]usize) [*c]FILE; +pub extern fn setbuf(noalias __stream: [*c]FILE, noalias __buf: [*c]u8) void; +pub extern fn setvbuf(noalias __stream: [*c]FILE, noalias __buf: [*c]u8, __modes: c_int, __n: usize) c_int; +pub extern fn setbuffer(noalias __stream: [*c]FILE, noalias __buf: [*c]u8, __size: usize) void; +pub extern fn setlinebuf(__stream: [*c]FILE) void; +pub extern fn fprintf(__stream: [*c]FILE, __format: [*c]const u8, ...) c_int; +pub extern fn printf(__format: [*c]const u8, ...) c_int; +pub extern fn sprintf(__s: [*c]u8, __format: [*c]const u8, ...) c_int; +pub extern fn vfprintf(__s: [*c]FILE, __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn vprintf(__format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn vsprintf(__s: [*c]u8, __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn snprintf(__s: [*c]u8, __maxlen: c_ulong, __format: [*c]const u8, ...) c_int; +pub extern fn vsnprintf(__s: [*c]u8, __maxlen: c_ulong, __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn vdprintf(__fd: c_int, noalias __fmt: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn dprintf(__fd: c_int, noalias __fmt: [*c]const u8, ...) c_int; +pub extern fn fscanf(noalias __stream: [*c]FILE, noalias __format: [*c]const u8, ...) c_int; +pub extern fn scanf(noalias __format: [*c]const u8, ...) c_int; +pub extern fn sscanf(noalias __s: [*c]const u8, noalias __format: [*c]const u8, ...) c_int; +pub extern fn vfscanf(noalias __s: [*c]FILE, noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn vscanf(noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn vsscanf(noalias __s: [*c]const u8, noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag) c_int; +pub extern fn fgetc(__stream: [*c]FILE) c_int; +pub extern fn getc(__stream: [*c]FILE) c_int; +pub extern fn getchar() c_int; +pub extern fn getc_unlocked(__stream: [*c]FILE) c_int; +pub extern fn getchar_unlocked() c_int; +pub extern fn fgetc_unlocked(__stream: [*c]FILE) c_int; +pub extern fn fputc(__c: c_int, __stream: [*c]FILE) c_int; +pub extern fn putc(__c: c_int, __stream: [*c]FILE) c_int; +pub extern fn putchar(__c: c_int) c_int; +pub extern fn fputc_unlocked(__c: c_int, __stream: [*c]FILE) c_int; +pub extern fn putc_unlocked(__c: c_int, __stream: [*c]FILE) c_int; +pub extern fn putchar_unlocked(__c: c_int) c_int; +pub extern fn getw(__stream: [*c]FILE) c_int; +pub extern fn putw(__w: c_int, __stream: [*c]FILE) c_int; +pub extern fn fgets(noalias __s: [*c]u8, __n: c_int, noalias __stream: [*c]FILE) [*c]u8; +pub extern fn __getdelim(noalias __lineptr: [*c]([*c]u8), noalias __n: [*c]usize, __delimiter: c_int, noalias __stream: [*c]FILE) __ssize_t; +pub extern fn getdelim(noalias __lineptr: [*c]([*c]u8), noalias __n: [*c]usize, __delimiter: c_int, noalias __stream: [*c]FILE) __ssize_t; +pub extern fn getline(noalias __lineptr: [*c]([*c]u8), noalias __n: [*c]usize, noalias __stream: [*c]FILE) __ssize_t; +pub extern fn fputs(noalias __s: [*c]const u8, noalias __stream: [*c]FILE) c_int; +pub extern fn puts(__s: [*c]const u8) c_int; +pub extern fn ungetc(__c: c_int, __stream: [*c]FILE) c_int; +pub extern fn fread(__ptr: ?*c_void, __size: c_ulong, __n: c_ulong, __stream: [*c]FILE) c_ulong; +pub extern fn fwrite(__ptr: ?*const c_void, __size: c_ulong, __n: c_ulong, __s: [*c]FILE) c_ulong; +pub extern fn fread_unlocked(noalias __ptr: ?*c_void, __size: usize, __n: usize, noalias __stream: [*c]FILE) usize; +pub extern fn fwrite_unlocked(noalias __ptr: ?*const c_void, __size: usize, __n: usize, noalias __stream: [*c]FILE) usize; +pub extern fn fseek(__stream: [*c]FILE, __off: c_long, __whence: c_int) c_int; +pub extern fn ftell(__stream: [*c]FILE) c_long; +pub extern fn rewind(__stream: [*c]FILE) void; +pub extern fn fseeko(__stream: [*c]FILE, __off: __off_t, __whence: c_int) c_int; +pub extern fn ftello(__stream: [*c]FILE) __off_t; +pub extern fn fgetpos(noalias __stream: [*c]FILE, noalias __pos: [*c]fpos_t) c_int; +pub extern fn fsetpos(__stream: [*c]FILE, __pos: [*c]const fpos_t) c_int; +pub extern fn clearerr(__stream: [*c]FILE) void; +pub extern fn feof(__stream: [*c]FILE) c_int; +pub extern fn ferror(__stream: [*c]FILE) c_int; +pub extern fn clearerr_unlocked(__stream: [*c]FILE) void; +pub extern fn feof_unlocked(__stream: [*c]FILE) c_int; +pub extern fn ferror_unlocked(__stream: [*c]FILE) c_int; +pub extern fn perror(__s: [*c]const u8) void; +pub extern var sys_nerr: c_int; +pub extern const sys_errlist: [*c]const ([*c]const u8); +pub extern fn fileno(__stream: [*c]FILE) c_int; +pub extern fn fileno_unlocked(__stream: [*c]FILE) c_int; +pub extern fn popen(__command: [*c]const u8, __modes: [*c]const u8) [*c]FILE; +pub extern fn pclose(__stream: [*c]FILE) c_int; +pub extern fn ctermid(__s: [*c]u8) [*c]u8; +pub extern fn flockfile(__stream: [*c]FILE) void; +pub extern fn ftrylockfile(__stream: [*c]FILE) c_int; +pub extern fn funlockfile(__stream: [*c]FILE) void; +pub extern fn __uflow(arg0: [*c]FILE) c_int; +pub extern fn __overflow(arg0: [*c]FILE, arg1: c_int) c_int; +pub const wchar_t = c_int; +pub const _Float32 = f32; +pub const _Float64 = f64; +pub const _Float32x = f64; +pub const _Float64x = c_longdouble; +pub const div_t = extern struct { + quot: c_int, + rem: c_int, +}; +pub const ldiv_t = extern struct { + quot: c_long, + rem: c_long, +}; +pub const lldiv_t = extern struct { + quot: c_longlong, + rem: c_longlong, +}; +pub extern fn __ctype_get_mb_cur_max() usize; +pub extern fn atof(__nptr: [*c]const u8) f64; +pub extern fn atoi(__nptr: [*c]const u8) c_int; +pub extern fn atol(__nptr: [*c]const u8) c_long; +pub extern fn atoll(__nptr: [*c]const u8) c_longlong; +pub extern fn strtod(__nptr: [*c]const u8, __endptr: [*c]([*c]u8)) f64; +pub extern fn strtof(__nptr: [*c]const u8, __endptr: [*c]([*c]u8)) f32; +pub extern fn strtold(__nptr: [*c]const u8, __endptr: [*c]([*c]u8)) c_longdouble; +pub extern fn strtol(__nptr: [*c]const u8, __endptr: [*c]([*c]u8), __base: c_int) c_long; +pub extern fn strtoul(__nptr: [*c]const u8, __endptr: [*c]([*c]u8), __base: c_int) c_ulong; +pub extern fn strtoq(noalias __nptr: [*c]const u8, noalias __endptr: [*c]([*c]u8), __base: c_int) c_longlong; +pub extern fn strtouq(noalias __nptr: [*c]const u8, noalias __endptr: [*c]([*c]u8), __base: c_int) c_ulonglong; +pub extern fn strtoll(__nptr: [*c]const u8, __endptr: [*c]([*c]u8), __base: c_int) c_longlong; +pub extern fn strtoull(__nptr: [*c]const u8, __endptr: [*c]([*c]u8), __base: c_int) c_ulonglong; +pub extern fn l64a(__n: c_long) [*c]u8; +pub extern fn a64l(__s: [*c]const u8) c_long; +pub const u_char = __u_char; +pub const u_short = __u_short; +pub const u_int = __u_int; +pub const u_long = __u_long; +pub const quad_t = __quad_t; +pub const u_quad_t = __u_quad_t; +pub const fsid_t = __fsid_t; +pub const loff_t = __loff_t; +pub const ino_t = __ino_t; +pub const dev_t = __dev_t; +pub const gid_t = __gid_t; +pub const mode_t = __mode_t; +pub const nlink_t = __nlink_t; +pub const uid_t = __uid_t; +pub const pid_t = __pid_t; +pub const id_t = __id_t; +pub const daddr_t = __daddr_t; +pub const caddr_t = __caddr_t; +pub const key_t = __key_t; +pub const clock_t = __clock_t; +pub const clockid_t = __clockid_t; +pub const time_t = __time_t; +pub const timer_t = __timer_t; +pub const ulong = c_ulong; +pub const ushort = c_ushort; +pub const uint = c_uint; +pub const u_int8_t = u8; +pub const u_int16_t = c_ushort; +pub const u_int32_t = c_uint; +pub const u_int64_t = c_ulong; +pub const register_t = c_long; +pub fn __bswap_16(__bsx: __uint16_t) __uint16_t { + return __uint16_t(((c_int(__bsx) >> @import("std").math.Log2Int(c_int)(8)) & 255) | ((c_int(__bsx) & 255) << @import("std").math.Log2Int(c_int)(8))); +} +pub fn __bswap_32(__bsx: __uint32_t) __uint32_t { + return ((((__bsx & 4278190080) >> @import("std").math.Log2Int(c_uint)(24)) | ((__bsx & 16711680) >> @import("std").math.Log2Int(c_uint)(8))) | ((__bsx & 65280) << @import("std").math.Log2Int(c_uint)(8))) | ((__bsx & 255) << @import("std").math.Log2Int(c_uint)(24)); +} +pub fn __bswap_64(__bsx: __uint64_t) __uint64_t { + return __uint64_t(((((((((c_ulonglong(__bsx) & 18374686479671623680) >> @import("std").math.Log2Int(c_ulonglong)(56)) | ((c_ulonglong(__bsx) & 71776119061217280) >> @import("std").math.Log2Int(c_ulonglong)(40))) | ((c_ulonglong(__bsx) & 280375465082880) >> @import("std").math.Log2Int(c_ulonglong)(24))) | ((c_ulonglong(__bsx) & 1095216660480) >> @import("std").math.Log2Int(c_ulonglong)(8))) | ((c_ulonglong(__bsx) & 4278190080) << @import("std").math.Log2Int(c_ulonglong)(8))) | ((c_ulonglong(__bsx) & 16711680) << @import("std").math.Log2Int(c_ulonglong)(24))) | ((c_ulonglong(__bsx) & 65280) << @import("std").math.Log2Int(c_ulonglong)(40))) | ((c_ulonglong(__bsx) & 255) << @import("std").math.Log2Int(c_ulonglong)(56))); +} +pub fn __uint16_identity(__x: __uint16_t) __uint16_t { + return __x; +} +pub fn __uint32_identity(__x: __uint32_t) __uint32_t { + return __x; +} +pub fn __uint64_identity(__x: __uint64_t) __uint64_t { + return __x; +} +pub const __sigset_t = extern struct { + __val: [16]c_ulong, +}; +pub const sigset_t = __sigset_t; +pub const struct_timeval = extern struct { + tv_sec: __time_t, + tv_usec: __suseconds_t, +}; +pub const struct_timespec = extern struct { + tv_sec: __time_t, + tv_nsec: __syscall_slong_t, +}; +pub const suseconds_t = __suseconds_t; +pub const __fd_mask = c_long; +pub const fd_set = extern struct { + __fds_bits: [16]__fd_mask, +}; +pub const fd_mask = __fd_mask; +pub extern fn select(__nfds: c_int, noalias __readfds: [*c]fd_set, noalias __writefds: [*c]fd_set, noalias __exceptfds: [*c]fd_set, noalias __timeout: [*c]struct_timeval) c_int; +pub extern fn pselect(__nfds: c_int, noalias __readfds: [*c]fd_set, noalias __writefds: [*c]fd_set, noalias __exceptfds: [*c]fd_set, noalias __timeout: [*c]const struct_timespec, noalias __sigmask: [*c]const __sigset_t) c_int; +pub const blksize_t = __blksize_t; +pub const blkcnt_t = __blkcnt_t; +pub const fsblkcnt_t = __fsblkcnt_t; +pub const fsfilcnt_t = __fsfilcnt_t; +pub const struct___pthread_rwlock_arch_t = extern struct { + __readers: c_uint, + __writers: c_uint, + __wrphase_futex: c_uint, + __writers_futex: c_uint, + __pad3: c_uint, + __pad4: c_uint, + __cur_writer: c_int, + __shared: c_int, + __rwelision: i8, + __pad1: [7]u8, + __pad2: c_ulong, + __flags: c_uint, +}; +pub const struct___pthread_internal_list = extern struct { + __prev: [*c]struct___pthread_internal_list, + __next: [*c]struct___pthread_internal_list, +}; +pub const __pthread_list_t = struct___pthread_internal_list; +pub const struct___pthread_mutex_s = extern struct { + __lock: c_int, + __count: c_uint, + __owner: c_int, + __nusers: c_uint, + __kind: c_int, + __spins: c_short, + __elision: c_short, + __list: __pthread_list_t, +}; +pub const struct___pthread_cond_s = extern struct { + @"": extern union { + __wseq: c_ulonglong, + __wseq32: extern struct { + __low: c_uint, + __high: c_uint, + }, + }, + @"": extern union { + __g1_start: c_ulonglong, + __g1_start32: extern struct { + __low: c_uint, + __high: c_uint, + }, + }, + __g_refs: [2]c_uint, + __g_size: [2]c_uint, + __g1_orig_size: c_uint, + __wrefs: c_uint, + __g_signals: [2]c_uint, +}; +pub const pthread_t = c_ulong; +pub const pthread_mutexattr_t = extern union { + __size: [4]u8, + __align: c_int, +}; +pub const pthread_condattr_t = extern union { + __size: [4]u8, + __align: c_int, +}; +pub const pthread_key_t = c_uint; +pub const pthread_once_t = c_int; +pub const union_pthread_attr_t = extern union { + __size: [56]u8, + __align: c_long, +}; +pub const pthread_attr_t = union_pthread_attr_t; +pub const pthread_mutex_t = extern union { + __data: struct___pthread_mutex_s, + __size: [40]u8, + __align: c_long, +}; +pub const pthread_cond_t = extern union { + __data: struct___pthread_cond_s, + __size: [48]u8, + __align: c_longlong, +}; +pub const pthread_rwlock_t = extern union { + __data: struct___pthread_rwlock_arch_t, + __size: [56]u8, + __align: c_long, +}; +pub const pthread_rwlockattr_t = extern union { + __size: [8]u8, + __align: c_long, +}; +pub const pthread_spinlock_t = c_int; +pub const pthread_barrier_t = extern union { + __size: [32]u8, + __align: c_long, +}; +pub const pthread_barrierattr_t = extern union { + __size: [4]u8, + __align: c_int, +}; +pub extern fn random() c_long; +pub extern fn srandom(__seed: c_uint) void; +pub extern fn initstate(__seed: c_uint, __statebuf: [*c]u8, __statelen: usize) [*c]u8; +pub extern fn setstate(__statebuf: [*c]u8) [*c]u8; +pub const struct_random_data = extern struct { + fptr: [*c]i32, + rptr: [*c]i32, + state: [*c]i32, + rand_type: c_int, + rand_deg: c_int, + rand_sep: c_int, + end_ptr: [*c]i32, +}; +pub extern fn random_r(noalias __buf: [*c]struct_random_data, noalias __result: [*c]i32) c_int; +pub extern fn srandom_r(__seed: c_uint, __buf: [*c]struct_random_data) c_int; +pub extern fn initstate_r(__seed: c_uint, noalias __statebuf: [*c]u8, __statelen: usize, noalias __buf: [*c]struct_random_data) c_int; +pub extern fn setstate_r(noalias __statebuf: [*c]u8, noalias __buf: [*c]struct_random_data) c_int; +pub extern fn rand() c_int; +pub extern fn srand(__seed: c_uint) void; +pub extern fn rand_r(__seed: [*c]c_uint) c_int; +pub extern fn drand48() f64; +pub extern fn erand48(__xsubi: [*c]c_ushort) f64; +pub extern fn lrand48() c_long; +pub extern fn nrand48(__xsubi: [*c]c_ushort) c_long; +pub extern fn mrand48() c_long; +pub extern fn jrand48(__xsubi: [*c]c_ushort) c_long; +pub extern fn srand48(__seedval: c_long) void; +pub extern fn seed48(__seed16v: [*c]c_ushort) [*c]c_ushort; +pub extern fn lcong48(__param: [*c]c_ushort) void; +pub const struct_drand48_data = extern struct { + __x: [3]c_ushort, + __old_x: [3]c_ushort, + __c: c_ushort, + __init: c_ushort, + __a: c_ulonglong, +}; +pub extern fn drand48_r(noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]f64) c_int; +pub extern fn erand48_r(__xsubi: [*c]c_ushort, noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]f64) c_int; +pub extern fn lrand48_r(noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]c_long) c_int; +pub extern fn nrand48_r(__xsubi: [*c]c_ushort, noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]c_long) c_int; +pub extern fn mrand48_r(noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]c_long) c_int; +pub extern fn jrand48_r(__xsubi: [*c]c_ushort, noalias __buffer: [*c]struct_drand48_data, noalias __result: [*c]c_long) c_int; +pub extern fn srand48_r(__seedval: c_long, __buffer: [*c]struct_drand48_data) c_int; +pub extern fn seed48_r(__seed16v: [*c]c_ushort, __buffer: [*c]struct_drand48_data) c_int; +pub extern fn lcong48_r(__param: [*c]c_ushort, __buffer: [*c]struct_drand48_data) c_int; +pub extern fn malloc(__size: c_ulong) ?*c_void; +pub extern fn calloc(__nmemb: c_ulong, __size: c_ulong) ?*c_void; +pub extern fn realloc(__ptr: ?*c_void, __size: c_ulong) ?*c_void; +pub extern fn reallocarray(__ptr: ?*c_void, __nmemb: usize, __size: usize) ?*c_void; +pub extern fn free(__ptr: ?*c_void) void; +pub extern fn alloca(__size: c_ulong) ?*c_void; +pub extern fn valloc(__size: usize) ?*c_void; +pub extern fn posix_memalign(__memptr: [*c](?*c_void), __alignment: usize, __size: usize) c_int; +pub extern fn aligned_alloc(__alignment: usize, __size: usize) ?*c_void; +pub extern fn abort() noreturn; +pub extern fn atexit(__func: ?extern fn () void) c_int; +pub extern fn at_quick_exit(__func: ?extern fn () void) c_int; +pub extern fn on_exit(__func: ?extern fn (c_int, ?*c_void) void, __arg: ?*c_void) c_int; +pub extern fn exit(__status: c_int) noreturn; +pub extern fn quick_exit(__status: c_int) noreturn; +pub extern fn _Exit(__status: c_int) noreturn; +pub extern fn getenv(__name: [*c]const u8) [*c]u8; +pub extern fn putenv(__string: [*c]u8) c_int; +pub extern fn setenv(__name: [*c]const u8, __value: [*c]const u8, __replace: c_int) c_int; +pub extern fn unsetenv(__name: [*c]const u8) c_int; +pub extern fn clearenv() c_int; +pub extern fn mktemp(__template: [*c]u8) [*c]u8; +pub extern fn mkstemp(__template: [*c]u8) c_int; +pub extern fn mkstemps(__template: [*c]u8, __suffixlen: c_int) c_int; +pub extern fn mkdtemp(__template: [*c]u8) [*c]u8; +pub extern fn system(__command: [*c]const u8) c_int; +pub extern fn realpath(noalias __name: [*c]const u8, noalias __resolved: [*c]u8) [*c]u8; +pub const __compar_fn_t = ?extern fn (?*const c_void, ?*const c_void) c_int; +pub extern fn bsearch(__key: ?*const c_void, __base: ?*const c_void, __nmemb: usize, __size: usize, __compar: __compar_fn_t) ?*c_void; +pub extern fn qsort(__base: ?*c_void, __nmemb: usize, __size: usize, __compar: __compar_fn_t) void; +pub extern fn abs(__x: c_int) c_int; +pub extern fn labs(__x: c_long) c_long; +pub extern fn llabs(__x: c_longlong) c_longlong; +pub extern fn div(__numer: c_int, __denom: c_int) div_t; +pub extern fn ldiv(__numer: c_long, __denom: c_long) ldiv_t; +pub extern fn lldiv(__numer: c_longlong, __denom: c_longlong) lldiv_t; +pub extern fn ecvt(__value: f64, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int) [*c]u8; +pub extern fn fcvt(__value: f64, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int) [*c]u8; +pub extern fn gcvt(__value: f64, __ndigit: c_int, __buf: [*c]u8) [*c]u8; +pub extern fn qecvt(__value: c_longdouble, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int) [*c]u8; +pub extern fn qfcvt(__value: c_longdouble, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int) [*c]u8; +pub extern fn qgcvt(__value: c_longdouble, __ndigit: c_int, __buf: [*c]u8) [*c]u8; +pub extern fn ecvt_r(__value: f64, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int, noalias __buf: [*c]u8, __len: usize) c_int; +pub extern fn fcvt_r(__value: f64, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int, noalias __buf: [*c]u8, __len: usize) c_int; +pub extern fn qecvt_r(__value: c_longdouble, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int, noalias __buf: [*c]u8, __len: usize) c_int; +pub extern fn qfcvt_r(__value: c_longdouble, __ndigit: c_int, noalias __decpt: [*c]c_int, noalias __sign: [*c]c_int, noalias __buf: [*c]u8, __len: usize) c_int; +pub extern fn mblen(__s: [*c]const u8, __n: usize) c_int; +pub extern fn mbtowc(noalias __pwc: [*c]wchar_t, noalias __s: [*c]const u8, __n: usize) c_int; +pub extern fn wctomb(__s: [*c]u8, __wchar: wchar_t) c_int; +pub extern fn mbstowcs(noalias __pwcs: [*c]wchar_t, noalias __s: [*c]const u8, __n: usize) usize; +pub extern fn wcstombs(noalias __s: [*c]u8, noalias __pwcs: [*c]const wchar_t, __n: usize) usize; +pub extern fn rpmatch(__response: [*c]const u8) c_int; +pub extern fn getsubopt(noalias __optionp: [*c]([*c]u8), noalias __tokens: [*c]const ([*c]u8), noalias __valuep: [*c]([*c]u8)) c_int; +pub extern fn getloadavg(__loadavg: [*c]f64, __nelem: c_int) c_int; +pub const magick_int8_t = i8; +pub const magick_uint8_t = u8; +pub const magick_int16_t = c_short; +pub const magick_uint16_t = c_ushort; +pub const magick_int32_t = c_int; +pub const magick_uint32_t = c_uint; +pub const magick_int64_t = c_long; +pub const magick_uint64_t = c_ulong; +pub const magick_uintmax_t = c_ulong; +pub const magick_uintptr_t = c_ulong; +pub const magick_off_t = magick_int64_t; +pub const UndefinedClass = 0; +pub const DirectClass = 1; +pub const PseudoClass = 2; +pub const ClassType = extern enum { + UndefinedClass = 0, + DirectClass = 1, + PseudoClass = 2, +}; +pub const UndefinedColorspace = 0; +pub const RGBColorspace = 1; +pub const GRAYColorspace = 2; +pub const TransparentColorspace = 3; +pub const OHTAColorspace = 4; +pub const XYZColorspace = 5; +pub const YCCColorspace = 6; +pub const YIQColorspace = 7; +pub const YPbPrColorspace = 8; +pub const YUVColorspace = 9; +pub const CMYKColorspace = 10; +pub const sRGBColorspace = 11; +pub const HSLColorspace = 12; +pub const HWBColorspace = 13; +pub const LABColorspace = 14; +pub const CineonLogRGBColorspace = 15; +pub const Rec601LumaColorspace = 16; +pub const Rec601YCbCrColorspace = 17; +pub const Rec709LumaColorspace = 18; +pub const Rec709YCbCrColorspace = 19; +pub const ColorspaceType = extern enum { + UndefinedColorspace = 0, + RGBColorspace = 1, + GRAYColorspace = 2, + TransparentColorspace = 3, + OHTAColorspace = 4, + XYZColorspace = 5, + YCCColorspace = 6, + YIQColorspace = 7, + YPbPrColorspace = 8, + YUVColorspace = 9, + CMYKColorspace = 10, + sRGBColorspace = 11, + HSLColorspace = 12, + HWBColorspace = 13, + LABColorspace = 14, + CineonLogRGBColorspace = 15, + Rec601LumaColorspace = 16, + Rec601YCbCrColorspace = 17, + Rec709LumaColorspace = 18, + Rec709YCbCrColorspace = 19, +}; +pub const UndefinedCompression = 0; +pub const NoCompression = 1; +pub const BZipCompression = 2; +pub const FaxCompression = 3; +pub const Group3Compression = 3; +pub const Group4Compression = 4; +pub const JPEGCompression = 5; +pub const LosslessJPEGCompression = 6; +pub const LZWCompression = 7; +pub const RLECompression = 8; +pub const ZipCompression = 9; +pub const LZMACompression = 10; +pub const JPEG2000Compression = 11; +pub const JBIG1Compression = 12; +pub const JBIG2Compression = 13; +pub const ZSTDCompression = 14; +pub const WebPCompression = 15; +pub const CompressionType = extern enum { + UndefinedCompression = 0, + NoCompression = 1, + BZipCompression = 2, + FaxCompression = 3, + Group4Compression = 4, + JPEGCompression = 5, + LosslessJPEGCompression = 6, + LZWCompression = 7, + RLECompression = 8, + ZipCompression = 9, + LZMACompression = 10, + JPEG2000Compression = 11, + JBIG1Compression = 12, + JBIG2Compression = 13, + ZSTDCompression = 14, + WebPCompression = 15, + pub const Group3Compression = @This().FaxCompression; +}; +pub const Quantum = c_ushort; +pub const struct__PixelPacket = extern struct { + blue: Quantum, + green: Quantum, + red: Quantum, + opacity: Quantum, +}; +pub const PixelPacket = struct__PixelPacket; +pub const struct__PrimaryInfo = extern struct { + x: f64, + y: f64, + z: f64, +}; +pub const PrimaryInfo = struct__PrimaryInfo; +pub const struct__ChromaticityInfo = extern struct { + red_primary: PrimaryInfo, + green_primary: PrimaryInfo, + blue_primary: PrimaryInfo, + white_point: PrimaryInfo, +}; +pub const ChromaticityInfo = struct__ChromaticityInfo; +pub const UndefinedOrientation = 0; +pub const TopLeftOrientation = 1; +pub const TopRightOrientation = 2; +pub const BottomRightOrientation = 3; +pub const BottomLeftOrientation = 4; +pub const LeftTopOrientation = 5; +pub const RightTopOrientation = 6; +pub const RightBottomOrientation = 7; +pub const LeftBottomOrientation = 8; +pub const OrientationType = extern enum { + UndefinedOrientation = 0, + TopLeftOrientation = 1, + TopRightOrientation = 2, + BottomRightOrientation = 3, + BottomLeftOrientation = 4, + LeftTopOrientation = 5, + RightTopOrientation = 6, + RightBottomOrientation = 7, + LeftBottomOrientation = 8, +}; +pub const UndefinedIntent = 0; +pub const SaturationIntent = 1; +pub const PerceptualIntent = 2; +pub const AbsoluteIntent = 3; +pub const RelativeIntent = 4; +pub const RenderingIntent = extern enum { + UndefinedIntent = 0, + SaturationIntent = 1, + PerceptualIntent = 2, + AbsoluteIntent = 3, + RelativeIntent = 4, +}; +pub const UndefinedResolution = 0; +pub const PixelsPerInchResolution = 1; +pub const PixelsPerCentimeterResolution = 2; +pub const ResolutionType = extern enum { + UndefinedResolution = 0, + PixelsPerInchResolution = 1, + PixelsPerCentimeterResolution = 2, +}; +pub const struct__RectangleInfo = extern struct { + width: c_ulong, + height: c_ulong, + x: c_long, + y: c_long, +}; +pub const RectangleInfo = struct__RectangleInfo; +pub const UndefinedFilter = 0; +pub const PointFilter = 1; +pub const BoxFilter = 2; +pub const TriangleFilter = 3; +pub const HermiteFilter = 4; +pub const HanningFilter = 5; +pub const HammingFilter = 6; +pub const BlackmanFilter = 7; +pub const GaussianFilter = 8; +pub const QuadraticFilter = 9; +pub const CubicFilter = 10; +pub const CatromFilter = 11; +pub const MitchellFilter = 12; +pub const LanczosFilter = 13; +pub const BesselFilter = 14; +pub const SincFilter = 15; +pub const FilterTypes = extern enum { + UndefinedFilter = 0, + PointFilter = 1, + BoxFilter = 2, + TriangleFilter = 3, + HermiteFilter = 4, + HanningFilter = 5, + HammingFilter = 6, + BlackmanFilter = 7, + GaussianFilter = 8, + QuadraticFilter = 9, + CubicFilter = 10, + CatromFilter = 11, + MitchellFilter = 12, + LanczosFilter = 13, + BesselFilter = 14, + SincFilter = 15, +}; +pub const UndefinedInterlace = 0; +pub const NoInterlace = 1; +pub const LineInterlace = 2; +pub const PlaneInterlace = 3; +pub const PartitionInterlace = 4; +pub const InterlaceType = extern enum { + UndefinedInterlace = 0, + NoInterlace = 1, + LineInterlace = 2, + PlaneInterlace = 3, + PartitionInterlace = 4, +}; +pub const UndefinedEndian = 0; +pub const LSBEndian = 1; +pub const MSBEndian = 2; +pub const NativeEndian = 3; +pub const EndianType = extern enum { + UndefinedEndian = 0, + LSBEndian = 1, + MSBEndian = 2, + NativeEndian = 3, +}; +pub const ForgetGravity = 0; +pub const NorthWestGravity = 1; +pub const NorthGravity = 2; +pub const NorthEastGravity = 3; +pub const WestGravity = 4; +pub const CenterGravity = 5; +pub const EastGravity = 6; +pub const SouthWestGravity = 7; +pub const SouthGravity = 8; +pub const SouthEastGravity = 9; +pub const StaticGravity = 10; +pub const GravityType = extern enum { + ForgetGravity = 0, + NorthWestGravity = 1, + NorthGravity = 2, + NorthEastGravity = 3, + WestGravity = 4, + CenterGravity = 5, + EastGravity = 6, + SouthWestGravity = 7, + SouthGravity = 8, + SouthEastGravity = 9, + StaticGravity = 10, +}; +pub const UndefinedCompositeOp = 0; +pub const OverCompositeOp = 1; +pub const InCompositeOp = 2; +pub const OutCompositeOp = 3; +pub const AtopCompositeOp = 4; +pub const XorCompositeOp = 5; +pub const PlusCompositeOp = 6; +pub const MinusCompositeOp = 7; +pub const AddCompositeOp = 8; +pub const SubtractCompositeOp = 9; +pub const DifferenceCompositeOp = 10; +pub const MultiplyCompositeOp = 11; +pub const BumpmapCompositeOp = 12; +pub const CopyCompositeOp = 13; +pub const CopyRedCompositeOp = 14; +pub const CopyGreenCompositeOp = 15; +pub const CopyBlueCompositeOp = 16; +pub const CopyOpacityCompositeOp = 17; +pub const ClearCompositeOp = 18; +pub const DissolveCompositeOp = 19; +pub const DisplaceCompositeOp = 20; +pub const ModulateCompositeOp = 21; +pub const ThresholdCompositeOp = 22; +pub const NoCompositeOp = 23; +pub const DarkenCompositeOp = 24; +pub const LightenCompositeOp = 25; +pub const HueCompositeOp = 26; +pub const SaturateCompositeOp = 27; +pub const ColorizeCompositeOp = 28; +pub const LuminizeCompositeOp = 29; +pub const ScreenCompositeOp = 30; +pub const OverlayCompositeOp = 31; +pub const CopyCyanCompositeOp = 32; +pub const CopyMagentaCompositeOp = 33; +pub const CopyYellowCompositeOp = 34; +pub const CopyBlackCompositeOp = 35; +pub const DivideCompositeOp = 36; +pub const HardLightCompositeOp = 37; +pub const ExclusionCompositeOp = 38; +pub const ColorDodgeCompositeOp = 39; +pub const ColorBurnCompositeOp = 40; +pub const SoftLightCompositeOp = 41; +pub const LinearBurnCompositeOp = 42; +pub const LinearDodgeCompositeOp = 43; +pub const LinearLightCompositeOp = 44; +pub const VividLightCompositeOp = 45; +pub const PinLightCompositeOp = 46; +pub const HardMixCompositeOp = 47; +pub const CompositeOperator = extern enum { + UndefinedCompositeOp = 0, + OverCompositeOp = 1, + InCompositeOp = 2, + OutCompositeOp = 3, + AtopCompositeOp = 4, + XorCompositeOp = 5, + PlusCompositeOp = 6, + MinusCompositeOp = 7, + AddCompositeOp = 8, + SubtractCompositeOp = 9, + DifferenceCompositeOp = 10, + MultiplyCompositeOp = 11, + BumpmapCompositeOp = 12, + CopyCompositeOp = 13, + CopyRedCompositeOp = 14, + CopyGreenCompositeOp = 15, + CopyBlueCompositeOp = 16, + CopyOpacityCompositeOp = 17, + ClearCompositeOp = 18, + DissolveCompositeOp = 19, + DisplaceCompositeOp = 20, + ModulateCompositeOp = 21, + ThresholdCompositeOp = 22, + NoCompositeOp = 23, + DarkenCompositeOp = 24, + LightenCompositeOp = 25, + HueCompositeOp = 26, + SaturateCompositeOp = 27, + ColorizeCompositeOp = 28, + LuminizeCompositeOp = 29, + ScreenCompositeOp = 30, + OverlayCompositeOp = 31, + CopyCyanCompositeOp = 32, + CopyMagentaCompositeOp = 33, + CopyYellowCompositeOp = 34, + CopyBlackCompositeOp = 35, + DivideCompositeOp = 36, + HardLightCompositeOp = 37, + ExclusionCompositeOp = 38, + ColorDodgeCompositeOp = 39, + ColorBurnCompositeOp = 40, + SoftLightCompositeOp = 41, + LinearBurnCompositeOp = 42, + LinearDodgeCompositeOp = 43, + LinearLightCompositeOp = 44, + VividLightCompositeOp = 45, + PinLightCompositeOp = 46, + HardMixCompositeOp = 47, +}; +pub const UndefinedDispose = 0; +pub const NoneDispose = 1; +pub const BackgroundDispose = 2; +pub const PreviousDispose = 3; +pub const DisposeType = extern enum { + UndefinedDispose = 0, + NoneDispose = 1, + BackgroundDispose = 2, + PreviousDispose = 3, +}; +pub const struct__ErrorInfo = extern struct { + mean_error_per_pixel: f64, + normalized_mean_error: f64, + normalized_maximum_error: f64, +}; +pub const ErrorInfo = struct__ErrorInfo; +pub const struct__Timer = extern struct { + start: f64, + stop: f64, + total: f64, +}; +pub const Timer = struct__Timer; +pub const UndefinedTimerState = 0; +pub const StoppedTimerState = 1; +pub const RunningTimerState = 2; +pub const TimerState = extern enum { + UndefinedTimerState = 0, + StoppedTimerState = 1, + RunningTimerState = 2, +}; +pub const struct__TimerInfo = extern struct { + user: Timer, + elapsed: Timer, + state: TimerState, + signature: c_ulong, +}; +pub const TimerInfo = struct__TimerInfo; +pub const UndefinedException = 0; +pub const EventException = 100; +pub const ExceptionEvent = 101; +pub const ResourceEvent = 102; +pub const ResourceLimitEvent = 102; +pub const TypeEvent = 105; +pub const AnnotateEvent = 105; +pub const OptionEvent = 110; +pub const DelegateEvent = 115; +pub const MissingDelegateEvent = 120; +pub const CorruptImageEvent = 125; +pub const FileOpenEvent = 130; +pub const BlobEvent = 135; +pub const StreamEvent = 140; +pub const CacheEvent = 145; +pub const CoderEvent = 150; +pub const ModuleEvent = 155; +pub const DrawEvent = 160; +pub const RenderEvent = 160; +pub const ImageEvent = 165; +pub const WandEvent = 167; +pub const TemporaryFileEvent = 170; +pub const TransformEvent = 175; +pub const XServerEvent = 180; +pub const X11Event = 181; +pub const UserEvent = 182; +pub const MonitorEvent = 185; +pub const LocaleEvent = 186; +pub const DeprecateEvent = 187; +pub const RegistryEvent = 190; +pub const ConfigureEvent = 195; +pub const WarningException = 300; +pub const ExceptionWarning = 301; +pub const ResourceWarning = 302; +pub const ResourceLimitWarning = 302; +pub const TypeWarning = 305; +pub const AnnotateWarning = 305; +pub const OptionWarning = 310; +pub const DelegateWarning = 315; +pub const MissingDelegateWarning = 320; +pub const CorruptImageWarning = 325; +pub const FileOpenWarning = 330; +pub const BlobWarning = 335; +pub const StreamWarning = 340; +pub const CacheWarning = 345; +pub const CoderWarning = 350; +pub const ModuleWarning = 355; +pub const DrawWarning = 360; +pub const RenderWarning = 360; +pub const ImageWarning = 365; +pub const WandWarning = 367; +pub const TemporaryFileWarning = 370; +pub const TransformWarning = 375; +pub const XServerWarning = 380; +pub const X11Warning = 381; +pub const UserWarning = 382; +pub const MonitorWarning = 385; +pub const LocaleWarning = 386; +pub const DeprecateWarning = 387; +pub const RegistryWarning = 390; +pub const ConfigureWarning = 395; +pub const ErrorException = 400; +pub const ExceptionError = 401; +pub const ResourceError = 402; +pub const ResourceLimitError = 402; +pub const TypeError = 405; +pub const AnnotateError = 405; +pub const OptionError = 410; +pub const DelegateError = 415; +pub const MissingDelegateError = 420; +pub const CorruptImageError = 425; +pub const FileOpenError = 430; +pub const BlobError = 435; +pub const StreamError = 440; +pub const CacheError = 445; +pub const CoderError = 450; +pub const ModuleError = 455; +pub const DrawError = 460; +pub const RenderError = 460; +pub const ImageError = 465; +pub const WandError = 467; +pub const TemporaryFileError = 470; +pub const TransformError = 475; +pub const XServerError = 480; +pub const X11Error = 481; +pub const UserError = 482; +pub const MonitorError = 485; +pub const LocaleError = 486; +pub const DeprecateError = 487; +pub const RegistryError = 490; +pub const ConfigureError = 495; +pub const FatalErrorException = 700; +pub const ExceptionFatalError = 701; +pub const ResourceFatalError = 702; +pub const ResourceLimitFatalError = 702; +pub const TypeFatalError = 705; +pub const AnnotateFatalError = 705; +pub const OptionFatalError = 710; +pub const DelegateFatalError = 715; +pub const MissingDelegateFatalError = 720; +pub const CorruptImageFatalError = 725; +pub const FileOpenFatalError = 730; +pub const BlobFatalError = 735; +pub const StreamFatalError = 740; +pub const CacheFatalError = 745; +pub const CoderFatalError = 750; +pub const ModuleFatalError = 755; +pub const DrawFatalError = 760; +pub const RenderFatalError = 760; +pub const ImageFatalError = 765; +pub const WandFatalError = 767; +pub const TemporaryFileFatalError = 770; +pub const TransformFatalError = 775; +pub const XServerFatalError = 780; +pub const X11FatalError = 781; +pub const UserFatalError = 782; +pub const MonitorFatalError = 785; +pub const LocaleFatalError = 786; +pub const DeprecateFatalError = 787; +pub const RegistryFatalError = 790; +pub const ConfigureFatalError = 795; +pub const ExceptionType = extern enum { + UndefinedException = 0, + EventException = 100, + ExceptionEvent = 101, + ResourceEvent = 102, + pub const ResourceLimitEvent = 102; + TypeEvent = 105, + pub const AnnotateEvent = 105; + OptionEvent = 110, + DelegateEvent = 115, + MissingDelegateEvent = 120, + CorruptImageEvent = 125, + FileOpenEvent = 130, + BlobEvent = 135, + StreamEvent = 140, + CacheEvent = 145, + CoderEvent = 150, + ModuleEvent = 155, + DrawEvent = 160, + pub const RenderEvent = 160; + ImageEvent = 165, + WandEvent = 167, + TemporaryFileEvent = 170, + TransformEvent = 175, + XServerEvent = 180, + X11Event = 181, + UserEvent = 182, + MonitorEvent = 185, + LocaleEvent = 186, + DeprecateEvent = 187, + RegistryEvent = 190, + ConfigureEvent = 195, + WarningException = 300, + ExceptionWarning = 301, + ResourceWarning = 302, + pub const ResourceLimitWarning = 302; + TypeWarning = 305, + pub const AnnotateWarning = 305; + OptionWarning = 310, + DelegateWarning = 315, + MissingDelegateWarning = 320, + CorruptImageWarning = 325, + FileOpenWarning = 330, + BlobWarning = 335, + StreamWarning = 340, + CacheWarning = 345, + CoderWarning = 350, + ModuleWarning = 355, + DrawWarning = 360, + pub const RenderWarning = 360; + ImageWarning = 365, + WandWarning = 367, + TemporaryFileWarning = 370, + TransformWarning = 375, + XServerWarning = 380, + X11Warning = 381, + UserWarning = 382, + MonitorWarning = 385, + LocaleWarning = 386, + DeprecateWarning = 387, + RegistryWarning = 390, + ConfigureWarning = 395, + ErrorException = 400, + ExceptionError = 401, + ResourceError = 402, + pub const ResourceLimitError = 402; + TypeError = 405, + pub const AnnotateError = 405; + OptionError = 410, + DelegateError = 415, + MissingDelegateError = 420, + CorruptImageError = 425, + FileOpenError = 430, + BlobError = 435, + StreamError = 440, + CacheError = 445, + CoderError = 450, + ModuleError = 455, + DrawError = 460, + pub const RenderError = 460; + ImageError = 465, + WandError = 467, + TemporaryFileError = 470, + TransformError = 475, + XServerError = 480, + X11Error = 481, + UserError = 482, + MonitorError = 485, + LocaleError = 486, + DeprecateError = 487, + RegistryError = 490, + ConfigureError = 495, + FatalErrorException = 700, + ExceptionFatalError = 701, + ResourceFatalError = 702, + pub const ResourceLimitFatalError = 702; + TypeFatalError = 705, + pub const AnnotateFatalError = 705; + OptionFatalError = 710, + DelegateFatalError = 715, + MissingDelegateFatalError = 720, + CorruptImageFatalError = 725, + FileOpenFatalError = 730, + BlobFatalError = 735, + StreamFatalError = 740, + CacheFatalError = 745, + CoderFatalError = 750, + ModuleFatalError = 755, + DrawFatalError = 760, + pub const RenderFatalError = 760; + ImageFatalError = 765, + WandFatalError = 767, + TemporaryFileFatalError = 770, + TransformFatalError = 775, + XServerFatalError = 780, + X11FatalError = 781, + UserFatalError = 782, + MonitorFatalError = 785, + LocaleFatalError = 786, + DeprecateFatalError = 787, + RegistryFatalError = 790, + ConfigureFatalError = 795, +}; +pub const struct__ExceptionInfo = extern struct { + severity: ExceptionType, + reason: [*c]u8, + description: [*c]u8, + error_number: c_int, + module: [*c]u8, + function: [*c]u8, + line: c_ulong, + signature: c_ulong, +}; +pub const ExceptionInfo = struct__ExceptionInfo; +pub const struct__ImageExtra = @OpaqueType(); +pub const struct__CacheInfo = @OpaqueType(); +pub const _CacheInfoPtr_ = ?*struct__CacheInfo; +pub const struct__ThreadViewSet = @OpaqueType(); +pub const _ThreadViewSetPtr_ = ?*struct__ThreadViewSet; +pub const struct__ImageAttribute = extern struct { + key: [*c]u8, + value: [*c]u8, + length: usize, + previous: [*c]struct__ImageAttribute, + next: [*c]struct__ImageAttribute, +}; +pub const _ImageAttributePtr_ = [*c]struct__ImageAttribute; +pub const struct__Ascii85Info = extern struct { + offset: c_long, + line_break: c_long, + buffer: [10]magick_uint8_t, +}; +pub const _Ascii85InfoPtr_ = [*c]struct__Ascii85Info; +pub const struct__BlobInfo = @OpaqueType(); +pub const _BlobInfoPtr_ = ?*struct__BlobInfo; +pub const struct__SemaphoreInfo = @OpaqueType(); +pub const _SemaphoreInfoPtr_ = ?*struct__SemaphoreInfo; +pub const struct__Image = extern struct { + storage_class: ClassType, + colorspace: ColorspaceType, + compression: CompressionType, + dither: c_uint, + matte: c_uint, + columns: c_ulong, + rows: c_ulong, + colors: c_uint, + depth: c_uint, + colormap: [*c]PixelPacket, + background_color: PixelPacket, + border_color: PixelPacket, + matte_color: PixelPacket, + gamma: f64, + chromaticity: ChromaticityInfo, + orientation: OrientationType, + rendering_intent: RenderingIntent, + units: ResolutionType, + montage: [*c]u8, + directory: [*c]u8, + geometry: [*c]u8, + offset: c_long, + x_resolution: f64, + y_resolution: f64, + page: RectangleInfo, + tile_info: RectangleInfo, + blur: f64, + fuzz: f64, + filter: FilterTypes, + interlace: InterlaceType, + endian: EndianType, + gravity: GravityType, + compose: CompositeOperator, + dispose: DisposeType, + scene: c_ulong, + delay: c_ulong, + iterations: c_ulong, + total_colors: c_ulong, + start_loop: c_long, + @"error": ErrorInfo, + timer: TimerInfo, + client_data: ?*c_void, + filename: [2053]u8, + magick_filename: [2053]u8, + magick: [2053]u8, + magick_columns: c_ulong, + magick_rows: c_ulong, + exception: ExceptionInfo, + previous: [*c]struct__Image, + next: [*c]struct__Image, + profiles: ?*c_void, + is_monochrome: c_uint, + is_grayscale: c_uint, + taint: c_uint, + extra: ?*struct__ImageExtra, + ping: c_uint, + cache: _CacheInfoPtr_, + default_views: _ThreadViewSetPtr_, + attributes: _ImageAttributePtr_, + ascii85: _Ascii85InfoPtr_, + blob: _BlobInfoPtr_, + reference_count: c_long, + semaphore: _SemaphoreInfoPtr_, + logging: c_uint, + list: [*c]struct__Image, + signature: c_ulong, +}; +pub const ImagePtr = [*c]struct__Image; +pub const ViewInfo = ?*c_void; +pub extern fn RGBTransformImage(arg0: ImagePtr, arg1: ColorspaceType) c_uint; +pub extern fn TransformColorspace(arg0: ImagePtr, arg1: ColorspaceType) c_uint; +pub extern fn TransformRGBImage(arg0: ImagePtr, arg1: ColorspaceType) c_uint; +pub const UndefinedExceptionBase = 0; +pub const ExceptionBase = 1; +pub const ResourceBase = 2; +pub const ResourceLimitBase = 2; +pub const TypeBase = 5; +pub const AnnotateBase = 5; +pub const OptionBase = 10; +pub const DelegateBase = 15; +pub const MissingDelegateBase = 20; +pub const CorruptImageBase = 25; +pub const FileOpenBase = 30; +pub const BlobBase = 35; +pub const StreamBase = 40; +pub const CacheBase = 45; +pub const CoderBase = 50; +pub const ModuleBase = 55; +pub const DrawBase = 60; +pub const RenderBase = 60; +pub const ImageBase = 65; +pub const WandBase = 67; +pub const TemporaryFileBase = 70; +pub const TransformBase = 75; +pub const XServerBase = 80; +pub const X11Base = 81; +pub const UserBase = 82; +pub const MonitorBase = 85; +pub const LocaleBase = 86; +pub const DeprecateBase = 87; +pub const RegistryBase = 90; +pub const ConfigureBase = 95; +pub const ExceptionBaseType = extern enum { + UndefinedExceptionBase = 0, + ExceptionBase = 1, + ResourceBase = 2, + ResourceLimitBase = 2, + TypeBase = 5, + AnnotateBase = 5, + OptionBase = 10, + DelegateBase = 15, + MissingDelegateBase = 20, + CorruptImageBase = 25, + FileOpenBase = 30, + BlobBase = 35, + StreamBase = 40, + CacheBase = 45, + CoderBase = 50, + ModuleBase = 55, + DrawBase = 60, + RenderBase = 60, + ImageBase = 65, + WandBase = 67, + TemporaryFileBase = 70, + TransformBase = 75, + XServerBase = 80, + X11Base = 81, + UserBase = 82, + MonitorBase = 85, + LocaleBase = 86, + DeprecateBase = 87, + RegistryBase = 90, + ConfigureBase = 95, +}; +pub const ErrorHandler = ?extern fn (ExceptionType, [*c]const u8, [*c]const u8) void; +pub const FatalErrorHandler = ?extern fn (ExceptionType, [*c]const u8, [*c]const u8) void; +pub const WarningHandler = ?extern fn (ExceptionType, [*c]const u8, [*c]const u8) void; +pub extern fn GetLocaleExceptionMessage(arg0: ExceptionType, arg1: [*c]const u8) [*c]const u8; +pub extern fn GetLocaleMessage(arg0: [*c]const u8) [*c]const u8; +pub extern fn SetErrorHandler(arg0: ErrorHandler) ErrorHandler; +pub extern fn SetFatalErrorHandler(arg0: FatalErrorHandler) FatalErrorHandler; +pub extern fn CatchException(arg0: [*c]const ExceptionInfo) void; +pub extern fn CopyException(copy: [*c]ExceptionInfo, original: [*c]const ExceptionInfo) void; +pub extern fn DestroyExceptionInfo(arg0: [*c]ExceptionInfo) void; +pub extern fn GetExceptionInfo(arg0: [*c]ExceptionInfo) void; +pub extern fn MagickError(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) void; +pub extern fn MagickFatalError(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) noreturn; +pub extern fn MagickWarning(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) void; +pub extern fn _MagickError(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) void; +pub extern fn _MagickFatalError(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) noreturn; +pub extern fn _MagickWarning(arg0: ExceptionType, arg1: [*c]const u8, arg2: [*c]const u8) void; +pub extern fn SetExceptionInfo(arg0: [*c]ExceptionInfo, arg1: ExceptionType) void; +pub extern fn ThrowException(arg0: [*c]ExceptionInfo, arg1: ExceptionType, arg2: [*c]const u8, arg3: [*c]const u8) void; +pub extern fn ThrowLoggedException(exception: [*c]ExceptionInfo, severity: ExceptionType, reason: [*c]const u8, description: [*c]const u8, module: [*c]const u8, function: [*c]const u8, line: c_ulong) void; +pub extern fn SetWarningHandler(arg0: WarningHandler) WarningHandler; +pub const UndefinedEventMask = 0; +pub const NoEventsMask = 0; +pub const ConfigureEventMask = 1; +pub const AnnotateEventMask = 2; +pub const RenderEventMask = 4; +pub const TransformEventMask = 8; +pub const LocaleEventMask = 16; +pub const CoderEventMask = 32; +pub const X11EventMask = 64; +pub const CacheEventMask = 128; +pub const BlobEventMask = 256; +pub const DeprecateEventMask = 512; +pub const UserEventMask = 1024; +pub const ResourceEventMask = 2048; +pub const TemporaryFileEventMask = 4096; +pub const ExceptionEventMask = 458752; +pub const OptionEventMask = 16384; +pub const InformationEventMask = 32768; +pub const WarningEventMask = 65536; +pub const ErrorEventMask = 131072; +pub const FatalErrorEventMask = 262144; +pub const AllEventsMask = 2147483647; +pub const LogEventType = extern enum { + UndefinedEventMask = 0, + NoEventsMask = 0, + ConfigureEventMask = 1, + AnnotateEventMask = 2, + RenderEventMask = 4, + TransformEventMask = 8, + LocaleEventMask = 16, + CoderEventMask = 32, + X11EventMask = 64, + CacheEventMask = 128, + BlobEventMask = 256, + DeprecateEventMask = 512, + UserEventMask = 1024, + ResourceEventMask = 2048, + TemporaryFileEventMask = 4096, + ExceptionEventMask = 458752, + OptionEventMask = 16384, + InformationEventMask = 32768, + WarningEventMask = 65536, + ErrorEventMask = 131072, + FatalErrorEventMask = 262144, + AllEventsMask = 2147483647, +}; +pub const LogMethod = ?extern fn (ExceptionType, [*c]const u8) void; +pub extern fn IsEventLogging() c_uint; +pub extern fn LogMagickEvent(type_0: ExceptionType, module: [*c]const u8, function: [*c]const u8, line: c_ulong, format: [*c]const u8, ...) c_uint; +pub extern fn LogMagickEventList(type_0: ExceptionType, module: [*c]const u8, function: [*c]const u8, line: c_ulong, format: [*c]const u8, operands: [*c]struct___va_list_tag) c_uint; +pub extern fn SetLogEventMask(events: [*c]const u8) c_ulong; +pub extern fn SetLogFormat(format: [*c]const u8) void; +pub extern fn SetLogMethod(arg0: LogMethod) void; +pub extern fn GetElapsedTime(arg0: [*c]TimerInfo) f64; +pub extern fn GetUserTime(arg0: [*c]TimerInfo) f64; +pub extern fn GetTimerResolution() f64; +pub extern fn ContinueTimer(arg0: [*c]TimerInfo) c_uint; +pub extern fn GetTimerInfo(arg0: [*c]TimerInfo) void; +pub extern fn ResetTimer(arg0: [*c]TimerInfo) void; +pub const UnspecifiedAlpha = 0; +pub const AssociatedAlpha = 1; +pub const UnassociatedAlpha = 2; +pub const AlphaType = extern enum { + UnspecifiedAlpha = 0, + AssociatedAlpha = 1, + UnassociatedAlpha = 2, +}; +pub const UndefinedChannel = 0; +pub const RedChannel = 1; +pub const CyanChannel = 2; +pub const GreenChannel = 3; +pub const MagentaChannel = 4; +pub const BlueChannel = 5; +pub const YellowChannel = 6; +pub const OpacityChannel = 7; +pub const BlackChannel = 8; +pub const MatteChannel = 9; +pub const AllChannels = 10; +pub const GrayChannel = 11; +pub const ChannelType = extern enum { + UndefinedChannel = 0, + RedChannel = 1, + CyanChannel = 2, + GreenChannel = 3, + MagentaChannel = 4, + BlueChannel = 5, + YellowChannel = 6, + OpacityChannel = 7, + BlackChannel = 8, + MatteChannel = 9, + AllChannels = 10, + GrayChannel = 11, +}; +pub const NoValue = 0; +pub const XValue = 1; +pub const YValue = 2; +pub const WidthValue = 4; +pub const HeightValue = 8; +pub const AllValues = 15; +pub const XNegative = 16; +pub const YNegative = 32; +pub const PercentValue = 4096; +pub const AspectValue = 8192; +pub const LessValue = 16384; +pub const GreaterValue = 32768; +pub const AreaValue = 65536; +pub const MinimumValue = 131072; +pub const GeometryFlags = extern enum { + NoValue = 0, + XValue = 1, + YValue = 2, + WidthValue = 4, + HeightValue = 8, + AllValues = 15, + XNegative = 16, + YNegative = 32, + PercentValue = 4096, + AspectValue = 8192, + LessValue = 16384, + GreaterValue = 32768, + AreaValue = 65536, + MinimumValue = 131072, +}; +pub const UndefinedType = 0; +pub const BilevelType = 1; +pub const GrayscaleType = 2; +pub const GrayscaleMatteType = 3; +pub const PaletteType = 4; +pub const PaletteMatteType = 5; +pub const TrueColorType = 6; +pub const TrueColorMatteType = 7; +pub const ColorSeparationType = 8; +pub const ColorSeparationMatteType = 9; +pub const OptimizeType = 10; +pub const ImageType = extern enum { + UndefinedType = 0, + BilevelType = 1, + GrayscaleType = 2, + GrayscaleMatteType = 3, + PaletteType = 4, + PaletteMatteType = 5, + TrueColorType = 6, + TrueColorMatteType = 7, + ColorSeparationType = 8, + ColorSeparationMatteType = 9, + OptimizeType = 10, +}; +pub const UndefinedMode = 0; +pub const FrameMode = 1; +pub const UnframeMode = 2; +pub const ConcatenateMode = 3; +pub const MontageMode = extern enum { + UndefinedMode = 0, + FrameMode = 1, + UnframeMode = 2, + ConcatenateMode = 3, +}; +pub const UniformNoise = 0; +pub const GaussianNoise = 1; +pub const MultiplicativeGaussianNoise = 2; +pub const ImpulseNoise = 3; +pub const LaplacianNoise = 4; +pub const PoissonNoise = 5; +pub const RandomNoise = 6; +pub const UndefinedNoise = 7; +pub const NoiseType = extern enum { + UniformNoise = 0, + GaussianNoise = 1, + MultiplicativeGaussianNoise = 2, + ImpulseNoise = 3, + LaplacianNoise = 4, + PoissonNoise = 5, + RandomNoise = 6, + UndefinedNoise = 7, +}; +pub const UndefinedPreview = 0; +pub const RotatePreview = 1; +pub const ShearPreview = 2; +pub const RollPreview = 3; +pub const HuePreview = 4; +pub const SaturationPreview = 5; +pub const BrightnessPreview = 6; +pub const GammaPreview = 7; +pub const SpiffPreview = 8; +pub const DullPreview = 9; +pub const GrayscalePreview = 10; +pub const QuantizePreview = 11; +pub const DespecklePreview = 12; +pub const ReduceNoisePreview = 13; +pub const AddNoisePreview = 14; +pub const SharpenPreview = 15; +pub const BlurPreview = 16; +pub const ThresholdPreview = 17; +pub const EdgeDetectPreview = 18; +pub const SpreadPreview = 19; +pub const SolarizePreview = 20; +pub const ShadePreview = 21; +pub const RaisePreview = 22; +pub const SegmentPreview = 23; +pub const SwirlPreview = 24; +pub const ImplodePreview = 25; +pub const WavePreview = 26; +pub const OilPaintPreview = 27; +pub const CharcoalDrawingPreview = 28; +pub const JPEGPreview = 29; +pub const PreviewType = extern enum { + UndefinedPreview = 0, + RotatePreview = 1, + ShearPreview = 2, + RollPreview = 3, + HuePreview = 4, + SaturationPreview = 5, + BrightnessPreview = 6, + GammaPreview = 7, + SpiffPreview = 8, + DullPreview = 9, + GrayscalePreview = 10, + QuantizePreview = 11, + DespecklePreview = 12, + ReduceNoisePreview = 13, + AddNoisePreview = 14, + SharpenPreview = 15, + BlurPreview = 16, + ThresholdPreview = 17, + EdgeDetectPreview = 18, + SpreadPreview = 19, + SolarizePreview = 20, + ShadePreview = 21, + RaisePreview = 22, + SegmentPreview = 23, + SwirlPreview = 24, + ImplodePreview = 25, + WavePreview = 26, + OilPaintPreview = 27, + CharcoalDrawingPreview = 28, + JPEGPreview = 29, +}; +pub const struct__AffineMatrix = extern struct { + sx: f64, + rx: f64, + ry: f64, + sy: f64, + tx: f64, + ty: f64, +}; +pub const AffineMatrix = struct__AffineMatrix; +pub const struct__DoublePixelPacket = extern struct { + red: f64, + green: f64, + blue: f64, + opacity: f64, +}; +pub const DoublePixelPacket = struct__DoublePixelPacket; +pub const struct__FloatPixelPacket = extern struct { + red: f32, + green: f32, + blue: f32, + opacity: f32, +}; +pub const FloatPixelPacket = struct__FloatPixelPacket; +pub const struct__FrameInfo = extern struct { + width: c_ulong, + height: c_ulong, + x: c_long, + y: c_long, + inner_bevel: c_long, + outer_bevel: c_long, +}; +pub const FrameInfo = struct__FrameInfo; +pub const IndexPacket = Quantum; +pub const struct__LongPixelPacket = extern struct { + red: c_ulong, + green: c_ulong, + blue: c_ulong, + opacity: c_ulong, +}; +pub const LongPixelPacket = struct__LongPixelPacket; +pub const struct__MontageInfo = extern struct { + geometry: [*c]u8, + tile: [*c]u8, + title: [*c]u8, + frame: [*c]u8, + texture: [*c]u8, + font: [*c]u8, + pointsize: f64, + border_width: c_ulong, + shadow: c_uint, + fill: PixelPacket, + stroke: PixelPacket, + background_color: PixelPacket, + border_color: PixelPacket, + matte_color: PixelPacket, + gravity: GravityType, + filename: [2053]u8, + signature: c_ulong, +}; +pub const MontageInfo = struct__MontageInfo; +pub const struct__ProfileInfo = extern struct { + length: usize, + name: [*c]u8, + info: [*c]u8, +}; +pub const ProfileInfo = struct__ProfileInfo; +pub const struct__SegmentInfo = extern struct { + x1: f64, + y1: f64, + x2: f64, + y2: f64, +}; +pub const SegmentInfo = struct__SegmentInfo; +pub const Image = struct__Image; +pub const struct__ImageInfo = extern struct { + compression: CompressionType, + temporary: c_uint, + adjoin: c_uint, + antialias: c_uint, + subimage: c_ulong, + subrange: c_ulong, + depth: c_ulong, + size: [*c]u8, + tile: [*c]u8, + page: [*c]u8, + interlace: InterlaceType, + endian: EndianType, + units: ResolutionType, + quality: c_ulong, + sampling_factor: [*c]u8, + server_name: [*c]u8, + font: [*c]u8, + texture: [*c]u8, + density: [*c]u8, + pointsize: f64, + fuzz: f64, + pen: PixelPacket, + background_color: PixelPacket, + border_color: PixelPacket, + matte_color: PixelPacket, + dither: c_uint, + monochrome: c_uint, + progress: c_uint, + colorspace: ColorspaceType, + type: ImageType, + group: c_long, + verbose: c_uint, + view: [*c]u8, + authenticate: [*c]u8, + client_data: ?*c_void, + file: [*c]FILE, + magick: [2053]u8, + filename: [2053]u8, + cache: _CacheInfoPtr_, + definitions: ?*c_void, + attributes: [*c]Image, + ping: c_uint, + preview_type: PreviewType, + affirm: c_uint, + blob: _BlobInfoPtr_, + length: usize, + unique: [2053]u8, + zero: [2053]u8, + signature: c_ulong, +}; +pub const ImageInfo = struct__ImageInfo; +pub extern fn CatchImageException(arg0: [*c]Image) ExceptionType; +pub extern fn AllocateImage(arg0: [*c]const ImageInfo) [*c]Image; +pub extern fn AppendImages(arg0: [*c]const Image, arg1: c_uint, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn CloneImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: c_uint, arg4: [*c]ExceptionInfo) [*c]Image; +pub extern fn GetImageClipMask(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn GetImageCompositeMask(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn ReferenceImage(arg0: [*c]Image) [*c]Image; +pub extern fn CloneImageInfo(arg0: [*c]const ImageInfo) [*c]ImageInfo; +pub extern fn AccessDefinition(image_info: [*c]const ImageInfo, magick: [*c]const u8, key: [*c]const u8) [*c]const u8; +pub extern fn GetImageGeometry(arg0: [*c]const Image, arg1: [*c]const u8, arg2: c_uint, arg3: [*c]RectangleInfo) c_int; +pub extern fn IsTaintImage(arg0: [*c]const Image) c_uint; +pub extern fn IsSubimage(arg0: [*c]const u8, arg1: c_uint) c_uint; +pub extern fn AddDefinition(image_info: [*c]ImageInfo, magick: [*c]const u8, key: [*c]const u8, value: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn AddDefinitions(image_info: [*c]ImageInfo, options: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn AnimateImages(image_info: [*c]const ImageInfo, image: [*c]Image) c_uint; +pub extern fn ClipImage(image: [*c]Image) c_uint; +pub extern fn ClipPathImage(image: [*c]Image, pathname: [*c]const u8, inside: c_uint) c_uint; +pub extern fn CompositeMaskImage(image: [*c]Image) c_uint; +pub extern fn CompositePathImage(image: [*c]Image, pathname: [*c]const u8, inside: c_uint) c_uint; +pub extern fn DisplayImages(image_info: [*c]const ImageInfo, image: [*c]Image) c_uint; +pub extern fn RemoveDefinitions(image_info: [*c]const ImageInfo, options: [*c]const u8) c_uint; +pub extern fn ResetImagePage(image: [*c]Image, page: [*c]const u8) c_uint; +pub extern fn SetImage(image: [*c]Image, arg1: Quantum) c_uint; +pub extern fn SetImageEx(image: [*c]Image, opacity: Quantum, exception: [*c]ExceptionInfo) c_uint; +pub extern fn SetImageColor(image: [*c]Image, pixel: [*c]const PixelPacket) c_uint; +pub extern fn SetImageColorRegion(image: [*c]Image, x: c_long, y: c_long, width: c_ulong, height: c_ulong, pixel: [*c]const PixelPacket) c_uint; +pub extern fn SetImageClipMask(image: [*c]Image, clip_mask: [*c]const Image) c_uint; +pub extern fn SetImageCompositeMask(image: [*c]Image, composite_mask: [*c]const Image) c_uint; +pub extern fn SetImageDepth(image: [*c]Image, arg1: c_ulong) c_uint; +pub extern fn SetImageInfo(image_info: [*c]ImageInfo, flags: c_uint, exception: [*c]ExceptionInfo) c_uint; +pub extern fn SetImageType(image: [*c]Image, arg1: ImageType) c_uint; +pub extern fn StripImage(image: [*c]Image) c_uint; +pub extern fn SyncImage(image: [*c]Image) c_uint; +pub extern fn AllocateNextImage(arg0: [*c]const ImageInfo, arg1: [*c]Image) void; +pub extern fn DestroyImage(arg0: [*c]Image) void; +pub extern fn DestroyImageInfo(arg0: [*c]ImageInfo) void; +pub extern fn GetImageException(arg0: [*c]Image, arg1: [*c]ExceptionInfo) void; +pub extern fn GetImageInfo(arg0: [*c]ImageInfo) void; +pub extern fn ModifyImage(arg0: [*c]([*c]Image), arg1: [*c]ExceptionInfo) void; +pub extern fn SetImageOpacity(arg0: [*c]Image, arg1: c_uint) void; +pub extern fn ImageGetClipMask(arg0: [*c]const Image) [*c]([*c]Image); +pub extern fn ImageGetCompositeMask(arg0: [*c]const Image) [*c]([*c]Image); +pub const struct__ImageCharacteristics = extern struct { + cmyk: c_uint, + grayscale: c_uint, + monochrome: c_uint, + opaque: c_uint, + palette: c_uint, +}; +pub const ImageCharacteristics = struct__ImageCharacteristics; +pub extern fn GetImageCharacteristics(image: [*c]const Image, characteristics: [*c]ImageCharacteristics, optimize: c_uint, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetImageDepth(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) c_ulong; +pub extern fn IsGrayImage(image: [*c]const Image, exception: [*c]ExceptionInfo) c_uint; +pub extern fn IsMonochromeImage(image: [*c]const Image, exception: [*c]ExceptionInfo) c_uint; +pub extern fn IsOpaqueImage(image: [*c]const Image, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetImageType(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) ImageType; +pub extern fn GetImageBoundingBox(arg0: [*c]const Image, exception: [*c]ExceptionInfo) RectangleInfo; +pub const ImageAttribute = struct__ImageAttribute; +pub extern fn GetImageAttribute(image: [*c]const Image, key: [*c]const u8) [*c]const ImageAttribute; +pub extern fn GetImageClippingPathAttribute(image: [*c]const Image) [*c]const ImageAttribute; +pub extern fn GetImageInfoAttribute(image_info: [*c]const ImageInfo, image: [*c]const Image, key: [*c]const u8) [*c]const ImageAttribute; +pub extern fn CloneImageAttributes(clone_image: [*c]Image, original_image: [*c]const Image) c_uint; +pub extern fn SetImageAttribute(image: [*c]Image, key: [*c]const u8, value: [*c]const u8) c_uint; +pub extern fn DestroyImageAttributes(image: [*c]Image) void; +pub extern fn AverageImages(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub const BlobInfo = struct__BlobInfo; +pub extern fn CloneBlobInfo(blob_info: ?*const BlobInfo) ?*BlobInfo; +pub extern fn ReferenceBlob(blob: ?*BlobInfo) ?*BlobInfo; +pub extern fn DestroyBlobInfo(blob: ?*BlobInfo) void; +pub extern fn DetachBlob(blob: ?*BlobInfo) void; +pub extern fn GetBlobInfo(blob: ?*BlobInfo) void; +pub extern fn AttachBlob(blob_info: ?*BlobInfo, blob: ?*const c_void, length: usize) void; +pub extern fn DestroyBlob(image: [*c]Image) void; +pub extern fn BlobToImage(image_info: [*c]const ImageInfo, blob: ?*const c_void, length: usize, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn PingBlob(image_info: [*c]const ImageInfo, blob: ?*const c_void, length: usize, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ImageToBlob(image_info: [*c]const ImageInfo, image: [*c]Image, length: [*c]usize, exception: [*c]ExceptionInfo) ?*c_void; +pub const UndefinedBlobMode = 0; +pub const ReadBlobMode = 1; +pub const ReadBinaryBlobMode = 2; +pub const WriteBlobMode = 3; +pub const WriteBinaryBlobMode = 4; +pub const BlobMode = extern enum { + UndefinedBlobMode = 0, + ReadBlobMode = 1, + ReadBinaryBlobMode = 2, + WriteBlobMode = 3, + WriteBinaryBlobMode = 4, +}; +pub extern fn OpenBlob(image_info: [*c]const ImageInfo, image: [*c]Image, mode: BlobMode, exception: [*c]ExceptionInfo) c_uint; +pub extern fn CloseBlob(image: [*c]Image) c_uint; +pub extern fn ReadBlob(image: [*c]Image, length: usize, data: ?*c_void) usize; +pub extern fn ReadBlobZC(image: [*c]Image, length: usize, data: [*c](?*c_void)) usize; +pub extern fn WriteBlob(image: [*c]Image, length: usize, data: ?*const c_void) usize; +pub extern fn SeekBlob(image: [*c]Image, offset: magick_off_t, whence: c_int) magick_off_t; +pub extern fn TellBlob(image: [*c]const Image) magick_off_t; +pub extern fn EOFBlob(image: [*c]const Image) c_int; +pub extern fn GetBlobStatus(image: [*c]const Image) c_int; +pub extern fn GetBlobFirstErrno(image: [*c]const Image) c_int; +pub extern fn GetBlobIsOpen(image: [*c]const Image) c_uint; +pub extern fn GetBlobSize(image: [*c]const Image) magick_off_t; +pub extern fn GetBlobFileHandle(image: [*c]const Image) [*c]FILE; +pub extern fn GetBlobStreamData(image: [*c]const Image) [*c]u8; +pub extern fn ReadBlobByte(image: [*c]Image) c_int; +pub extern fn ReadBlobLSBShort(image: [*c]Image) magick_uint16_t; +pub extern fn ReadBlobLSBSignedShort(image: [*c]Image) magick_int16_t; +pub extern fn ReadBlobLSBShorts(image: [*c]Image, octets: usize, data: [*c]magick_uint16_t) usize; +pub extern fn ReadBlobMSBShort(image: [*c]Image) magick_uint16_t; +pub extern fn ReadBlobMSBSignedShort(image: [*c]Image) magick_int16_t; +pub extern fn ReadBlobMSBShorts(image: [*c]Image, octets: usize, data: [*c]magick_uint16_t) usize; +pub extern fn ReadBlobLSBLong(image: [*c]Image) magick_uint32_t; +pub extern fn ReadBlobLSBSignedLong(image: [*c]Image) magick_int32_t; +pub extern fn ReadBlobLSBLongs(image: [*c]Image, octets: usize, data: [*c]magick_uint32_t) usize; +pub extern fn ReadBlobMSBLong(image: [*c]Image) magick_uint32_t; +pub extern fn ReadBlobMSBSignedLong(image: [*c]Image) magick_int32_t; +pub extern fn ReadBlobMSBLongs(image: [*c]Image, octets: usize, data: [*c]magick_uint32_t) usize; +pub extern fn ReadBlobLSBFloat(image: [*c]Image) f32; +pub extern fn ReadBlobLSBFloats(image: [*c]Image, octets: usize, data: [*c]f32) usize; +pub extern fn ReadBlobMSBFloat(image: [*c]Image) f32; +pub extern fn ReadBlobMSBFloats(image: [*c]Image, octets: usize, data: [*c]f32) usize; +pub extern fn ReadBlobLSBDouble(image: [*c]Image) f64; +pub extern fn ReadBlobLSBDoubles(image: [*c]Image, octets: usize, data: [*c]f64) usize; +pub extern fn ReadBlobMSBDouble(image: [*c]Image) f64; +pub extern fn ReadBlobMSBDoubles(image: [*c]Image, octets: usize, data: [*c]f64) usize; +pub extern fn ReadBlobString(image: [*c]Image, string: [*c]u8) [*c]u8; +pub extern fn WriteBlobByte(image: [*c]Image, value: magick_uint8_t) usize; +pub extern fn WriteBlobFile(image: [*c]Image, filename: [*c]const u8) c_uint; +pub extern fn WriteBlobLSBShort(image: [*c]Image, value: magick_uint16_t) usize; +pub extern fn WriteBlobLSBSignedShort(image: [*c]Image, value: magick_int16_t) usize; +pub extern fn WriteBlobLSBLong(image: [*c]Image, value: magick_uint32_t) usize; +pub extern fn WriteBlobLSBSignedLong(image: [*c]Image, value: magick_int32_t) usize; +pub extern fn WriteBlobMSBLong(image: [*c]Image, value: magick_uint32_t) usize; +pub extern fn WriteBlobMSBSignedLong(image: [*c]Image, value: magick_int32_t) usize; +pub extern fn WriteBlobMSBShort(image: [*c]Image, value: magick_uint16_t) usize; +pub extern fn WriteBlobMSBSignedShort(image: [*c]Image, value: magick_int16_t) usize; +pub extern fn WriteBlobString(image: [*c]Image, string: [*c]const u8) usize; +pub extern fn BlobIsSeekable(image: [*c]const Image) c_uint; +pub extern fn SetBlobClosable(image: [*c]Image, closable: c_uint) void; +pub extern fn SetBlobTemporary(image: [*c]Image, isTemporary: c_uint) void; +pub extern fn GetBlobTemporary(image: [*c]const Image) c_uint; +pub const ReadMode = 0; +pub const WriteMode = 1; +pub const IOMode = 2; +pub const MapMode = extern enum { + ReadMode = 0, + WriteMode = 1, + IOMode = 2, +}; +pub extern fn UnmapBlob(map: ?*c_void, length: usize) c_uint; +pub extern fn MapBlob(file: c_int, mode: MapMode, offset: magick_off_t, length: usize) ?*c_void; +pub extern fn BlobToFile(filename: [*c]const u8, blob: ?*const c_void, length: usize, exception: [*c]ExceptionInfo) c_uint; +pub extern fn FileToBlob(filename: [*c]const u8, length: [*c]usize, exception: [*c]ExceptionInfo) ?*c_void; +pub extern fn BlobReserveSize(image: [*c]Image, size: magick_off_t) c_uint; +pub extern fn ImageToFile(image: [*c]Image, filename: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetConfigureBlob(filename: [*c]const u8, path: [*c]u8, length: [*c]usize, exception: [*c]ExceptionInfo) ?*c_void; +pub extern fn MSBOrderLong(buffer: [*c]u8, length: usize) void; +pub extern fn MSBOrderShort(p: [*c]u8, length: usize) void; +pub extern fn DisassociateBlob(arg0: [*c]Image) void; +pub extern fn CdlImage(image: [*c]Image, cdl: [*c]const u8) c_uint; +pub extern fn ExportImageChannel(image: [*c]const Image, channel: ChannelType, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn GetImageChannelDepth(image: [*c]const Image, channel: ChannelType, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ChannelImage(image: [*c]Image, channel: ChannelType) c_uint; +pub extern fn ImportImageChannel(src_image: [*c]const Image, dst_image: [*c]Image, channel: ChannelType) c_uint; +pub extern fn ImportImageChannelsMasked(source_image: [*c]const Image, update_image: [*c]Image, channels: ChannelType) c_uint; +pub extern fn SetImageChannelDepth(image: [*c]Image, channel: ChannelType, depth: c_uint) c_uint; +pub const struct__HistogramColorPacket = extern struct { + pixel: PixelPacket, + count: c_ulong, +}; +pub const HistogramColorPacket = struct__HistogramColorPacket; +pub extern fn GetColorHistogram(image: [*c]const Image, colors: [*c]c_ulong, exception: [*c]ExceptionInfo) [*c]HistogramColorPacket; +pub extern fn GetNumberColors(image: [*c]const Image, file: [*c]FILE, exception: [*c]ExceptionInfo) c_ulong; +pub extern fn GetColorTuple(color: [*c]const PixelPacket, depth: c_uint, matte: c_uint, hex: c_uint, tuple: [*c]u8) void; +pub extern fn IsPaletteImage(image: [*c]const Image, exception: [*c]ExceptionInfo) c_uint; +pub const UndefinedCompliance = 0; +pub const NoCompliance = 0; +pub const SVGCompliance = 1; +pub const X11Compliance = 2; +pub const XPMCompliance = 4; +pub const AllCompliance = 65535; +pub const ComplianceType = extern enum { + UndefinedCompliance = 0, + NoCompliance = 0, + SVGCompliance = 1, + X11Compliance = 2, + XPMCompliance = 4, + AllCompliance = 65535, +}; +pub extern fn GetColorList(pattern: [*c]const u8, number_colors: [*c]c_ulong) [*c]([*c]u8); +pub extern fn QueryColorDatabase(name: [*c]const u8, color: [*c]PixelPacket, exception: [*c]ExceptionInfo) c_uint; +pub extern fn QueryColorname(image: [*c]const Image, color: [*c]const PixelPacket, compliance: ComplianceType, name: [*c]u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn AllocateImageColormap(arg0: [*c]Image, colors: c_ulong) c_uint; +pub extern fn CycleColormapImage(image: [*c]Image, amount: c_int) c_uint; +pub extern fn ReallocateImageColormap(arg0: [*c]Image, colors: c_uint) c_uint; +pub extern fn ReplaceImageColormap(image: [*c]Image, colormap: [*c]const PixelPacket, colors: c_uint) c_uint; +pub extern fn SortColormapByIntensity(image: [*c]Image) c_uint; +pub extern fn AnimateImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn BenchmarkImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn CompareImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn CompositeImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn ConjureImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn ConvertImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn DisplayImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn IdentifyImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn ImportImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn MagickCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn MogrifyImage(arg0: [*c]const ImageInfo, arg1: c_int, arg2: [*c]([*c]u8), arg3: [*c]([*c]Image)) c_uint; +pub extern fn MogrifyImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn MogrifyImages(arg0: [*c]const ImageInfo, arg1: c_int, arg2: [*c]([*c]u8), arg3: [*c]([*c]Image)) c_uint; +pub extern fn MontageImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn TimeImageCommand(image_info: [*c]ImageInfo, argc: c_int, argv: [*c]([*c]u8), metadata: [*c]([*c]u8), exception: [*c]ExceptionInfo) c_uint; +pub extern fn GMCommand(argc: c_int, argv: [*c]([*c]u8)) c_int; +pub const UndefinedHighlightStyle = 0; +pub const AssignHighlightStyle = 1; +pub const ThresholdHighlightStyle = 2; +pub const TintHighlightStyle = 3; +pub const XorHighlightStyle = 4; +pub const HighlightStyle = extern enum { + UndefinedHighlightStyle = 0, + AssignHighlightStyle = 1, + ThresholdHighlightStyle = 2, + TintHighlightStyle = 3, + XorHighlightStyle = 4, +}; +pub const struct__DifferenceImageOptions = extern struct { + channel: ChannelType, + highlight_style: HighlightStyle, + highlight_color: PixelPacket, +}; +pub const DifferenceImageOptions = struct__DifferenceImageOptions; +pub extern fn InitializeDifferenceImageOptions(options: [*c]DifferenceImageOptions, exception: [*c]ExceptionInfo) void; +pub extern fn DifferenceImage(reference_image: [*c]const Image, compare_image: [*c]const Image, difference_options: [*c]const DifferenceImageOptions, exception: [*c]ExceptionInfo) [*c]Image; +pub const UndefinedMetric = 0; +pub const MeanAbsoluteErrorMetric = 1; +pub const MeanSquaredErrorMetric = 2; +pub const PeakAbsoluteErrorMetric = 3; +pub const PeakSignalToNoiseRatioMetric = 4; +pub const RootMeanSquaredErrorMetric = 5; +pub const MetricType = extern enum { + UndefinedMetric = 0, + MeanAbsoluteErrorMetric = 1, + MeanSquaredErrorMetric = 2, + PeakAbsoluteErrorMetric = 3, + PeakSignalToNoiseRatioMetric = 4, + RootMeanSquaredErrorMetric = 5, +}; +pub const struct__DifferenceStatistics = extern struct { + red: f64, + green: f64, + blue: f64, + opacity: f64, + combined: f64, +}; +pub const DifferenceStatistics = struct__DifferenceStatistics; +pub extern fn InitializeDifferenceStatistics(difference_statistics: [*c]DifferenceStatistics, exception: [*c]ExceptionInfo) void; +pub extern fn GetImageChannelDifference(reference_image: [*c]const Image, compare_image: [*c]const Image, metric: MetricType, statistics: [*c]DifferenceStatistics, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetImageChannelDistortion(reference_image: [*c]const Image, compare_image: [*c]const Image, channel: ChannelType, metric: MetricType, distortion: [*c]f64, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetImageDistortion(reference_image: [*c]const Image, compare_image: [*c]const Image, metric: MetricType, distortion: [*c]f64, exception: [*c]ExceptionInfo) c_uint; +pub extern fn IsImagesEqual(arg0: [*c]Image, arg1: [*c]const Image) c_uint; +pub const struct__CompositeOptions_t = extern struct { + percent_brightness: f64, + amount: f64, + threshold: f64, +}; +pub const CompositeOptions_t = struct__CompositeOptions_t; +pub extern fn CompositeImage(canvas_image: [*c]Image, compose: CompositeOperator, update_image: [*c]const Image, x_offset: c_long, y_offset: c_long) c_uint; +pub extern fn CompositeImageRegion(compose: CompositeOperator, options: [*c]const CompositeOptions_t, columns: c_ulong, rows: c_ulong, update_image: [*c]const Image, update_x: c_long, update_y: c_long, canvas_image: [*c]Image, canvas_x: c_long, canvas_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub extern fn MagickCompositeImageUnderColor(image: [*c]Image, undercolor: [*c]const PixelPacket, exception: [*c]ExceptionInfo) c_uint; +pub const Ascii85Info = struct__Ascii85Info; +pub const WriteByteHook = ?extern fn ([*c]Image, magick_uint8_t, ?*c_void) c_uint; +pub extern fn Ascii85WriteByteHook(image: [*c]Image, code: magick_uint8_t, info: ?*c_void) c_uint; +pub extern fn BlobWriteByteHook(image: [*c]Image, code: magick_uint8_t, info: ?*c_void) c_uint; +pub extern fn HuffmanDecodeImage(image: [*c]Image) c_uint; +pub extern fn HuffmanEncodeImage(image_info: [*c]const ImageInfo, image: [*c]Image) c_uint; +pub extern fn HuffmanEncode2Image(image_info: [*c]const ImageInfo, image: [*c]Image, write_byte: WriteByteHook, info: ?*c_void) c_uint; +pub extern fn LZWEncodeImage(image: [*c]Image, length: usize, pixels: [*c]magick_uint8_t) c_uint; +pub extern fn LZWEncode2Image(image: [*c]Image, length: usize, pixels: [*c]magick_uint8_t, write_byte: WriteByteHook, info: ?*c_void) c_uint; +pub extern fn PackbitsEncodeImage(image: [*c]Image, length: usize, pixels: [*c]magick_uint8_t) c_uint; +pub extern fn PackbitsEncode2Image(image: [*c]Image, length: usize, pixels: [*c]magick_uint8_t, write_byte: WriteByteHook, info: ?*c_void) c_uint; +pub extern fn ImageToHuffman2DBlob(image: [*c]const Image, image_info: [*c]const ImageInfo, length: [*c]usize, exception: [*c]ExceptionInfo) [*c]u8; +pub extern fn ImageToJPEGBlob(image: [*c]const Image, image_info: [*c]const ImageInfo, length: [*c]usize, exception: [*c]ExceptionInfo) [*c]u8; +pub extern fn Ascii85Encode(image: [*c]Image, code: magick_uint8_t) void; +pub extern fn Ascii85Flush(image: [*c]Image) void; +pub extern fn Ascii85Initialize(image: [*c]Image) void; +pub const UndefinedConfirmAccessMode = 0; +pub const FileExecuteConfirmAccessMode = 1; +pub const FileReadConfirmAccessMode = 2; +pub const FileWriteConfirmAccessMode = 3; +pub const URLGetFTPConfirmAccessMode = 4; +pub const URLGetFileConfirmAccessMode = 5; +pub const URLGetHTTPConfirmAccessMode = 6; +pub const ConfirmAccessMode = extern enum { + UndefinedConfirmAccessMode = 0, + FileExecuteConfirmAccessMode = 1, + FileReadConfirmAccessMode = 2, + FileWriteConfirmAccessMode = 3, + URLGetFTPConfirmAccessMode = 4, + URLGetFileConfirmAccessMode = 5, + URLGetHTTPConfirmAccessMode = 6, +}; +pub const ConfirmAccessHandler = ?extern fn (ConfirmAccessMode, [*c]const u8, [*c]ExceptionInfo) c_uint; +pub extern fn MagickConfirmAccess(mode: ConfirmAccessMode, path: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn MagickSetConfirmAccessHandler(handler: ConfirmAccessHandler) ConfirmAccessHandler; +pub const UndefinedQuantum = 0; +pub const IndexQuantum = 1; +pub const GrayQuantum = 2; +pub const IndexAlphaQuantum = 3; +pub const GrayAlphaQuantum = 4; +pub const RedQuantum = 5; +pub const CyanQuantum = 6; +pub const GreenQuantum = 7; +pub const YellowQuantum = 8; +pub const BlueQuantum = 9; +pub const MagentaQuantum = 10; +pub const AlphaQuantum = 11; +pub const BlackQuantum = 12; +pub const RGBQuantum = 13; +pub const RGBAQuantum = 14; +pub const CMYKQuantum = 15; +pub const CMYKAQuantum = 16; +pub const CIEYQuantum = 17; +pub const CIEXYZQuantum = 18; +pub const QuantumType = extern enum { + UndefinedQuantum = 0, + IndexQuantum = 1, + GrayQuantum = 2, + IndexAlphaQuantum = 3, + GrayAlphaQuantum = 4, + RedQuantum = 5, + CyanQuantum = 6, + GreenQuantum = 7, + YellowQuantum = 8, + BlueQuantum = 9, + MagentaQuantum = 10, + AlphaQuantum = 11, + BlackQuantum = 12, + RGBQuantum = 13, + RGBAQuantum = 14, + CMYKQuantum = 15, + CMYKAQuantum = 16, + CIEYQuantum = 17, + CIEXYZQuantum = 18, +}; +pub const UndefinedQuantumSampleType = 0; +pub const UnsignedQuantumSampleType = 1; +pub const FloatQuantumSampleType = 2; +pub const QuantumSampleType = extern enum { + UndefinedQuantumSampleType = 0, + UnsignedQuantumSampleType = 1, + FloatQuantumSampleType = 2, +}; +pub const CharPixel = 0; +pub const ShortPixel = 1; +pub const IntegerPixel = 2; +pub const LongPixel = 3; +pub const FloatPixel = 4; +pub const DoublePixel = 5; +pub const StorageType = extern enum { + CharPixel = 0, + ShortPixel = 1, + IntegerPixel = 2, + LongPixel = 3, + FloatPixel = 4, + DoublePixel = 5, +}; +pub const struct__ExportPixelAreaOptions = extern struct { + sample_type: QuantumSampleType, + double_minvalue: f64, + double_maxvalue: f64, + grayscale_miniswhite: c_uint, + pad_bytes: c_ulong, + pad_value: u8, + endian: EndianType, + signature: c_ulong, +}; +pub const ExportPixelAreaOptions = struct__ExportPixelAreaOptions; +pub const struct__ExportPixelAreaInfo = extern struct { + bytes_exported: usize, +}; +pub const ExportPixelAreaInfo = struct__ExportPixelAreaInfo; +pub const struct__ImportPixelAreaOptions = extern struct { + sample_type: QuantumSampleType, + double_minvalue: f64, + double_maxvalue: f64, + grayscale_miniswhite: c_uint, + endian: EndianType, + signature: c_ulong, +}; +pub const ImportPixelAreaOptions = struct__ImportPixelAreaOptions; +pub const struct__ImportPixelAreaInfo = extern struct { + bytes_imported: usize, +}; +pub const ImportPixelAreaInfo = struct__ImportPixelAreaInfo; +pub extern fn StorageTypeToString(storage_type: StorageType) [*c]const u8; +pub extern fn QuantumSampleTypeToString(sample_type: QuantumSampleType) [*c]const u8; +pub extern fn QuantumTypeToString(quantum_type: QuantumType) [*c]const u8; +pub extern fn ConstituteImage(width: c_ulong, height: c_ulong, map: [*c]const u8, type_0: StorageType, pixels: ?*const c_void, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ConstituteTextureImage(columns: c_ulong, rows: c_ulong, texture: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn PingImage(image_info: [*c]const ImageInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ReadImage(image_info: [*c]const ImageInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ReadInlineImage(image_info: [*c]const ImageInfo, content: [*c]const u8, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn DispatchImage(image: [*c]const Image, x_offset: c_long, y_offset: c_long, columns: c_ulong, rows: c_ulong, map: [*c]const u8, type_0: StorageType, pixels: ?*c_void, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ExportImagePixelArea(image: [*c]const Image, quantum_type: QuantumType, quantum_size: c_uint, destination: [*c]u8, options: [*c]const ExportPixelAreaOptions, export_info: [*c]ExportPixelAreaInfo) c_uint; +pub extern fn ExportViewPixelArea(view: [*c]const ViewInfo, quantum_type: QuantumType, quantum_size: c_uint, destination: [*c]u8, options: [*c]const ExportPixelAreaOptions, export_info: [*c]ExportPixelAreaInfo) c_uint; +pub extern fn ImportImagePixelArea(image: [*c]Image, quantum_type: QuantumType, quantum_size: c_uint, source: [*c]const u8, options: [*c]const ImportPixelAreaOptions, import_info: [*c]ImportPixelAreaInfo) c_uint; +pub extern fn ImportViewPixelArea(view: [*c]ViewInfo, quantum_type: QuantumType, quantum_size: c_uint, source: [*c]const u8, options: [*c]const ImportPixelAreaOptions, import_info: [*c]ImportPixelAreaInfo) c_uint; +pub extern fn WriteImage(image_info: [*c]const ImageInfo, image: [*c]Image) c_uint; +pub extern fn WriteImages(image_info: [*c]const ImageInfo, image: [*c]Image, filename: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn WriteImagesFile(image_info: [*c]const ImageInfo, image: [*c]Image, file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ExportPixelAreaOptionsInit(options: [*c]ExportPixelAreaOptions) void; +pub extern fn ImportPixelAreaOptionsInit(options: [*c]ImportPixelAreaOptions) void; +pub extern fn MagickFindRawImageMinMax(image: [*c]Image, endian: EndianType, width: c_ulong, height: c_ulong, type_0: StorageType, scanline_octets: c_uint, scanline_buffer: ?*c_void, min: [*c]f64, max: [*c]f64) c_uint; +pub extern fn MagickGetQuantumSamplesPerPixel(quantum_type: QuantumType) c_uint; +pub extern fn BorderImage(arg0: [*c]const Image, arg1: [*c]const RectangleInfo, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn FrameImage(arg0: [*c]const Image, arg1: [*c]const FrameInfo, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn RaiseImage(arg0: [*c]Image, arg1: [*c]const RectangleInfo, arg2: c_int) c_uint; +pub const struct__DelegateInfo = extern struct { + path: [*c]u8, + decode: [*c]u8, + encode: [*c]u8, + commands: [*c]u8, + mode: c_int, + stealth: c_uint, + signature: c_ulong, + previous: [*c]struct__DelegateInfo, + next: [*c]struct__DelegateInfo, +}; +pub const DelegateInfo = struct__DelegateInfo; +pub extern fn GetDelegateCommand(image_info: [*c]const ImageInfo, image: [*c]Image, decode: [*c]const u8, encode: [*c]const u8, exception: [*c]ExceptionInfo) [*c]u8; +pub extern fn GetDelegateInfo(decode: [*c]const u8, encode: [*c]const u8, exception: [*c]ExceptionInfo) [*c]const DelegateInfo; +pub extern fn GetPostscriptDelegateInfo(image_info: [*c]const ImageInfo, antialias: [*c]c_uint, exception: [*c]ExceptionInfo) [*c]const DelegateInfo; +pub extern fn SetDelegateInfo(arg0: [*c]DelegateInfo) [*c]DelegateInfo; +pub extern fn InvokePostscriptDelegate(verbose: c_uint, command: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn InvokeDelegate(image_info: [*c]ImageInfo, image: [*c]Image, decode: [*c]const u8, encode: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ListDelegateInfo(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn PopImagePixels(arg0: [*c]const Image, arg1: QuantumType, arg2: [*c]u8) c_uint; +pub extern fn PushImagePixels(arg0: [*c]Image, arg1: QuantumType, arg2: [*c]const u8) c_uint; +pub extern fn AcquireMemory(arg0: usize) ?*c_void; +pub extern fn CloneMemory(arg0: ?*c_void, arg1: ?*const c_void, arg2: usize) ?*c_void; +pub extern fn LiberateMemory(arg0: [*c](?*c_void)) void; +pub extern fn ReacquireMemory(arg0: [*c](?*c_void), arg1: usize) void; +pub extern fn AcquireCacheView(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]const PixelPacket; +pub extern fn GetCacheView(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong) [*c]PixelPacket; +pub extern fn SetCacheView(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong) [*c]PixelPacket; +pub extern fn SyncCacheView(view: [*c]ViewInfo) c_uint; +pub extern fn DescribeImage(image: [*c]Image, file: [*c]FILE, verbose: c_uint) c_uint; +pub const NormalStretch = 0; +pub const UltraCondensedStretch = 1; +pub const ExtraCondensedStretch = 2; +pub const CondensedStretch = 3; +pub const SemiCondensedStretch = 4; +pub const SemiExpandedStretch = 5; +pub const ExpandedStretch = 6; +pub const ExtraExpandedStretch = 7; +pub const UltraExpandedStretch = 8; +pub const AnyStretch = 9; +pub const StretchType = extern enum { + NormalStretch = 0, + UltraCondensedStretch = 1, + ExtraCondensedStretch = 2, + CondensedStretch = 3, + SemiCondensedStretch = 4, + SemiExpandedStretch = 5, + ExpandedStretch = 6, + ExtraExpandedStretch = 7, + UltraExpandedStretch = 8, + AnyStretch = 9, +}; +pub const NormalStyle = 0; +pub const ItalicStyle = 1; +pub const ObliqueStyle = 2; +pub const AnyStyle = 3; +pub const StyleType = extern enum { + NormalStyle = 0, + ItalicStyle = 1, + ObliqueStyle = 2, + AnyStyle = 3, +}; +pub const struct__TypeInfo = extern struct { + path: [*c]u8, + name: [*c]u8, + description: [*c]u8, + family: [*c]u8, + style: StyleType, + stretch: StretchType, + weight: c_ulong, + encoding: [*c]u8, + foundry: [*c]u8, + format: [*c]u8, + metrics: [*c]u8, + glyphs: [*c]u8, + stealth: c_uint, + signature: c_ulong, + previous: [*c]struct__TypeInfo, + next: [*c]struct__TypeInfo, +}; +pub const TypeInfo = struct__TypeInfo; +pub extern fn GetTypeList(arg0: [*c]const u8, arg1: [*c]c_ulong) [*c]([*c]u8); +pub extern fn ListTypeInfo(arg0: [*c]FILE, arg1: [*c]ExceptionInfo) c_uint; +pub extern fn GetTypeInfo(arg0: [*c]const u8, arg1: [*c]ExceptionInfo) [*c]const TypeInfo; +pub extern fn GetTypeInfoByFamily(arg0: [*c]const u8, arg1: StyleType, arg2: StretchType, arg3: c_ulong, arg4: [*c]ExceptionInfo) [*c]const TypeInfo; +pub const UndefinedAlign = 0; +pub const LeftAlign = 1; +pub const CenterAlign = 2; +pub const RightAlign = 3; +pub const AlignType = extern enum { + UndefinedAlign = 0, + LeftAlign = 1, + CenterAlign = 2, + RightAlign = 3, +}; +pub const UserSpace = 0; +pub const UserSpaceOnUse = 1; +pub const ObjectBoundingBox = 2; +pub const ClipPathUnits = extern enum { + UserSpace = 0, + UserSpaceOnUse = 1, + ObjectBoundingBox = 2, +}; +pub const NoDecoration = 0; +pub const UnderlineDecoration = 1; +pub const OverlineDecoration = 2; +pub const LineThroughDecoration = 3; +pub const DecorationType = extern enum { + NoDecoration = 0, + UnderlineDecoration = 1, + OverlineDecoration = 2, + LineThroughDecoration = 3, +}; +pub const UndefinedRule = 0; +pub const EvenOddRule = 1; +pub const NonZeroRule = 2; +pub const FillRule = extern enum { + UndefinedRule = 0, + EvenOddRule = 1, + NonZeroRule = 2, +}; +pub const UndefinedGradient = 0; +pub const LinearGradient = 1; +pub const RadialGradient = 2; +pub const GradientType = extern enum { + UndefinedGradient = 0, + LinearGradient = 1, + RadialGradient = 2, +}; +pub const UndefinedCap = 0; +pub const ButtCap = 1; +pub const RoundCap = 2; +pub const SquareCap = 3; +pub const LineCap = extern enum { + UndefinedCap = 0, + ButtCap = 1, + RoundCap = 2, + SquareCap = 3, +}; +pub const UndefinedJoin = 0; +pub const MiterJoin = 1; +pub const RoundJoin = 2; +pub const BevelJoin = 3; +pub const LineJoin = extern enum { + UndefinedJoin = 0, + MiterJoin = 1, + RoundJoin = 2, + BevelJoin = 3, +}; +pub const PointMethod = 0; +pub const ReplaceMethod = 1; +pub const FloodfillMethod = 2; +pub const FillToBorderMethod = 3; +pub const ResetMethod = 4; +pub const PaintMethod = extern enum { + PointMethod = 0, + ReplaceMethod = 1, + FloodfillMethod = 2, + FillToBorderMethod = 3, + ResetMethod = 4, +}; +pub const UndefinedPrimitive = 0; +pub const PointPrimitive = 1; +pub const LinePrimitive = 2; +pub const RectanglePrimitive = 3; +pub const RoundRectanglePrimitive = 4; +pub const ArcPrimitive = 5; +pub const EllipsePrimitive = 6; +pub const CirclePrimitive = 7; +pub const PolylinePrimitive = 8; +pub const PolygonPrimitive = 9; +pub const BezierPrimitive = 10; +pub const ColorPrimitive = 11; +pub const MattePrimitive = 12; +pub const TextPrimitive = 13; +pub const ImagePrimitive = 14; +pub const PathPrimitive = 15; +pub const PrimitiveType = extern enum { + UndefinedPrimitive = 0, + PointPrimitive = 1, + LinePrimitive = 2, + RectanglePrimitive = 3, + RoundRectanglePrimitive = 4, + ArcPrimitive = 5, + EllipsePrimitive = 6, + CirclePrimitive = 7, + PolylinePrimitive = 8, + PolygonPrimitive = 9, + BezierPrimitive = 10, + ColorPrimitive = 11, + MattePrimitive = 12, + TextPrimitive = 13, + ImagePrimitive = 14, + PathPrimitive = 15, +}; +pub const UndefinedReference = 0; +pub const GradientReference = 1; +pub const ReferenceType = extern enum { + UndefinedReference = 0, + GradientReference = 1, +}; +pub const UndefinedSpread = 0; +pub const PadSpread = 1; +pub const ReflectSpead = 2; +pub const RepeatSpread = 3; +pub const SpreadMethod = extern enum { + UndefinedSpread = 0, + PadSpread = 1, + ReflectSpead = 2, + RepeatSpread = 3, +}; +pub const struct__GradientInfo = extern struct { + type: GradientType, + color: PixelPacket, + stop: SegmentInfo, + length: c_ulong, + spread: SpreadMethod, + signature: c_ulong, + previous: [*c]struct__GradientInfo, + next: [*c]struct__GradientInfo, +}; +pub const GradientInfo = struct__GradientInfo; +pub const struct__ElementReference = extern struct { + id: [*c]u8, + type: ReferenceType, + gradient: GradientInfo, + signature: c_ulong, + previous: [*c]struct__ElementReference, + next: [*c]struct__ElementReference, +}; +pub const ElementReference = struct__ElementReference; +pub const struct__DrawInfoExtra = @OpaqueType(); +pub const struct__DrawInfo = extern struct { + primitive: [*c]u8, + geometry: [*c]u8, + affine: AffineMatrix, + gravity: GravityType, + fill: PixelPacket, + stroke: PixelPacket, + stroke_width: f64, + gradient: GradientInfo, + fill_pattern: [*c]Image, + tile: [*c]Image, + stroke_pattern: [*c]Image, + stroke_antialias: c_uint, + text_antialias: c_uint, + fill_rule: FillRule, + linecap: LineCap, + linejoin: LineJoin, + miterlimit: c_ulong, + dash_offset: f64, + decorate: DecorationType, + compose: CompositeOperator, + text: [*c]u8, + font: [*c]u8, + family: [*c]u8, + style: StyleType, + stretch: StretchType, + weight: c_ulong, + encoding: [*c]u8, + pointsize: f64, + density: [*c]u8, + @"align": AlignType, + undercolor: PixelPacket, + border_color: PixelPacket, + server_name: [*c]u8, + dash_pattern: [*c]f64, + extra: ?*struct__DrawInfoExtra, + bounds: SegmentInfo, + clip_units: ClipPathUnits, + opacity: Quantum, + render: c_uint, + flags: c_uint, + element_reference: ElementReference, + signature: c_ulong, +}; +pub const DrawInfo = struct__DrawInfo; +pub const struct__PointInfo = extern struct { + x: f64, + y: f64, +}; +pub const PointInfo = struct__PointInfo; +pub const struct__TypeMetric = extern struct { + pixels_per_em: PointInfo, + ascent: f64, + descent: f64, + width: f64, + height: f64, + max_advance: f64, + bounds: SegmentInfo, + underline_position: f64, + underline_thickness: f64, +}; +pub const TypeMetric = struct__TypeMetric; +pub extern fn CloneDrawInfo(arg0: [*c]const ImageInfo, arg1: [*c]const DrawInfo) [*c]DrawInfo; +pub extern fn AnnotateImage(arg0: [*c]Image, arg1: [*c]const DrawInfo) c_uint; +pub extern fn DrawAffineImage(arg0: [*c]Image, arg1: [*c]const Image, arg2: [*c]const AffineMatrix) c_uint; +pub extern fn DrawClipPath(arg0: [*c]Image, arg1: [*c]const DrawInfo, arg2: [*c]const u8) c_uint; +pub extern fn DrawImage(arg0: [*c]Image, arg1: [*c]const DrawInfo) c_uint; +pub extern fn DrawPatternPath(arg0: [*c]Image, arg1: [*c]const DrawInfo, arg2: [*c]const u8, arg3: [*c]([*c]Image)) c_uint; +pub extern fn GetTypeMetrics(arg0: [*c]Image, arg1: [*c]const DrawInfo, arg2: [*c]TypeMetric) c_uint; +pub extern fn DestroyDrawInfo(arg0: [*c]DrawInfo) void; +pub extern fn GetDrawInfo(arg0: [*c]const ImageInfo, arg1: [*c]DrawInfo) void; +pub extern fn DrawInfoGetClipPath(arg0: [*c]const DrawInfo) [*c]([*c]u8); +pub extern fn DrawInfoGetCompositePath(arg0: [*c]const DrawInfo) [*c]([*c]u8); +pub const struct__DrawContext = @OpaqueType(); +pub const DrawContext = ?*struct__DrawContext; +pub extern fn DrawGetClipUnits(context: DrawContext) ClipPathUnits; +pub extern fn DrawPeekGraphicContext(context: DrawContext) [*c]DrawInfo; +pub extern fn DrawGetTextDecoration(context: DrawContext) DecorationType; +pub extern fn DrawAllocateContext(draw_info: [*c]const DrawInfo, image: [*c]Image) DrawContext; +pub extern fn DrawGetClipRule(context: DrawContext) FillRule; +pub extern fn DrawGetFillRule(context: DrawContext) FillRule; +pub extern fn DrawGetGravity(context: DrawContext) GravityType; +pub extern fn DrawGetStrokeLineCap(context: DrawContext) LineCap; +pub extern fn DrawGetStrokeLineJoin(context: DrawContext) LineJoin; +pub extern fn DrawGetFillColor(context: DrawContext) PixelPacket; +pub extern fn DrawGetStrokeColor(context: DrawContext) PixelPacket; +pub extern fn DrawGetTextUnderColor(context: DrawContext) PixelPacket; +pub extern fn DrawGetFontStretch(context: DrawContext) StretchType; +pub extern fn DrawGetFontStyle(context: DrawContext) StyleType; +pub extern fn DrawGetClipPath(context: DrawContext) [*c]u8; +pub extern fn DrawGetFont(context: DrawContext) [*c]u8; +pub extern fn DrawGetFontFamily(context: DrawContext) [*c]u8; +pub extern fn DrawGetTextEncoding(context: DrawContext) [*c]u8; +pub extern fn DrawRender(context: DrawContext) c_int; +pub extern fn DrawGetStrokeAntialias(context: DrawContext) c_uint; +pub extern fn DrawGetTextAntialias(context: DrawContext) c_uint; +pub extern fn DrawGetFontWeight(context: DrawContext) c_ulong; +pub extern fn DrawGetStrokeMiterLimit(context: DrawContext) c_ulong; +pub extern fn DrawGetFillOpacity(context: DrawContext) f64; +pub extern fn DrawGetFontSize(context: DrawContext) f64; +pub extern fn DrawGetStrokeDashArray(context: DrawContext, num_elems: [*c]c_ulong) [*c]f64; +pub extern fn DrawGetStrokeDashOffset(context: DrawContext) f64; +pub extern fn DrawGetStrokeOpacity(context: DrawContext) f64; +pub extern fn DrawGetStrokeWidth(context: DrawContext) f64; +pub extern fn DrawAffine(context: DrawContext, affine: [*c]const AffineMatrix) void; +pub extern fn DrawAnnotation(context: DrawContext, x: f64, y: f64, text: [*c]const u8) void; +pub extern fn DrawArc(context: DrawContext, sx: f64, sy: f64, ex: f64, ey: f64, sd: f64, ed: f64) void; +pub extern fn DrawBezier(context: DrawContext, num_coords: c_ulong, coordinates: [*c]const PointInfo) void; +pub extern fn DrawCircle(context: DrawContext, ox: f64, oy: f64, px: f64, py: f64) void; +pub extern fn DrawColor(context: DrawContext, x: f64, y: f64, paintMethod: PaintMethod) void; +pub extern fn DrawComment(context: DrawContext, comment: [*c]const u8) void; +pub extern fn DrawDestroyContext(context: DrawContext) void; +pub extern fn DrawEllipse(context: DrawContext, ox: f64, oy: f64, rx: f64, ry: f64, start: f64, end: f64) void; +pub extern fn DrawComposite(context: DrawContext, composite_operator: CompositeOperator, x: f64, y: f64, width: f64, height: f64, image: [*c]const Image) void; +pub extern fn DrawLine(context: DrawContext, sx: f64, sy: f64, ex: f64, ey: f64) void; +pub extern fn DrawMatte(context: DrawContext, x: f64, y: f64, paint_method: PaintMethod) void; +pub extern fn DrawPathClose(context: DrawContext) void; +pub extern fn DrawPathCurveToAbsolute(context: DrawContext, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64) void; +pub extern fn DrawPathCurveToRelative(context: DrawContext, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64) void; +pub extern fn DrawPathCurveToQuadraticBezierAbsolute(context: DrawContext, x1: f64, y1: f64, x: f64, y: f64) void; +pub extern fn DrawPathCurveToQuadraticBezierRelative(context: DrawContext, x1: f64, y1: f64, x: f64, y: f64) void; +pub extern fn DrawPathCurveToQuadraticBezierSmoothAbsolute(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathCurveToQuadraticBezierSmoothRelative(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathCurveToSmoothAbsolute(context: DrawContext, x2: f64, y2: f64, x: f64, y: f64) void; +pub extern fn DrawPathCurveToSmoothRelative(context: DrawContext, x2: f64, y2: f64, x: f64, y: f64) void; +pub extern fn DrawPathEllipticArcAbsolute(context: DrawContext, rx: f64, ry: f64, x_axis_rotation: f64, large_arc_flag: c_uint, sweep_flag: c_uint, x: f64, y: f64) void; +pub extern fn DrawPathEllipticArcRelative(context: DrawContext, rx: f64, ry: f64, x_axis_rotation: f64, large_arc_flag: c_uint, sweep_flag: c_uint, x: f64, y: f64) void; +pub extern fn DrawPathFinish(context: DrawContext) void; +pub extern fn DrawPathLineToAbsolute(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathLineToRelative(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathLineToHorizontalAbsolute(context: DrawContext, x: f64) void; +pub extern fn DrawPathLineToHorizontalRelative(context: DrawContext, x: f64) void; +pub extern fn DrawPathLineToVerticalAbsolute(context: DrawContext, y: f64) void; +pub extern fn DrawPathLineToVerticalRelative(context: DrawContext, y: f64) void; +pub extern fn DrawPathMoveToAbsolute(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathMoveToRelative(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPathStart(context: DrawContext) void; +pub extern fn DrawPoint(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawPolygon(context: DrawContext, num_coords: c_ulong, coordinates: [*c]const PointInfo) void; +pub extern fn DrawPolyline(context: DrawContext, num_coords: c_ulong, coordinates: [*c]const PointInfo) void; +pub extern fn DrawPopClipPath(context: DrawContext) void; +pub extern fn DrawPopDefs(context: DrawContext) void; +pub extern fn DrawPopGraphicContext(context: DrawContext) void; +pub extern fn DrawPopPattern(context: DrawContext) void; +pub extern fn DrawPushClipPath(context: DrawContext, clip_path_id: [*c]const u8) void; +pub extern fn DrawPushDefs(context: DrawContext) void; +pub extern fn DrawPushGraphicContext(context: DrawContext) void; +pub extern fn DrawPushPattern(context: DrawContext, pattern_id: [*c]const u8, x: f64, y: f64, width: f64, height: f64) void; +pub extern fn DrawRectangle(context: DrawContext, x1: f64, y1: f64, x2: f64, y2: f64) void; +pub extern fn DrawRoundRectangle(context: DrawContext, x1: f64, y1: f64, x2: f64, y2: f64, rx: f64, ry: f64) void; +pub extern fn DrawScale(context: DrawContext, x: f64, y: f64) void; +pub extern fn DrawSetClipPath(context: DrawContext, clip_path: [*c]const u8) void; +pub extern fn DrawSetClipRule(context: DrawContext, fill_rule: FillRule) void; +pub extern fn DrawSetClipUnits(context: DrawContext, clip_units: ClipPathUnits) void; +pub extern fn DrawSetFillColor(context: DrawContext, fill_color: [*c]const PixelPacket) void; +pub extern fn DrawSetFillColorString(context: DrawContext, fill_color: [*c]const u8) void; +pub extern fn DrawSetFillOpacity(context: DrawContext, fill_opacity: f64) void; +pub extern fn DrawSetFillRule(context: DrawContext, fill_rule: FillRule) void; +pub extern fn DrawSetFillPatternURL(context: DrawContext, fill_url: [*c]const u8) void; +pub extern fn DrawSetFont(context: DrawContext, font_name: [*c]const u8) void; +pub extern fn DrawSetFontFamily(context: DrawContext, font_family: [*c]const u8) void; +pub extern fn DrawSetFontSize(context: DrawContext, font_pointsize: f64) void; +pub extern fn DrawSetFontStretch(context: DrawContext, font_stretch: StretchType) void; +pub extern fn DrawSetFontStyle(context: DrawContext, font_style: StyleType) void; +pub extern fn DrawSetFontWeight(context: DrawContext, font_weight: c_ulong) void; +pub extern fn DrawSetGravity(context: DrawContext, gravity: GravityType) void; +pub extern fn DrawRotate(context: DrawContext, degrees: f64) void; +pub extern fn DrawSkewX(context: DrawContext, degrees: f64) void; +pub extern fn DrawSkewY(context: DrawContext, degrees: f64) void; +pub extern fn DrawSetStrokeAntialias(context: DrawContext, true_false: c_uint) void; +pub extern fn DrawSetStrokeColor(context: DrawContext, stroke_color: [*c]const PixelPacket) void; +pub extern fn DrawSetStrokeColorString(context: DrawContext, stroke_color: [*c]const u8) void; +pub extern fn DrawSetStrokeDashArray(context: DrawContext, num_elems: c_ulong, dasharray: [*c]const f64) void; +pub extern fn DrawSetStrokeDashOffset(context: DrawContext, dashoffset: f64) void; +pub extern fn DrawSetStrokeLineCap(context: DrawContext, linecap: LineCap) void; +pub extern fn DrawSetStrokeLineJoin(context: DrawContext, linejoin: LineJoin) void; +pub extern fn DrawSetStrokeMiterLimit(context: DrawContext, miterlimit: c_ulong) void; +pub extern fn DrawSetStrokeOpacity(context: DrawContext, opacity: f64) void; +pub extern fn DrawSetStrokePatternURL(context: DrawContext, stroke_url: [*c]const u8) void; +pub extern fn DrawSetStrokeWidth(context: DrawContext, width: f64) void; +pub extern fn DrawSetTextAntialias(context: DrawContext, true_false: c_uint) void; +pub extern fn DrawSetTextDecoration(context: DrawContext, decoration: DecorationType) void; +pub extern fn DrawSetTextEncoding(context: DrawContext, encoding: [*c]const u8) void; +pub extern fn DrawSetTextUnderColor(context: DrawContext, color: [*c]const PixelPacket) void; +pub extern fn DrawSetTextUnderColorString(context: DrawContext, under_color: [*c]const u8) void; +pub extern fn DrawSetViewbox(context: DrawContext, x1: c_ulong, y1: c_ulong, x2: c_ulong, y2: c_ulong) void; +pub extern fn DrawTranslate(context: DrawContext, x: f64, y: f64) void; +pub extern fn AdaptiveThresholdImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: f64, arg4: [*c]ExceptionInfo) [*c]Image; +pub extern fn AddNoiseImage(arg0: [*c]const Image, arg1: NoiseType, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn AddNoiseImageChannel(image: [*c]const Image, channel: ChannelType, noise_type: NoiseType, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn BlurImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn BlurImageChannel(image: [*c]const Image, channel: ChannelType, radius: f64, sigma: f64, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ConvolveImage(arg0: [*c]const Image, arg1: c_uint, arg2: [*c]const f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn DespeckleImage(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn EdgeImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn EmbossImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn EnhanceImage(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn GaussianBlurImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn GaussianBlurImageChannel(image: [*c]const Image, channel: ChannelType, radius: f64, sigma: f64, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn MedianFilterImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn MotionBlurImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: f64, arg4: [*c]ExceptionInfo) [*c]Image; +pub extern fn ReduceNoiseImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn ShadeImage(arg0: [*c]const Image, arg1: c_uint, arg2: f64, arg3: f64, arg4: [*c]ExceptionInfo) [*c]Image; +pub extern fn SharpenImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn SharpenImageChannel(image: [*c]const Image, channel: ChannelType, radius: f64, sigma: f64, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn SpreadImage(arg0: [*c]const Image, arg1: c_uint, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn UnsharpMaskImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: [*c]ExceptionInfo) [*c]Image; +pub extern fn UnsharpMaskImageChannel(image: [*c]const Image, channel: ChannelType, radius: f64, sigma: f64, amount: f64, threshold: f64, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn BlackThresholdImage(image: [*c]Image, thresholds: [*c]const u8) c_uint; +pub extern fn ChannelThresholdImage(arg0: [*c]Image, arg1: [*c]const u8) c_uint; +pub extern fn RandomChannelThresholdImage(arg0: [*c]Image, arg1: [*c]const u8, arg2: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ThresholdImage(arg0: [*c]Image, arg1: f64) c_uint; +pub extern fn WhiteThresholdImage(image: [*c]Image, thresholds: [*c]const u8) c_uint; +pub extern fn ContrastImage(arg0: [*c]Image, arg1: c_uint) c_uint; +pub extern fn EqualizeImage(arg0: [*c]Image) c_uint; +pub extern fn GammaImage(arg0: [*c]Image, arg1: [*c]const u8) c_uint; +pub extern fn LevelImage(arg0: [*c]Image, arg1: [*c]const u8) c_uint; +pub extern fn LevelImageChannel(arg0: [*c]Image, arg1: ChannelType, arg2: f64, arg3: f64, arg4: f64) c_uint; +pub extern fn ModulateImage(arg0: [*c]Image, arg1: [*c]const u8) c_uint; +pub extern fn NegateImage(arg0: [*c]Image, arg1: c_uint) c_uint; +pub extern fn NormalizeImage(arg0: [*c]Image) c_uint; +pub extern fn CharcoalImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ColorizeImage(arg0: [*c]const Image, arg1: [*c]const u8, arg2: PixelPacket, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ImplodeImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn MorphImages(arg0: [*c]const Image, arg1: c_ulong, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn OilPaintImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn SteganoImage(arg0: [*c]const Image, arg1: [*c]const Image, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn StereoImage(arg0: [*c]const Image, arg1: [*c]const Image, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn SwirlImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn WaveImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ColorMatrixImage(image: [*c]Image, order: c_uint, matrix: [*c]const f64) c_uint; +pub extern fn SolarizeImage(arg0: [*c]Image, arg1: f64) c_uint; +pub const struct__MagickRandomKernel = extern struct { + z: magick_uint32_t, + w: magick_uint32_t, +}; +pub const MagickRandomKernel = struct__MagickRandomKernel; +pub extern fn MagickRandomInteger() magick_uint32_t; +pub extern fn MagickRandomReal() f64; +pub extern fn ExpandAffine(arg0: [*c]const AffineMatrix) f64; +pub extern fn GenerateDifferentialNoise(pixel: Quantum, noise_type: NoiseType, kernel: [*c]MagickRandomKernel) f64; +pub extern fn GetOptimalKernelWidth(arg0: f64, arg1: f64) c_int; +pub extern fn GetOptimalKernelWidth1D(arg0: f64, arg1: f64) c_int; +pub extern fn GetOptimalKernelWidth2D(arg0: f64, arg1: f64) c_int; +pub extern fn GenerateNoise(arg0: Quantum, arg1: NoiseType) Quantum; +pub extern fn Contrast(arg0: c_int, arg1: [*c]Quantum, arg2: [*c]Quantum, arg3: [*c]Quantum) void; +pub extern fn HSLTransform(arg0: f64, arg1: f64, arg2: f64, arg3: [*c]Quantum, arg4: [*c]Quantum, arg5: [*c]Quantum) void; +pub extern fn HWBTransform(arg0: f64, arg1: f64, arg2: f64, arg3: [*c]Quantum, arg4: [*c]Quantum, arg5: [*c]Quantum) void; +pub extern fn Hull(arg0: c_long, arg1: c_long, arg2: c_ulong, arg3: c_ulong, arg4: [*c]Quantum, arg5: [*c]Quantum, arg6: c_int) void; +pub extern fn IdentityAffine(arg0: [*c]AffineMatrix) void; +pub extern fn Modulate(arg0: f64, arg1: f64, arg2: f64, arg3: [*c]Quantum, arg4: [*c]Quantum, arg5: [*c]Quantum) void; +pub extern fn TransformHSL(arg0: Quantum, arg1: Quantum, arg2: Quantum, arg3: [*c]f64, arg4: [*c]f64, arg5: [*c]f64) void; +pub extern fn TransformHWB(arg0: Quantum, arg1: Quantum, arg2: Quantum, arg3: [*c]f64, arg4: [*c]f64, arg5: [*c]f64) void; +pub extern fn GradientImage(arg0: [*c]Image, arg1: [*c]const PixelPacket, arg2: [*c]const PixelPacket) c_uint; +pub extern fn HaldClutImage(arg0: [*c]Image, clut: [*c]const Image) c_uint; +pub extern fn CloneImageList(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn GetFirstImageInList(arg0: [*c]const Image) [*c]Image; +pub extern fn GetImageFromList(arg0: [*c]const Image, arg1: c_long) [*c]Image; +pub extern fn GetLastImageInList(arg0: [*c]const Image) [*c]Image; +pub extern fn GetNextImageInList(arg0: [*c]const Image) [*c]Image; +pub extern fn GetPreviousImageInList(arg0: [*c]const Image) [*c]Image; +pub extern fn ImageListToArray(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]([*c]Image); +pub extern fn NewImageList() [*c]Image; +pub extern fn RemoveLastImageFromList(arg0: [*c]([*c]Image)) [*c]Image; +pub extern fn RemoveFirstImageFromList(arg0: [*c]([*c]Image)) [*c]Image; +pub extern fn SplitImageList(arg0: [*c]Image) [*c]Image; +pub extern fn SyncNextImageInList(arg0: [*c]const Image) [*c]Image; +pub extern fn GetImageIndexInList(arg0: [*c]const Image) c_long; +pub extern fn GetImageListLength(arg0: [*c]const Image) c_ulong; +pub extern fn AppendImageToList(arg0: [*c]([*c]Image), arg1: [*c]Image) void; +pub extern fn DeleteImageFromList(arg0: [*c]([*c]Image)) void; +pub extern fn DestroyImageList(arg0: [*c]Image) void; +pub extern fn InsertImageInList(arg0: [*c]([*c]Image), arg1: [*c]Image) void; +pub extern fn PrependImageToList(arg0: [*c]([*c]Image), arg1: [*c]Image) void; +pub extern fn ReplaceImageInList(images: [*c]([*c]Image), image: [*c]Image) void; +pub extern fn ReverseImageList(arg0: [*c]([*c]Image)) void; +pub extern fn SpliceImageIntoList(arg0: [*c]([*c]Image), arg1: c_ulong, arg2: [*c]Image) void; +pub extern fn GetMagickFileFormat(header: [*c]const u8, header_length: usize, format: [*c]u8, format_length: usize, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ListMagicInfo(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub const DecoderHandler = ?extern fn ([*c]const ImageInfo, [*c]ExceptionInfo) [*c]Image; +pub const EncoderHandler = ?extern fn ([*c]const ImageInfo, [*c]Image) c_uint; +pub const MagickHandler = ?extern fn ([*c]const u8, usize) c_uint; +pub const BrokenCoderClass = -1; +pub const UnstableCoderClass = 0; +pub const StableCoderClass = 1; +pub const PrimaryCoderClass = 2; +pub const CoderClass = extern enum { + BrokenCoderClass = -1, + UnstableCoderClass = 0, + StableCoderClass = 1, + PrimaryCoderClass = 2, +}; +pub const HintExtensionTreatment = 0; +pub const ObeyExtensionTreatment = 1; +pub const IgnoreExtensionTreatment = 2; +pub const ExtensionTreatment = extern enum { + HintExtensionTreatment = 0, + ObeyExtensionTreatment = 1, + IgnoreExtensionTreatment = 2, +}; +pub const struct__MagickInfo = extern struct { + next: [*c]struct__MagickInfo, + previous: [*c]struct__MagickInfo, + name: [*c]const u8, + description: [*c]const u8, + note: [*c]const u8, + version: [*c]const u8, + module: [*c]const u8, + decoder: DecoderHandler, + encoder: EncoderHandler, + magick: MagickHandler, + client_data: ?*c_void, + adjoin: c_uint, + raw: c_uint, + stealth: c_uint, + seekable_stream: c_uint, + blob_support: c_uint, + thread_support: c_uint, + coder_class: CoderClass, + extension_treatment: ExtensionTreatment, + signature: c_ulong, +}; +pub const MagickInfo = struct__MagickInfo; +pub extern fn MagickToMime(magick: [*c]const u8) [*c]u8; +pub extern fn GetImageMagick(magick: [*c]const u8, length: usize) [*c]const u8; +pub extern fn IsMagickConflict(magick: [*c]const u8) c_uint; +pub extern fn ListModuleMap(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ListMagickInfo(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn UnregisterMagickInfo(name: [*c]const u8) c_uint; +pub extern fn DestroyMagick() void; +pub extern fn InitializeMagick(path: [*c]const u8) void; +pub extern fn PanicDestroyMagick() void; +pub extern fn GetMagickInfo(name: [*c]const u8, exception: [*c]ExceptionInfo) [*c]const MagickInfo; +pub extern fn GetMagickInfoArray(exception: [*c]ExceptionInfo) [*c]([*c]MagickInfo); +pub extern fn RegisterMagickInfo(magick_info: [*c]MagickInfo) [*c]MagickInfo; +pub extern fn SetMagickInfo(name: [*c]const u8) [*c]MagickInfo; +pub const MagickMallocFunc = ?extern fn (usize) ?*c_void; +pub const MagickFreeFunc = ?extern fn (?*c_void) void; +pub const MagickReallocFunc = ?extern fn (?*c_void, usize) ?*c_void; +pub extern fn MagickAllocFunctions(free_func: MagickFreeFunc, malloc_func: MagickMallocFunc, realloc_func: MagickReallocFunc) void; +pub extern fn MagickMalloc(size: usize) ?*c_void; +pub extern fn MagickMallocAligned(alignment: usize, size: usize) ?*c_void; +pub extern fn MagickMallocCleared(size: usize) ?*c_void; +pub extern fn MagickCloneMemory(destination: ?*c_void, source: ?*const c_void, size: usize) ?*c_void; +pub extern fn MagickRealloc(memory: ?*c_void, size: usize) ?*c_void; +pub extern fn MagickFree(memory: ?*c_void) void; +pub extern fn MagickFreeAligned(memory: ?*c_void) void; +pub extern fn ListModuleInfo(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ExecuteModuleProcess(tag: [*c]const u8, image: [*c]([*c]Image), argc: c_int, argv: [*c]([*c]u8)) c_uint; +pub const MonitorHandler = ?extern fn ([*c]const u8, magick_int64_t, magick_uint64_t, [*c]ExceptionInfo) c_uint; +pub extern fn SetMonitorHandler(handler: MonitorHandler) MonitorHandler; +pub extern fn MagickMonitor(text: [*c]const u8, quantum: magick_int64_t, span: magick_uint64_t, exception: [*c]ExceptionInfo) c_uint; +pub extern fn MagickMonitorFormatted(quantum: magick_int64_t, span: magick_uint64_t, exception: [*c]ExceptionInfo, format: [*c]const u8, ...) c_uint; +pub extern fn MontageImages(arg0: [*c]const Image, arg1: [*c]const MontageInfo, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn CloneMontageInfo(arg0: [*c]const ImageInfo, arg1: [*c]const MontageInfo) [*c]MontageInfo; +pub extern fn DestroyMontageInfo(arg0: [*c]MontageInfo) void; +pub extern fn GetMontageInfo(arg0: [*c]const ImageInfo, arg1: [*c]MontageInfo) void; +pub const UndefinedQuantumOp = 0; +pub const AddQuantumOp = 1; +pub const AndQuantumOp = 2; +pub const AssignQuantumOp = 3; +pub const DivideQuantumOp = 4; +pub const LShiftQuantumOp = 5; +pub const MultiplyQuantumOp = 6; +pub const OrQuantumOp = 7; +pub const RShiftQuantumOp = 8; +pub const SubtractQuantumOp = 9; +pub const ThresholdQuantumOp = 10; +pub const ThresholdBlackQuantumOp = 11; +pub const ThresholdWhiteQuantumOp = 12; +pub const XorQuantumOp = 13; +pub const NoiseGaussianQuantumOp = 14; +pub const NoiseImpulseQuantumOp = 15; +pub const NoiseLaplacianQuantumOp = 16; +pub const NoiseMultiplicativeQuantumOp = 17; +pub const NoisePoissonQuantumOp = 18; +pub const NoiseUniformQuantumOp = 19; +pub const NegateQuantumOp = 20; +pub const GammaQuantumOp = 21; +pub const DepthQuantumOp = 22; +pub const LogQuantumOp = 23; +pub const MaxQuantumOp = 24; +pub const MinQuantumOp = 25; +pub const PowQuantumOp = 26; +pub const NoiseRandomQuantumOp = 27; +pub const ThresholdBlackNegateQuantumOp = 28; +pub const ThresholdWhiteNegateQuantumOp = 29; +pub const QuantumOperator = extern enum { + UndefinedQuantumOp = 0, + AddQuantumOp = 1, + AndQuantumOp = 2, + AssignQuantumOp = 3, + DivideQuantumOp = 4, + LShiftQuantumOp = 5, + MultiplyQuantumOp = 6, + OrQuantumOp = 7, + RShiftQuantumOp = 8, + SubtractQuantumOp = 9, + ThresholdQuantumOp = 10, + ThresholdBlackQuantumOp = 11, + ThresholdWhiteQuantumOp = 12, + XorQuantumOp = 13, + NoiseGaussianQuantumOp = 14, + NoiseImpulseQuantumOp = 15, + NoiseLaplacianQuantumOp = 16, + NoiseMultiplicativeQuantumOp = 17, + NoisePoissonQuantumOp = 18, + NoiseUniformQuantumOp = 19, + NegateQuantumOp = 20, + GammaQuantumOp = 21, + DepthQuantumOp = 22, + LogQuantumOp = 23, + MaxQuantumOp = 24, + MinQuantumOp = 25, + PowQuantumOp = 26, + NoiseRandomQuantumOp = 27, + ThresholdBlackNegateQuantumOp = 28, + ThresholdWhiteNegateQuantumOp = 29, +}; +pub extern fn QuantumOperatorImage(image: [*c]Image, channel: ChannelType, quantum_operator: QuantumOperator, rvalue: f64, exception: [*c]ExceptionInfo) c_uint; +pub extern fn QuantumOperatorImageMultivalue(image: [*c]Image, quantum_operator: QuantumOperator, values: [*c]const u8) c_uint; +pub extern fn QuantumOperatorRegionImage(image: [*c]Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, channel: ChannelType, quantum_operator: QuantumOperator, rvalue: f64, exception: [*c]ExceptionInfo) c_uint; +pub extern fn ColorFloodfillImage(arg0: [*c]Image, arg1: [*c]const DrawInfo, arg2: PixelPacket, arg3: c_long, arg4: c_long, arg5: PaintMethod) c_uint; +pub extern fn MatteFloodfillImage(arg0: [*c]Image, arg1: PixelPacket, arg2: c_uint, arg3: c_long, arg4: c_long, arg5: PaintMethod) c_uint; +pub extern fn OpaqueImage(arg0: [*c]Image, arg1: PixelPacket, arg2: PixelPacket) c_uint; +pub extern fn TransparentImage(arg0: [*c]Image, arg1: PixelPacket, arg2: c_uint) c_uint; +pub const UndefinedVirtualPixelMethod = 0; +pub const ConstantVirtualPixelMethod = 1; +pub const EdgeVirtualPixelMethod = 2; +pub const MirrorVirtualPixelMethod = 3; +pub const TileVirtualPixelMethod = 4; +pub const VirtualPixelMethod = extern enum { + UndefinedVirtualPixelMethod = 0, + ConstantVirtualPixelMethod = 1, + EdgeVirtualPixelMethod = 2, + MirrorVirtualPixelMethod = 3, + TileVirtualPixelMethod = 4, +}; +pub const Cache = _CacheInfoPtr_; +pub extern fn AcquireImagePixels(image: [*c]const Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]const PixelPacket; +pub extern fn AccessImmutableIndexes(image: [*c]const Image) [*c]const IndexPacket; +pub extern fn AcquireOnePixel(image: [*c]const Image, x: c_long, y: c_long, exception: [*c]ExceptionInfo) PixelPacket; +pub extern fn GetImagePixels(image: [*c]Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong) [*c]PixelPacket; +pub extern fn GetImagePixelsEx(image: [*c]Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]PixelPacket; +pub extern fn GetImageVirtualPixelMethod(image: [*c]const Image) VirtualPixelMethod; +pub extern fn GetPixels(image: [*c]const Image) [*c]PixelPacket; +pub extern fn AccessMutablePixels(image: [*c]Image) [*c]PixelPacket; +pub extern fn GetIndexes(image: [*c]const Image) [*c]IndexPacket; +pub extern fn AccessMutableIndexes(image: [*c]Image) [*c]IndexPacket; +pub extern fn GetOnePixel(image: [*c]Image, x: c_long, y: c_long) PixelPacket; +pub extern fn GetPixelCacheArea(image: [*c]const Image) magick_off_t; +pub extern fn SetImagePixels(image: [*c]Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong) [*c]PixelPacket; +pub extern fn SetImagePixelsEx(image: [*c]Image, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]PixelPacket; +pub extern fn SetImageVirtualPixelMethod(image: [*c]const Image, method: VirtualPixelMethod) c_uint; +pub extern fn SyncImagePixels(image: [*c]Image) c_uint; +pub extern fn SyncImagePixelsEx(image: [*c]Image, exception: [*c]ExceptionInfo) c_uint; +pub extern fn OpenCacheView(image: [*c]Image) [*c]ViewInfo; +pub extern fn CloseCacheView(view: [*c]ViewInfo) void; +pub extern fn AccessCacheViewPixels(view: [*c]const ViewInfo) [*c]PixelPacket; +pub extern fn AcquireCacheViewIndexes(view: [*c]const ViewInfo) [*c]const IndexPacket; +pub extern fn AcquireCacheViewPixels(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]const PixelPacket; +pub extern fn AcquireOneCacheViewPixel(view: [*c]ViewInfo, pixel: [*c]PixelPacket, x: c_long, y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub extern fn GetCacheViewArea(view: [*c]const ViewInfo) magick_off_t; +pub extern fn GetCacheViewImage(view: [*c]const ViewInfo) [*c]Image; +pub extern fn GetCacheViewIndexes(view: [*c]const ViewInfo) [*c]IndexPacket; +pub extern fn GetCacheViewPixels(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]PixelPacket; +pub extern fn GetCacheViewRegion(view: [*c]const ViewInfo) RectangleInfo; +pub extern fn SetCacheViewPixels(view: [*c]ViewInfo, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, exception: [*c]ExceptionInfo) [*c]PixelPacket; +pub extern fn SyncCacheViewPixels(view: [*c]const ViewInfo, exception: [*c]ExceptionInfo) c_uint; +pub const struct__PixelIteratorOptions = extern struct { + max_threads: c_int, + signature: c_ulong, +}; +pub const PixelIteratorOptions = struct__PixelIteratorOptions; +pub extern fn InitializePixelIteratorOptions(options: [*c]PixelIteratorOptions, exception: [*c]ExceptionInfo) void; +pub const PixelIteratorMonoReadCallback = ?extern fn (?*c_void, ?*const c_void, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, c_long, [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateMonoRead(call_back: PixelIteratorMonoReadCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, image: [*c]const Image, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorMonoModifyCallback = ?extern fn (?*c_void, ?*const c_void, [*c]Image, [*c]PixelPacket, [*c]IndexPacket, c_long, [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateMonoSet(call_back: PixelIteratorMonoModifyCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, image: [*c]Image, exception: [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateMonoModify(call_back: PixelIteratorMonoModifyCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, x: c_long, y: c_long, columns: c_ulong, rows: c_ulong, image: [*c]Image, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorDualReadCallback = ?extern fn (?*c_void, ?*const c_void, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, c_long, [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateDualRead(call_back: PixelIteratorDualReadCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, columns: c_ulong, rows: c_ulong, first_image: [*c]const Image, first_x: c_long, first_y: c_long, second_image: [*c]const Image, second_x: c_long, second_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorDualModifyCallback = ?extern fn (?*c_void, ?*const c_void, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, [*c]Image, [*c]PixelPacket, [*c]IndexPacket, c_long, [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateDualModify(call_back: PixelIteratorDualModifyCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, columns: c_ulong, rows: c_ulong, source_image: [*c]const Image, source_x: c_long, source_y: c_long, update_image: [*c]Image, update_x: c_long, update_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorDualNewCallback = PixelIteratorDualModifyCallback; +pub extern fn PixelIterateDualNew(call_back: PixelIteratorDualNewCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, columns: c_ulong, rows: c_ulong, source_image: [*c]const Image, source_x: c_long, source_y: c_long, new_image: [*c]Image, new_x: c_long, new_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorTripleModifyCallback = ?extern fn (?*c_void, ?*const c_void, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, [*c]const Image, [*c]const PixelPacket, [*c]const IndexPacket, [*c]Image, [*c]PixelPacket, [*c]IndexPacket, c_long, [*c]ExceptionInfo) c_uint; +pub extern fn PixelIterateTripleModify(call_back: PixelIteratorTripleModifyCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, columns: c_ulong, rows: c_ulong, source1_image: [*c]const Image, source2_image: [*c]const Image, source_x: c_long, source_y: c_long, update_image: [*c]Image, update_x: c_long, update_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub const PixelIteratorTripleNewCallback = PixelIteratorTripleModifyCallback; +pub extern fn PixelIterateTripleNew(call_back: PixelIteratorTripleNewCallback, options: [*c]const PixelIteratorOptions, description: [*c]const u8, mutable_data: ?*c_void, immutable_data: ?*const c_void, columns: c_ulong, rows: c_ulong, source1_image: [*c]const Image, source2_image: [*c]const Image, source_x: c_long, source_y: c_long, new_image: [*c]Image, new_x: c_long, new_y: c_long, exception: [*c]ExceptionInfo) c_uint; +pub extern fn PlasmaImage(image: [*c]Image, segment: [*c]const SegmentInfo, attenuate: c_ulong, depth: c_ulong) c_uint; +pub extern fn GetImageProfile(image: [*c]const Image, name: [*c]const u8, length: [*c]usize) [*c]const u8; +pub extern fn DeleteImageProfile(image: [*c]Image, name: [*c]const u8) c_uint; +pub extern fn ProfileImage(image: [*c]Image, name: [*c]const u8, profile: [*c]u8, length: usize, clone: c_uint) c_uint; +pub extern fn SetImageProfile(image: [*c]Image, name: [*c]const u8, profile: [*c]const u8, length: usize) c_uint; +pub extern fn AppendImageProfile(image: [*c]Image, name: [*c]const u8, profile_chunk: [*c]const u8, chunk_length: usize) c_uint; +pub const ImageProfileIterator = ?*c_void; +pub extern fn AllocateImageProfileIterator(image: [*c]const Image) ImageProfileIterator; +pub extern fn NextImageProfile(profile_iterator: ImageProfileIterator, name: [*c]([*c]const u8), profile: [*c]([*c]const u8), length: [*c]usize) c_uint; +pub extern fn DeallocateImageProfileIterator(profile_iterator: ImageProfileIterator) void; +pub const struct__QuantizeInfo = extern struct { + number_colors: c_ulong, + tree_depth: c_uint, + dither: c_uint, + colorspace: ColorspaceType, + measure_error: c_uint, + signature: c_ulong, +}; +pub const QuantizeInfo = struct__QuantizeInfo; +pub extern fn CloneQuantizeInfo(arg0: [*c]const QuantizeInfo) [*c]QuantizeInfo; +pub extern fn GetImageQuantizeError(arg0: [*c]Image) c_uint; +pub extern fn MapImage(arg0: [*c]Image, arg1: [*c]const Image, arg2: c_uint) c_uint; +pub extern fn MapImages(arg0: [*c]Image, arg1: [*c]const Image, arg2: c_uint) c_uint; +pub extern fn OrderedDitherImage(arg0: [*c]Image) c_uint; +pub extern fn QuantizeImage(arg0: [*c]const QuantizeInfo, arg1: [*c]Image) c_uint; +pub extern fn QuantizeImages(arg0: [*c]const QuantizeInfo, arg1: [*c]Image) c_uint; +pub extern fn SegmentImage(arg0: [*c]Image, arg1: ColorspaceType, arg2: c_uint, arg3: f64, arg4: f64) c_uint; +pub extern fn CompressImageColormap(arg0: [*c]Image) void; +pub extern fn DestroyQuantizeInfo(arg0: [*c]QuantizeInfo) void; +pub extern fn GetQuantizeInfo(arg0: [*c]QuantizeInfo) void; +pub extern fn GrayscalePseudoClassImage(arg0: [*c]Image, arg1: c_uint) void; +pub const UndefinedRegistryType = 0; +pub const ImageRegistryType = 1; +pub const ImageInfoRegistryType = 2; +pub const RegistryType = extern enum { + UndefinedRegistryType = 0, + ImageRegistryType = 1, + ImageInfoRegistryType = 2, +}; +pub extern fn GetImageFromMagickRegistry(name: [*c]const u8, id: [*c]c_long, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn SetMagickRegistry(type_0: RegistryType, blob: ?*const c_void, length: usize, exception: [*c]ExceptionInfo) c_long; +pub extern fn DeleteMagickRegistry(id: c_long) c_uint; +pub extern fn GetMagickRegistry(id: c_long, type_0: [*c]RegistryType, length: [*c]usize, exception: [*c]ExceptionInfo) ?*c_void; +pub extern fn MagnifyImage(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn MinifyImage(arg0: [*c]const Image, arg1: [*c]ExceptionInfo) [*c]Image; +pub extern fn ResizeImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: FilterTypes, arg4: f64, arg5: [*c]ExceptionInfo) [*c]Image; +pub extern fn SampleImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ScaleImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ThumbnailImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: [*c]ExceptionInfo) [*c]Image; +pub extern fn ZoomImage(arg0: [*c]const Image, arg1: c_ulong, arg2: c_ulong, arg3: [*c]ExceptionInfo) [*c]Image; +pub const UndefinedResource = 0; +pub const DiskResource = 1; +pub const FileResource = 2; +pub const MapResource = 3; +pub const MemoryResource = 4; +pub const PixelsResource = 5; +pub const ThreadsResource = 6; +pub const WidthResource = 7; +pub const HeightResource = 8; +pub const ResourceType = extern enum { + UndefinedResource = 0, + DiskResource = 1, + FileResource = 2, + MapResource = 3, + MemoryResource = 4, + PixelsResource = 5, + ThreadsResource = 6, + WidthResource = 7, + HeightResource = 8, +}; +pub extern fn AcquireMagickResource(type_0: ResourceType, size: magick_uint64_t) c_uint; +pub extern fn ListMagickResourceInfo(file: [*c]FILE, exception: [*c]ExceptionInfo) c_uint; +pub extern fn SetMagickResourceLimit(type_0: ResourceType, limit: magick_int64_t) c_uint; +pub extern fn GetMagickResource(type_0: ResourceType) magick_int64_t; +pub extern fn GetMagickResourceLimit(type_0: ResourceType) magick_int64_t; +pub extern fn DestroyMagickResources() void; +pub extern fn InitializeMagickResources() void; +pub extern fn LiberateMagickResource(type_0: ResourceType, size: magick_uint64_t) void; +pub extern fn AffineTransformImage(arg0: [*c]const Image, arg1: [*c]const AffineMatrix, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn AutoOrientImage(image: [*c]const Image, current_orientation: OrientationType, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn RotateImage(arg0: [*c]const Image, arg1: f64, arg2: [*c]ExceptionInfo) [*c]Image; +pub extern fn ShearImage(arg0: [*c]const Image, arg1: f64, arg2: f64, arg3: [*c]ExceptionInfo) [*c]Image; +pub const struct__SignatureInfo = extern struct { + digest: [8]c_ulong, + low_order: c_ulong, + high_order: c_ulong, + offset: c_long, + message: [64]u8, +}; +pub const SignatureInfo = struct__SignatureInfo; +pub extern fn SignatureImage(arg0: [*c]Image) c_uint; +pub extern fn FinalizeSignature(arg0: [*c]SignatureInfo) void; +pub extern fn GetSignatureInfo(arg0: [*c]SignatureInfo) void; +pub extern fn TransformSignature(arg0: [*c]SignatureInfo) void; +pub extern fn UpdateSignature(arg0: [*c]SignatureInfo, arg1: [*c]const u8, arg2: usize) void; +pub const struct__ImageChannelStatistics = extern struct { + maximum: f64, + minimum: f64, + mean: f64, + standard_deviation: f64, + variance: f64, +}; +pub const ImageChannelStatistics = struct__ImageChannelStatistics; +pub const struct__ImageStatistics = extern struct { + red: ImageChannelStatistics, + green: ImageChannelStatistics, + blue: ImageChannelStatistics, + opacity: ImageChannelStatistics, +}; +pub const ImageStatistics = struct__ImageStatistics; +pub extern fn GetImageStatistics(image: [*c]const Image, statistics: [*c]ImageStatistics, exception: [*c]ExceptionInfo) c_uint; +pub extern fn TextureImage(arg0: [*c]Image, arg1: [*c]const Image) c_uint; +pub extern fn ChopImage(image: [*c]const Image, chop_info: [*c]const RectangleInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn CoalesceImages(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn CropImage(image: [*c]const Image, geometry: [*c]const RectangleInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn DeconstructImages(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ExtentImage(image: [*c]const Image, geometry: [*c]const RectangleInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn FlattenImages(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn FlipImage(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn FlopImage(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn MosaicImages(image: [*c]const Image, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn RollImage(image: [*c]const Image, x_offset: c_long, y_offset: c_long, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn ShaveImage(image: [*c]const Image, shave_info: [*c]const RectangleInfo, exception: [*c]ExceptionInfo) [*c]Image; +pub extern fn TransformImage(arg0: [*c]([*c]Image), arg1: [*c]const u8, arg2: [*c]const u8) void; +pub const RootPath = 0; +pub const HeadPath = 1; +pub const TailPath = 2; +pub const BasePath = 3; +pub const ExtensionPath = 4; +pub const MagickPath = 5; +pub const SubImagePath = 6; +pub const FullPath = 7; +pub const PathType = extern enum { + RootPath = 0, + HeadPath = 1, + TailPath = 2, + BasePath = 3, + ExtensionPath = 4, + MagickPath = 5, + SubImagePath = 6, + FullPath = 7, +}; +pub const struct__TokenInfo = extern struct { + state: c_int, + flag: c_uint, + offset: c_long, + quote: u8, +}; +pub const TokenInfo = struct__TokenInfo; +pub const MagickTextTranslate = ?extern fn ([*c]u8, [*c]const u8, usize) usize; +pub extern fn AcquireString(arg0: [*c]const u8) [*c]u8; +pub extern fn AllocateString(arg0: [*c]const u8) [*c]u8; +pub extern fn Base64Encode(arg0: [*c]const u8, arg1: usize, arg2: [*c]usize) [*c]u8; +pub extern fn EscapeString(arg0: [*c]const u8, arg1: u8) [*c]u8; +pub extern fn GetPageGeometry(arg0: [*c]const u8) [*c]u8; +pub extern fn ListFiles(arg0: [*c]const u8, arg1: [*c]const u8, arg2: [*c]c_long) [*c]([*c]u8); +pub extern fn StringToArgv(arg0: [*c]const u8, arg1: [*c]c_int) [*c]([*c]u8); +pub extern fn StringToList(arg0: [*c]const u8) [*c]([*c]u8); +pub extern fn TranslateText(arg0: [*c]const ImageInfo, arg1: [*c]Image, arg2: [*c]const u8) [*c]u8; +pub extern fn TranslateTextEx(arg0: [*c]const ImageInfo, arg1: [*c]Image, arg2: [*c]const u8, arg3: MagickTextTranslate) [*c]u8; +pub extern fn GetClientFilename() [*c]const u8; +pub extern fn GetClientName() [*c]const u8; +pub extern fn GetClientPath() [*c]const u8; +pub extern fn SetClientFilename(arg0: [*c]const u8) [*c]const u8; +pub extern fn SetClientName(arg0: [*c]const u8) [*c]const u8; +pub extern fn SetClientPath(arg0: [*c]const u8) [*c]const u8; +pub extern fn StringToDouble(arg0: [*c]const u8, arg1: f64) f64; +pub extern fn GetGeometry(arg0: [*c]const u8, arg1: [*c]c_long, arg2: [*c]c_long, arg3: [*c]c_ulong, arg4: [*c]c_ulong) c_int; +pub extern fn GlobExpression(arg0: [*c]const u8, arg1: [*c]const u8) c_int; +pub extern fn LocaleNCompare(arg0: [*c]const u8, arg1: [*c]const u8, arg2: usize) c_int; +pub extern fn LocaleCompare(arg0: [*c]const u8, arg1: [*c]const u8) c_int; +pub extern fn GetMagickDimension(str: [*c]const u8, width: [*c]f64, height: [*c]f64, xoff: [*c]f64, yoff: [*c]f64) c_int; +pub extern fn GetMagickGeometry(geometry: [*c]const u8, x: [*c]c_long, y: [*c]c_long, width: [*c]c_ulong, height: [*c]c_ulong) c_int; +pub extern fn MagickRandReentrant(seed: [*c]c_uint) c_int; +pub extern fn MagickSpawnVP(verbose: c_uint, file: [*c]const u8, argv: [*c]const ([*c]u8)) c_int; +pub extern fn SystemCommand(arg0: c_uint, arg1: [*c]const u8) c_int; +pub extern fn Tokenizer(arg0: [*c]TokenInfo, arg1: c_uint, arg2: [*c]u8, arg3: usize, arg4: [*c]u8, arg5: [*c]u8, arg6: [*c]u8, arg7: [*c]u8, arg8: u8, arg9: [*c]u8, arg10: [*c]c_int, arg11: [*c]u8) c_int; +pub extern fn MagickRandNewSeed() c_uint; +pub extern fn Base64Decode(arg0: [*c]const u8, arg1: [*c]usize) [*c]u8; +pub extern fn CloneString(arg0: [*c]([*c]u8), arg1: [*c]const u8) c_uint; +pub extern fn ConcatenateString(arg0: [*c]([*c]u8), arg1: [*c]const u8) c_uint; +pub extern fn ExpandFilenames(arg0: [*c]c_int, arg1: [*c]([*c]([*c]u8))) c_uint; +pub extern fn GetExecutionPath(arg0: [*c]u8) c_uint; +pub extern fn GetExecutionPathUsingName(arg0: [*c]u8) c_uint; +pub extern fn MagickCreateDirectoryPath(dir: [*c]const u8, exception: [*c]ExceptionInfo) c_uint; +pub extern fn IsAccessible(arg0: [*c]const u8) c_uint; +pub extern fn IsAccessibleNoLogging(arg0: [*c]const u8) c_uint; +pub extern fn IsAccessibleAndNotEmpty(arg0: [*c]const u8) c_uint; +pub extern fn IsGeometry(arg0: [*c]const u8) c_uint; +pub extern fn IsGlob(arg0: [*c]const u8) c_uint; +pub extern fn IsWriteable(arg0: [*c]const u8) c_uint; +pub extern fn MagickSceneFileName(filename: [*c]u8, filename_template: [*c]const u8, scene_template: [*c]const u8, force: c_uint, scene: c_ulong) c_uint; +pub extern fn SubstituteString(buffer: [*c]([*c]u8), search: [*c]const u8, replace: [*c]const u8) c_uint; +pub extern fn MultilineCensus(arg0: [*c]const u8) c_ulong; +pub extern fn AppendImageFormat(arg0: [*c]const u8, arg1: [*c]u8) void; +pub extern fn DefineClientName(arg0: [*c]const u8) void; +pub extern fn DefineClientPathAndName(arg0: [*c]const u8) void; +pub extern fn ExpandFilename(arg0: [*c]u8) void; +pub extern fn FormatSize(size: magick_int64_t, format: [*c]u8) void; +pub extern fn GetPathComponent(arg0: [*c]const u8, arg1: PathType, arg2: [*c]u8) void; +pub extern fn GetToken(arg0: [*c]const u8, arg1: [*c]([*c]u8), arg2: [*c]u8) void; +pub extern fn LocaleLower(arg0: [*c]u8) void; +pub extern fn LocaleUpper(arg0: [*c]u8) void; +pub extern fn Strip(arg0: [*c]u8) void; +pub extern fn SetGeometry(arg0: [*c]const Image, arg1: [*c]RectangleInfo) void; +pub extern fn FormatString(string: [*c]u8, format: [*c]const u8, ...) void; +pub extern fn FormatStringList(string: [*c]u8, format: [*c]const u8, operands: [*c]struct___va_list_tag) void; +pub extern fn MagickFormatString(string: [*c]u8, length: usize, format: [*c]const u8, ...) void; +pub extern fn MagickFormatStringList(string: [*c]u8, length: usize, format: [*c]const u8, operands: [*c]struct___va_list_tag) void; +pub extern fn MagickSizeStrToInt64(str: [*c]const u8, kilo: c_uint) magick_int64_t; +pub extern fn MagickGetToken(start: [*c]const u8, end: [*c]([*c]u8), token: [*c]u8, buffer_length: usize) usize; +pub extern fn MagickStripSpacesFromString(string: [*c]u8) usize; +pub extern fn MagickStrlCat(dst: [*c]u8, src: [*c]const u8, size: usize) usize; +pub extern fn MagickStrlCpy(dst: [*c]u8, src: [*c]const u8, size: usize) usize; +pub extern fn MagickStrlCpyTrunc(dst: [*c]u8, src: [*c]const u8, size: usize) usize; +pub extern fn GetMagickCopyright() [*c]const u8; +pub extern fn GetMagickVersion(arg0: [*c]c_ulong) [*c]const u8; +pub extern fn GetMagickWebSite() [*c]const u8; +pub const struct__PixelWand = @OpaqueType(); +pub const PixelWand = struct__PixelWand; +pub extern fn PixelGetColorAsString(arg0: ?*const PixelWand) [*c]u8; +pub extern fn PixelGetBlack(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetBlue(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetCyan(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetGreen(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetMagenta(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetOpacity(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetRed(arg0: ?*const PixelWand) f64; +pub extern fn PixelGetYellow(arg0: ?*const PixelWand) f64; +pub extern fn ClonePixelWand(arg0: ?*const PixelWand) ?*PixelWand; +pub extern fn ClonePixelWands(arg0: [*c](?*const PixelWand), arg1: c_ulong) [*c](?*PixelWand); +pub extern fn NewPixelWand() ?*PixelWand; +pub extern fn NewPixelWands(arg0: c_ulong) [*c](?*PixelWand); +pub extern fn PixelGetBlackQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetBlueQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetCyanQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetGreenQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetMagentaQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetOpacityQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetRedQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelGetYellowQuantum(arg0: ?*const PixelWand) Quantum; +pub extern fn PixelSetColor(arg0: ?*PixelWand, arg1: [*c]const u8) c_uint; +pub extern fn PixelGetColorCount(arg0: ?*const PixelWand) c_ulong; +pub extern fn DestroyPixelWand(arg0: ?*PixelWand) void; +pub extern fn PixelGetQuantumColor(arg0: ?*const PixelWand, arg1: [*c]PixelPacket) void; +pub extern fn PixelSetBlack(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetBlackQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetBlue(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetBlueQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetColorCount(arg0: ?*PixelWand, arg1: c_ulong) void; +pub extern fn PixelSetCyan(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetCyanQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetGreen(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetGreenQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetMagenta(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetMagentaQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetOpacity(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetOpacityQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetQuantumColor(arg0: ?*PixelWand, arg1: [*c]PixelPacket) void; +pub extern fn PixelSetRed(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetRedQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub extern fn PixelSetYellow(arg0: ?*PixelWand, arg1: f64) void; +pub extern fn PixelSetYellowQuantum(arg0: ?*PixelWand, arg1: Quantum) void; +pub const struct__DrawingWand = @OpaqueType(); +pub const DrawingWand = struct__DrawingWand; +pub extern fn MagickDrawGetClipPath(arg0: ?*const DrawingWand) [*c]u8; +pub extern fn MagickDrawGetException(arg0: ?*const DrawingWand, arg1: [*c]ExceptionType) [*c]u8; +pub extern fn MagickDrawGetFont(arg0: ?*const DrawingWand) [*c]u8; +pub extern fn MagickDrawGetFontFamily(arg0: ?*const DrawingWand) [*c]u8; +pub extern fn MagickDrawGetTextEncoding(arg0: ?*const DrawingWand) [*c]u8; +pub extern fn MagickDrawGetClipUnits(arg0: ?*const DrawingWand) ClipPathUnits; +pub extern fn MagickDrawGetTextDecoration(arg0: ?*const DrawingWand) DecorationType; +pub extern fn MagickDrawGetFillOpacity(arg0: ?*const DrawingWand) f64; +pub extern fn MagickDrawGetFontSize(arg0: ?*const DrawingWand) f64; +pub extern fn MagickDrawGetStrokeDashArray(arg0: ?*const DrawingWand, arg1: [*c]c_ulong) [*c]f64; +pub extern fn MagickDrawGetStrokeDashOffset(arg0: ?*const DrawingWand) f64; +pub extern fn MagickDrawGetStrokeOpacity(arg0: ?*const DrawingWand) f64; +pub extern fn MagickDrawGetStrokeWidth(arg0: ?*const DrawingWand) f64; +pub extern fn MagickDrawPeekGraphicContext(arg0: ?*const DrawingWand) [*c]DrawInfo; +pub extern fn MagickCloneDrawingWand(drawing_wand: ?*const DrawingWand) ?*DrawingWand; +pub extern fn MagickDrawAllocateWand(arg0: [*c]const DrawInfo, arg1: [*c]Image) ?*DrawingWand; +pub extern fn MagickNewDrawingWand() ?*DrawingWand; +pub extern fn MagickDrawGetClipRule(arg0: ?*const DrawingWand) FillRule; +pub extern fn MagickDrawGetFillRule(arg0: ?*const DrawingWand) FillRule; +pub extern fn MagickDrawGetGravity(arg0: ?*const DrawingWand) GravityType; +pub extern fn MagickDrawGetStrokeLineCap(arg0: ?*const DrawingWand) LineCap; +pub extern fn MagickDrawGetStrokeLineJoin(arg0: ?*const DrawingWand) LineJoin; +pub extern fn MagickDrawGetFontStretch(arg0: ?*const DrawingWand) StretchType; +pub extern fn MagickDrawGetFontStyle(arg0: ?*const DrawingWand) StyleType; +pub extern fn MagickDrawClearException(arg0: ?*DrawingWand) c_uint; +pub extern fn MagickDrawGetStrokeAntialias(arg0: ?*const DrawingWand) c_uint; +pub extern fn MagickDrawGetTextAntialias(arg0: ?*const DrawingWand) c_uint; +pub extern fn MagickDrawRender(arg0: ?*const DrawingWand) c_uint; +pub extern fn MagickDrawGetFontWeight(arg0: ?*const DrawingWand) c_ulong; +pub extern fn MagickDrawGetStrokeMiterLimit(arg0: ?*const DrawingWand) c_ulong; +pub extern fn MagickDrawAffine(arg0: ?*DrawingWand, arg1: [*c]const AffineMatrix) void; +pub extern fn MagickDrawAnnotation(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: [*c]const u8) void; +pub extern fn MagickDrawArc(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: f64) void; +pub extern fn MagickDrawBezier(arg0: ?*DrawingWand, arg1: c_ulong, arg2: [*c]const PointInfo) void; +pub extern fn MagickDrawCircle(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawColor(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: PaintMethod) void; +pub extern fn MagickDrawComment(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDestroyDrawingWand(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawEllipse(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: f64) void; +pub extern fn MagickDrawComposite(arg0: ?*DrawingWand, arg1: CompositeOperator, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: [*c]const Image) void; +pub extern fn MagickDrawGetFillColor(arg0: ?*const DrawingWand, arg1: ?*PixelWand) void; +pub extern fn MagickDrawGetStrokeColor(arg0: ?*const DrawingWand, arg1: ?*PixelWand) void; +pub extern fn MagickDrawGetTextUnderColor(arg0: ?*const DrawingWand, arg1: ?*PixelWand) void; +pub extern fn MagickDrawLine(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawMatte(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: PaintMethod) void; +pub extern fn MagickDrawPathClose(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPathCurveToAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: f64) void; +pub extern fn MagickDrawPathCurveToRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: f64) void; +pub extern fn MagickDrawPathCurveToQuadraticBezierAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawPathCurveToQuadraticBezierRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawPathCurveToQuadraticBezierSmoothAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathCurveToQuadraticBezierSmoothRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathCurveToSmoothAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawPathCurveToSmoothRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawPathEllipticArcAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: c_uint, arg5: c_uint, arg6: f64, arg7: f64) void; +pub extern fn MagickDrawPathEllipticArcRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: c_uint, arg5: c_uint, arg6: f64, arg7: f64) void; +pub extern fn MagickDrawPathFinish(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPathLineToAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathLineToRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathLineToHorizontalAbsolute(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawPathLineToHorizontalRelative(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawPathLineToVerticalAbsolute(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawPathLineToVerticalRelative(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawPathMoveToAbsolute(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathMoveToRelative(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPathStart(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPoint(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawPolygon(arg0: ?*DrawingWand, arg1: c_ulong, arg2: [*c]const PointInfo) void; +pub extern fn MagickDrawPolyline(arg0: ?*DrawingWand, arg1: c_ulong, arg2: [*c]const PointInfo) void; +pub extern fn MagickDrawPopClipPath(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPopDefs(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPopGraphicContext(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPopPattern(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPushClipPath(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawPushDefs(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPushGraphicContext(arg0: ?*DrawingWand) void; +pub extern fn MagickDrawPushPattern(arg0: ?*DrawingWand, arg1: [*c]const u8, arg2: f64, arg3: f64, arg4: f64, arg5: f64) void; +pub extern fn MagickDrawRectangle(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) void; +pub extern fn MagickDrawRotate(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawRoundRectangle(arg0: ?*DrawingWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: f64, arg6: f64) void; +pub extern fn MagickDrawScale(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn MagickDrawSetClipPath(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetClipRule(arg0: ?*DrawingWand, arg1: FillRule) void; +pub extern fn MagickDrawSetClipUnits(arg0: ?*DrawingWand, arg1: ClipPathUnits) void; +pub extern fn MagickDrawSetFillColor(arg0: ?*DrawingWand, arg1: ?*const PixelWand) void; +pub extern fn MagickDrawSetFillOpacity(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSetFillRule(arg0: ?*DrawingWand, arg1: FillRule) void; +pub extern fn MagickDrawSetFillPatternURL(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetFont(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetFontFamily(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetFontSize(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSetFontStretch(arg0: ?*DrawingWand, arg1: StretchType) void; +pub extern fn MagickDrawSetFontStyle(arg0: ?*DrawingWand, arg1: StyleType) void; +pub extern fn MagickDrawSetFontWeight(arg0: ?*DrawingWand, arg1: c_ulong) void; +pub extern fn MagickDrawSetGravity(arg0: ?*DrawingWand, arg1: GravityType) void; +pub extern fn MagickDrawSkewX(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSkewY(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSetStrokeAntialias(arg0: ?*DrawingWand, arg1: c_uint) void; +pub extern fn MagickDrawSetStrokeColor(arg0: ?*DrawingWand, arg1: ?*const PixelWand) void; +pub extern fn MagickDrawSetStrokeDashArray(arg0: ?*DrawingWand, arg1: c_ulong, arg2: [*c]const f64) void; +pub extern fn MagickDrawSetStrokeDashOffset(arg0: ?*DrawingWand, dashoffset: f64) void; +pub extern fn MagickDrawSetStrokeLineCap(arg0: ?*DrawingWand, arg1: LineCap) void; +pub extern fn MagickDrawSetStrokeLineJoin(arg0: ?*DrawingWand, arg1: LineJoin) void; +pub extern fn MagickDrawSetStrokeMiterLimit(arg0: ?*DrawingWand, arg1: c_ulong) void; +pub extern fn MagickDrawSetStrokeOpacity(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSetStrokePatternURL(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetStrokeWidth(arg0: ?*DrawingWand, arg1: f64) void; +pub extern fn MagickDrawSetTextAntialias(arg0: ?*DrawingWand, arg1: c_uint) void; +pub extern fn MagickDrawSetTextDecoration(arg0: ?*DrawingWand, arg1: DecorationType) void; +pub extern fn MagickDrawSetTextEncoding(arg0: ?*DrawingWand, arg1: [*c]const u8) void; +pub extern fn MagickDrawSetTextUnderColor(arg0: ?*DrawingWand, arg1: ?*const PixelWand) void; +pub extern fn MagickDrawSetViewbox(arg0: ?*DrawingWand, arg1: c_ulong, arg2: c_ulong, arg3: c_ulong, arg4: c_ulong) void; +pub extern fn MagickDrawTranslate(arg0: ?*DrawingWand, arg1: f64, arg2: f64) void; +pub extern fn FormatMagickString(arg0: [*c]u8, arg1: usize, arg2: [*c]const u8, ...) c_int; +pub extern fn CopyMagickString(arg0: [*c]u8, arg1: [*c]const u8, arg2: usize) usize; +pub const struct__MagickWand = @OpaqueType(); +pub const MagickWand = struct__MagickWand; +pub extern fn MagickDescribeImage(arg0: ?*MagickWand) [*c]u8; +pub extern fn MagickGetConfigureInfo(arg0: ?*MagickWand, arg1: [*c]const u8) [*c]u8; +pub extern fn MagickGetException(arg0: ?*const MagickWand, arg1: [*c]ExceptionType) [*c]u8; +pub extern fn MagickGetFilename(arg0: ?*const MagickWand) [*c]u8; +pub extern fn MagickGetImageAttribute(arg0: ?*MagickWand, arg1: [*c]const u8) [*c]u8; +pub extern fn MagickGetImageFilename(arg0: ?*MagickWand) [*c]u8; +pub extern fn MagickGetImageFormat(arg0: ?*MagickWand) [*c]u8; +pub extern fn MagickGetImageSignature(arg0: ?*MagickWand) [*c]u8; +pub extern fn MagickQueryFonts(arg0: [*c]const u8, arg1: [*c]c_ulong) [*c]([*c]u8); +pub extern fn MagickQueryFormats(arg0: [*c]const u8, arg1: [*c]c_ulong) [*c]([*c]u8); +pub extern fn MagickGetImageCompose(arg0: ?*MagickWand) CompositeOperator; +pub extern fn MagickGetImageColorspace(arg0: ?*MagickWand) ColorspaceType; +pub extern fn MagickGetImageCompression(arg0: ?*MagickWand) CompressionType; +pub extern fn MagickGetCopyright() [*c]const u8; +pub extern fn MagickGetHomeURL() [*c]const u8; +pub extern fn MagickGetImageGeometry(arg0: ?*MagickWand) [*c]const u8; +pub extern fn MagickGetPackageName() [*c]const u8; +pub extern fn MagickGetQuantumDepth(arg0: [*c]c_ulong) [*c]const u8; +pub extern fn MagickGetReleaseDate() [*c]const u8; +pub extern fn MagickGetVersion(arg0: [*c]c_ulong) [*c]const u8; +pub extern fn MagickGetImageDispose(arg0: ?*MagickWand) DisposeType; +pub extern fn MagickGetImageGamma(arg0: ?*MagickWand) f64; +pub extern fn MagickGetImageFuzz(arg0: ?*MagickWand) f64; +pub extern fn MagickGetSamplingFactors(arg0: ?*MagickWand, arg1: [*c]c_ulong) [*c]f64; +pub extern fn MagickQueryFontMetrics(arg0: ?*MagickWand, arg1: ?*const DrawingWand, arg2: [*c]const u8) [*c]f64; +pub extern fn MagickGetImageGravity(wand: ?*MagickWand) GravityType; +pub extern fn MagickGetImageType(arg0: ?*MagickWand) ImageType; +pub extern fn MagickGetImageSavedType(arg0: ?*MagickWand) ImageType; +pub extern fn MagickGetImageInterlaceScheme(arg0: ?*MagickWand) InterlaceType; +pub extern fn MagickGetImageIndex(arg0: ?*MagickWand) c_long; +pub extern fn MagickGetImageSize(arg0: ?*MagickWand) magick_int64_t; +pub extern fn CloneMagickWand(arg0: ?*const MagickWand) ?*MagickWand; +pub extern fn MagickAppendImages(arg0: ?*MagickWand, arg1: c_uint) ?*MagickWand; +pub extern fn MagickAverageImages(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickCoalesceImages(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickCompareImageChannels(arg0: ?*MagickWand, arg1: ?*const MagickWand, arg2: ChannelType, arg3: MetricType, arg4: [*c]f64) ?*MagickWand; +pub extern fn MagickCompareImages(arg0: ?*MagickWand, arg1: ?*const MagickWand, arg2: MetricType, arg3: [*c]f64) ?*MagickWand; +pub extern fn MagickDeconstructImages(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickFlattenImages(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickFxImage(arg0: ?*MagickWand, arg1: [*c]const u8) ?*MagickWand; +pub extern fn MagickFxImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: [*c]const u8) ?*MagickWand; +pub extern fn MagickGetImage(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickMorphImages(arg0: ?*MagickWand, arg1: c_ulong) ?*MagickWand; +pub extern fn MagickMosaicImages(arg0: ?*MagickWand) ?*MagickWand; +pub extern fn MagickMontageImage(arg0: ?*MagickWand, arg1: ?*const DrawingWand, arg2: [*c]const u8, arg3: [*c]const u8, arg4: MontageMode, arg5: [*c]const u8) ?*MagickWand; +pub extern fn MagickPreviewImages(wand: ?*MagickWand, arg1: PreviewType) ?*MagickWand; +pub extern fn MagickSteganoImage(arg0: ?*MagickWand, arg1: ?*const MagickWand, arg2: c_long) ?*MagickWand; +pub extern fn MagickStereoImage(arg0: ?*MagickWand, arg1: ?*const MagickWand) ?*MagickWand; +pub extern fn MagickTextureImage(arg0: ?*MagickWand, arg1: ?*const MagickWand) ?*MagickWand; +pub extern fn MagickTransformImage(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8) ?*MagickWand; +pub extern fn NewMagickWand() ?*MagickWand; +pub extern fn MagickGetImageOrientation(arg0: ?*MagickWand) OrientationType; +pub extern fn MagickGetImageHistogram(arg0: ?*MagickWand, arg1: [*c]c_ulong) [*c](?*PixelWand); +pub extern fn MagickGetImageRenderingIntent(arg0: ?*MagickWand) RenderingIntent; +pub extern fn MagickGetImageUnits(arg0: ?*MagickWand) ResolutionType; +pub extern fn DestroyMagickWand(arg0: ?*MagickWand) c_uint; +pub extern fn MagickAdaptiveThresholdImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong, arg3: c_long) c_uint; +pub extern fn MagickAddImage(arg0: ?*MagickWand, arg1: ?*const MagickWand) c_uint; +pub extern fn MagickAddNoiseImage(arg0: ?*MagickWand, arg1: NoiseType) c_uint; +pub extern fn MagickAffineTransformImage(arg0: ?*MagickWand, arg1: ?*const DrawingWand) c_uint; +pub extern fn MagickAnnotateImage(arg0: ?*MagickWand, arg1: ?*const DrawingWand, arg2: f64, arg3: f64, arg4: f64, arg5: [*c]const u8) c_uint; +pub extern fn MagickAnimateImages(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickAutoOrientImage(wand: ?*MagickWand, arg1: OrientationType) c_uint; +pub extern fn MagickBlackThresholdImage(arg0: ?*MagickWand, arg1: ?*const PixelWand) c_uint; +pub extern fn MagickBlurImage(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickBorderImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: c_ulong, arg3: c_ulong) c_uint; +pub extern fn MagickCdlImage(wand: ?*MagickWand, cdl: [*c]const u8) c_uint; +pub extern fn MagickCharcoalImage(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickChopImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong, arg3: c_long, arg4: c_long) c_uint; +pub extern fn MagickClipImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickClipPathImage(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: c_uint) c_uint; +pub extern fn MagickColorFloodfillImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: f64, arg3: ?*const PixelWand, arg4: c_long, arg5: c_long) c_uint; +pub extern fn MagickColorizeImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: ?*const PixelWand) c_uint; +pub extern fn MagickCommentImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickCompositeImage(arg0: ?*MagickWand, arg1: ?*const MagickWand, arg2: CompositeOperator, arg3: c_long, arg4: c_long) c_uint; +pub extern fn MagickContrastImage(arg0: ?*MagickWand, arg1: c_uint) c_uint; +pub extern fn MagickConvolveImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: [*c]const f64) c_uint; +pub extern fn MagickCropImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong, arg3: c_long, arg4: c_long) c_uint; +pub extern fn MagickCycleColormapImage(arg0: ?*MagickWand, arg1: c_long) c_uint; +pub extern fn MagickDespeckleImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickDisplayImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickDisplayImages(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickDrawImage(arg0: ?*MagickWand, arg1: ?*const DrawingWand) c_uint; +pub extern fn MagickEdgeImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickEmbossImage(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickEnhanceImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickEqualizeImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickExtentImage(arg0: ?*MagickWand, arg1: usize, arg2: usize, arg3: isize, arg4: isize) c_uint; +pub extern fn MagickFlipImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickFlopImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickFrameImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: c_ulong, arg3: c_ulong, arg4: c_long, arg5: c_long) c_uint; +pub extern fn MagickGammaImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickGammaImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: f64) c_uint; +pub extern fn MagickGetImageBackgroundColor(arg0: ?*MagickWand, arg1: ?*PixelWand) c_uint; +pub extern fn MagickGetImageBluePrimary(arg0: ?*MagickWand, arg1: [*c]f64, arg2: [*c]f64) c_uint; +pub extern fn MagickGetImageBorderColor(arg0: ?*MagickWand, arg1: ?*PixelWand) c_uint; +pub extern fn MagickGetImageBoundingBox(wand: ?*MagickWand, fuzz: f64, width: [*c]c_ulong, height: [*c]c_ulong, x: [*c]c_long, y: [*c]c_long) c_uint; +pub extern fn MagickGetImageChannelExtrema(arg0: ?*MagickWand, arg1: ChannelType, arg2: [*c]c_ulong, arg3: [*c]c_ulong) c_uint; +pub extern fn MagickGetImageChannelMean(arg0: ?*MagickWand, arg1: ChannelType, arg2: [*c]f64, arg3: [*c]f64) c_uint; +pub extern fn MagickGetImageColormapColor(arg0: ?*MagickWand, arg1: c_ulong, arg2: ?*PixelWand) c_uint; +pub extern fn MagickGetImageExtrema(arg0: ?*MagickWand, arg1: [*c]c_ulong, arg2: [*c]c_ulong) c_uint; +pub extern fn MagickGetImageGreenPrimary(arg0: ?*MagickWand, arg1: [*c]f64, arg2: [*c]f64) c_uint; +pub extern fn MagickGetImageMatte(arg0: ?*MagickWand) c_uint; +pub extern fn MagickGetImageMatteColor(arg0: ?*MagickWand, arg1: ?*PixelWand) c_uint; +pub extern fn MagickGetImagePage(wand: ?*MagickWand, width: [*c]c_ulong, height: [*c]c_ulong, x: [*c]c_long, y: [*c]c_long) c_uint; +pub extern fn MagickGetImagePixels(arg0: ?*MagickWand, arg1: c_long, arg2: c_long, arg3: c_ulong, arg4: c_ulong, arg5: [*c]const u8, arg6: StorageType, arg7: [*c]u8) c_uint; +pub extern fn MagickGetImageRedPrimary(arg0: ?*MagickWand, arg1: [*c]f64, arg2: [*c]f64) c_uint; +pub extern fn MagickGetImageResolution(arg0: ?*MagickWand, arg1: [*c]f64, arg2: [*c]f64) c_uint; +pub extern fn MagickGetImageWhitePoint(arg0: ?*MagickWand, arg1: [*c]f64, arg2: [*c]f64) c_uint; +pub extern fn MagickGetSize(arg0: ?*const MagickWand, arg1: [*c]c_ulong, arg2: [*c]c_ulong) c_uint; +pub extern fn MagickHaldClutImage(wand: ?*MagickWand, clut_wand: ?*const MagickWand) c_uint; +pub extern fn MagickHasColormap(arg0: ?*MagickWand, arg1: [*c]c_uint) c_uint; +pub extern fn MagickHasNextImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickHasPreviousImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickImplodeImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickIsGrayImage(arg0: ?*MagickWand, arg1: [*c]c_uint) c_uint; +pub extern fn MagickIsMonochromeImage(arg0: ?*MagickWand, arg1: [*c]c_uint) c_uint; +pub extern fn MagickIsOpaqueImage(arg0: ?*MagickWand, arg1: [*c]c_uint) c_uint; +pub extern fn MagickIsPaletteImage(arg0: ?*MagickWand, arg1: [*c]c_uint) c_uint; +pub extern fn MagickLabelImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickLevelImage(arg0: ?*MagickWand, arg1: f64, arg2: f64, arg3: f64) c_uint; +pub extern fn MagickLevelImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: f64, arg3: f64, arg4: f64) c_uint; +pub extern fn MagickMagnifyImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickMapImage(arg0: ?*MagickWand, arg1: ?*const MagickWand, arg2: c_uint) c_uint; +pub extern fn MagickMatteFloodfillImage(arg0: ?*MagickWand, arg1: Quantum, arg2: f64, arg3: ?*const PixelWand, arg4: c_long, arg5: c_long) c_uint; +pub extern fn MagickMedianFilterImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickMinifyImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickModulateImage(arg0: ?*MagickWand, arg1: f64, arg2: f64, arg3: f64) c_uint; +pub extern fn MagickMotionBlurImage(arg0: ?*MagickWand, arg1: f64, arg2: f64, arg3: f64) c_uint; +pub extern fn MagickNegateImage(arg0: ?*MagickWand, arg1: c_uint) c_uint; +pub extern fn MagickNegateImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: c_uint) c_uint; +pub extern fn MagickNextImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickNormalizeImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickOilPaintImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickOpaqueImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: ?*const PixelWand, arg3: f64) c_uint; +pub extern fn MagickOperatorImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: QuantumOperator, arg3: f64) c_uint; +pub extern fn MagickPingImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickPreviousImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickProfileImage(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8, arg3: c_ulong) c_uint; +pub extern fn MagickQuantizeImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: ColorspaceType, arg3: c_ulong, arg4: c_uint, arg5: c_uint) c_uint; +pub extern fn MagickQuantizeImages(arg0: ?*MagickWand, arg1: c_ulong, arg2: ColorspaceType, arg3: c_ulong, arg4: c_uint, arg5: c_uint) c_uint; +pub extern fn MagickRadialBlurImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickRaiseImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong, arg3: c_long, arg4: c_long, arg5: c_uint) c_uint; +pub extern fn MagickReadImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickReadImageBlob(arg0: ?*MagickWand, arg1: [*c]const u8, length: usize) c_uint; +pub extern fn MagickReadImageFile(arg0: ?*MagickWand, arg1: [*c]FILE) c_uint; +pub extern fn MagickReduceNoiseImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickRelinquishMemory(arg0: ?*c_void) c_uint; +pub extern fn MagickRemoveImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickRemoveImageOption(wand: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8) c_uint; +pub extern fn MagickResampleImage(arg0: ?*MagickWand, arg1: f64, arg2: f64, arg3: FilterTypes, arg4: f64) c_uint; +pub extern fn MagickResizeImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong, arg3: FilterTypes, arg4: f64) c_uint; +pub extern fn MagickRollImage(arg0: ?*MagickWand, arg1: c_long, arg2: c_long) c_uint; +pub extern fn MagickRotateImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: f64) c_uint; +pub extern fn MagickSampleImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong) c_uint; +pub extern fn MagickScaleImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong) c_uint; +pub extern fn MagickSeparateImageChannel(arg0: ?*MagickWand, arg1: ChannelType) c_uint; +pub extern fn MagickSetCompressionQuality(wand: ?*MagickWand, quality: c_ulong) c_uint; +pub extern fn MagickSetFilename(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickSetFormat(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickSetImage(arg0: ?*MagickWand, arg1: ?*const MagickWand) c_uint; +pub extern fn MagickSetImageAttribute(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8) c_uint; +pub extern fn MagickSetImageBackgroundColor(arg0: ?*MagickWand, arg1: ?*const PixelWand) c_uint; +pub extern fn MagickSetImageBluePrimary(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickSetImageBorderColor(arg0: ?*MagickWand, arg1: ?*const PixelWand) c_uint; +pub extern fn MagickSetImageChannelDepth(arg0: ?*MagickWand, arg1: ChannelType, arg2: c_ulong) c_uint; +pub extern fn MagickSetImageColormapColor(arg0: ?*MagickWand, arg1: c_ulong, arg2: ?*const PixelWand) c_uint; +pub extern fn MagickSetImageCompose(arg0: ?*MagickWand, arg1: CompositeOperator) c_uint; +pub extern fn MagickSetImageCompression(arg0: ?*MagickWand, arg1: CompressionType) c_uint; +pub extern fn MagickSetImageDelay(arg0: ?*MagickWand, arg1: c_ulong) c_uint; +pub extern fn MagickSetImageDepth(arg0: ?*MagickWand, arg1: c_ulong) c_uint; +pub extern fn MagickSetImageDispose(arg0: ?*MagickWand, arg1: DisposeType) c_uint; +pub extern fn MagickSetImageColorspace(arg0: ?*MagickWand, arg1: ColorspaceType) c_uint; +pub extern fn MagickSetImageGreenPrimary(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickSetImageGamma(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickSetImageGeometry(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickSetImageGravity(arg0: ?*MagickWand, arg1: GravityType) c_uint; +pub extern fn MagickSetImageFilename(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickSetImageFormat(wand: ?*MagickWand, format: [*c]const u8) c_uint; +pub extern fn MagickSetImageFuzz(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickSetImageIndex(arg0: ?*MagickWand, arg1: c_long) c_uint; +pub extern fn MagickSetImageInterlaceScheme(arg0: ?*MagickWand, arg1: InterlaceType) c_uint; +pub extern fn MagickSetImageIterations(arg0: ?*MagickWand, arg1: c_ulong) c_uint; +pub extern fn MagickSetImageMatte(arg0: ?*MagickWand, arg1: c_uint) c_uint; +pub extern fn MagickSetImageMatteColor(arg0: ?*MagickWand, arg1: ?*const PixelWand) c_uint; +pub extern fn MagickSetImageOption(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8, arg3: [*c]const u8) c_uint; +pub extern fn MagickSetImageOrientation(arg0: ?*MagickWand, arg1: OrientationType) c_uint; +pub extern fn MagickSetImagePage(wand: ?*MagickWand, width: c_ulong, height: c_ulong, x: c_long, y: c_long) c_uint; +pub extern fn MagickSetImagePixels(arg0: ?*MagickWand, arg1: c_long, arg2: c_long, arg3: c_ulong, arg4: c_ulong, arg5: [*c]const u8, arg6: StorageType, arg7: [*c]u8) c_uint; +pub extern fn MagickSetImageRedPrimary(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickSetImageRenderingIntent(arg0: ?*MagickWand, arg1: RenderingIntent) c_uint; +pub extern fn MagickSetImageResolution(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickSetImageScene(arg0: ?*MagickWand, arg1: c_ulong) c_uint; +pub extern fn MagickSetImageType(arg0: ?*MagickWand, arg1: ImageType) c_uint; +pub extern fn MagickSetImageSavedType(arg0: ?*MagickWand, arg1: ImageType) c_uint; +pub extern fn MagickSetImageUnits(arg0: ?*MagickWand, arg1: ResolutionType) c_uint; +pub extern fn MagickSetImageVirtualPixelMethod(arg0: ?*MagickWand, arg1: VirtualPixelMethod) c_uint; +pub extern fn MagickSetPassphrase(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickSetImageProfile(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]const u8, arg3: c_ulong) c_uint; +pub extern fn MagickSetResolution(wand: ?*MagickWand, x_resolution: f64, y_resolution: f64) c_uint; +pub extern fn MagickSetResolutionUnits(wand: ?*MagickWand, units: ResolutionType) c_uint; +pub extern fn MagickSetResourceLimit(type_0: ResourceType, limit: c_ulong) c_uint; +pub extern fn MagickSetSamplingFactors(arg0: ?*MagickWand, arg1: c_ulong, arg2: [*c]const f64) c_uint; +pub extern fn MagickSetSize(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong) c_uint; +pub extern fn MagickSetImageWhitePoint(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickSetInterlaceScheme(arg0: ?*MagickWand, arg1: InterlaceType) c_uint; +pub extern fn MagickSharpenImage(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickShaveImage(arg0: ?*MagickWand, arg1: c_ulong, arg2: c_ulong) c_uint; +pub extern fn MagickShearImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: f64, arg3: f64) c_uint; +pub extern fn MagickSolarizeImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickSpreadImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickStripImage(arg0: ?*MagickWand) c_uint; +pub extern fn MagickSwirlImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickTintImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: ?*const PixelWand) c_uint; +pub extern fn MagickThresholdImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickThresholdImageChannel(arg0: ?*MagickWand, arg1: ChannelType, arg2: f64) c_uint; +pub extern fn MagickTransparentImage(arg0: ?*MagickWand, arg1: ?*const PixelWand, arg2: Quantum, arg3: f64) c_uint; +pub extern fn MagickTrimImage(arg0: ?*MagickWand, arg1: f64) c_uint; +pub extern fn MagickUnsharpMaskImage(arg0: ?*MagickWand, arg1: f64, arg2: f64, arg3: f64, arg4: f64) c_uint; +pub extern fn MagickWaveImage(arg0: ?*MagickWand, arg1: f64, arg2: f64) c_uint; +pub extern fn MagickWhiteThresholdImage(arg0: ?*MagickWand, arg1: ?*const PixelWand) c_uint; +pub extern fn MagickWriteImage(arg0: ?*MagickWand, arg1: [*c]const u8) c_uint; +pub extern fn MagickWriteImageFile(arg0: ?*MagickWand, arg1: [*c]FILE) c_uint; +pub extern fn MagickWriteImagesFile(arg0: ?*MagickWand, arg1: [*c]FILE, arg2: c_uint) c_uint; +pub extern fn MagickWriteImages(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: c_uint) c_uint; +pub extern fn MagickGetImageColors(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageDelay(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageChannelDepth(arg0: ?*MagickWand, arg1: ChannelType) c_ulong; +pub extern fn MagickGetImageDepth(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageHeight(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageIterations(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageScene(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetImageWidth(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetNumberImages(arg0: ?*MagickWand) c_ulong; +pub extern fn MagickGetResourceLimit(arg0: ResourceType) c_ulong; +pub extern fn MagickGetImageVirtualPixelMethod(arg0: ?*MagickWand) VirtualPixelMethod; +pub extern fn MagickGetImageProfile(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]c_ulong) [*c]u8; +pub extern fn MagickRemoveImageProfile(arg0: ?*MagickWand, arg1: [*c]const u8, arg2: [*c]c_ulong) [*c]u8; +pub extern fn MagickWriteImageBlob(arg0: ?*MagickWand, arg1: [*c]usize) [*c]u8; +pub extern fn MagickClearException(arg0: ?*MagickWand) void; +pub extern fn MagickResetIterator(arg0: ?*MagickWand) void; +pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1; +pub const _STDC_PREDEF_H = 1; +pub const __FLT16_MAX_EXP__ = 15; +pub const __GNUC_VA_LIST = 1; +pub const __BIGGEST_ALIGNMENT__ = 16; +pub const EXIT_SUCCESS = 0; +pub const _IO_USER_LOCK = 32768; +pub const __INT64_FMTd__ = c"ld"; +pub const __STDC_VERSION__ = c_long(201112); +pub const __SIZEOF_FLOAT__ = 4; +pub const MagickSignature = c_ulong(2880220587); +pub const __INT_LEAST32_FMTi__ = c"i"; +pub const MagickLibInterfaceOldest = 3; +pub const __INT_LEAST8_FMTi__ = c"hhi"; +pub const __LDBL_EPSILON__ = 0.000000; +pub const __LZCNT__ = 1; +pub const MaxTextExtent = 2053; +pub const __STDC_UTF_32__ = 1; +pub const __INT_LEAST32_FMTd__ = c"d"; +pub const __INVPCID__ = 1; +pub const __SIG_ATOMIC_WIDTH__ = 32; +pub const __FD_ZERO_STOS = c"stosq"; +pub const __UINT_FAST64_FMTX__ = c"lX"; +pub const __GCC_ATOMIC_LLONG_LOCK_FREE = 2; +pub const DrawGetException = MagickDrawGetException; +pub const __clang_version__ = c"8.0.0 (tags/RELEASE_800/final)"; +pub const __UINT_LEAST8_FMTo__ = c"hho"; +pub const __SIZEOF_DOUBLE__ = 8; +pub const __INTMAX_FMTd__ = c"ld"; +pub const __HAVE_DISTINCT_FLOAT16 = __HAVE_FLOAT16; +pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = 2; +pub const LITTLE_ENDIAN = __LITTLE_ENDIAN; +pub const __INT_LEAST16_FMTi__ = c"hi"; +pub const __GCC_ATOMIC_SHORT_LOCK_FREE = 2; +pub const MAGICK_OFF_F = MAGICK_INT64_F; +pub const _STDLIB_H = 1; +pub const _BITS_STDIO_LIM_H = 1; +pub const __FMA__ = 1; +pub const __MMX__ = 1; +pub const __HAVE_FLOAT64 = 1; +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1; +pub const BYTE_ORDER = __BYTE_ORDER; +pub const __SIZE_FMTX__ = c"lX"; +pub const __ID_T_TYPE = __U32_TYPE; +pub const _THREAD_SHARED_TYPES_H = 1; +pub const MinBlobExtent = c_long(32768); +pub const __RDSEED__ = 1; +pub const RunlengthEncodedCompression = RLECompression; +pub const __INO_T_TYPE = __SYSCALL_ULONG_TYPE; +pub const _BITS_TYPES_H = 1; +pub const __FSBLKCNT_T_TYPE = __SYSCALL_ULONG_TYPE; +pub const __ptr_t = [*c]void; +pub const __WCHAR_WIDTH__ = 32; +pub const __FSGSBASE__ = 1; +pub const __STDC_IEC_559_COMPLEX__ = 1; +pub const __USE_MISC = 1; +pub const __FSBLKCNT64_T_TYPE = __UQUAD_TYPE; +pub const __SIZEOF_PTHREAD_ATTR_T = 56; +pub const __PTRDIFF_FMTd__ = c"ld"; +pub const __DBL_MIN_EXP__ = -1021; +pub const MAGICK_UINT32_F = c""; +pub const __lldiv_t_defined = 1; +pub const __HAVE_FLOAT32X = 1; +pub const __FLT_EVAL_METHOD__ = 0; +pub const __USECONDS_T_TYPE = __U32_TYPE; +pub const __SSE_MATH__ = 1; +pub const __PID_T_TYPE = __S32_TYPE; +pub const __UINT_FAST8_FMTo__ = c"hho"; +pub const __UINT_LEAST64_MAX__ = c_ulong(18446744073709551615); +pub const SignatureSize = 64; +pub const _ALLOCA_H = 1; +pub const __UINT_LEAST64_FMTx__ = c"lx"; +pub const __INT8_MAX__ = 127; +pub const __NLINK_T_TYPE = __SYSCALL_ULONG_TYPE; +pub const __DBL_HAS_DENORM__ = 1; +pub const __FLOAT128__ = 1; +pub const __HAVE_GENERIC_SELECTION = 1; +pub const __FLT16_HAS_QUIET_NAN__ = 1; +pub const __ATOMIC_RELAXED = 0; +pub const __DBL_DECIMAL_DIG__ = 17; +pub const __XSAVEC__ = 1; +pub const __SIZEOF_SHORT__ = 2; +pub const ____FILE_defined = 1; +pub const __UINT16_FMTX__ = c"hX"; +pub const __UINT_FAST16_MAX__ = 65535; +pub const __PTHREAD_MUTEX_HAVE_PREV = 1; +pub const __timeval_defined = 1; +pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = 2; +pub const __SSSE3__ = 1; +pub const __CONSTANT_CFSTRINGS__ = 1; +pub const WEXITED = 4; +pub const __MODE_T_TYPE = __U32_TYPE; +pub const _SYS_CDEFS_H = 1; +pub const _ATFILE_SOURCE = 1; +pub const __AVX2__ = 1; +pub const __RLIM_T_TYPE = __SYSCALL_ULONG_TYPE; +pub const __WINT_MAX__ = c_uint(4294967295); +pub const __LDBL_MAX_EXP__ = 16384; +pub const __USE_POSIX199309 = 1; +pub const _STDIO_H = 1; +pub const __STDC_ISO_10646__ = c_long(201706); +pub const __NO_MATH_INLINES = 1; +pub const __WCHAR_TYPE__ = int; +pub const NewDrawingWand = MagickNewDrawingWand; +pub const __BLKCNT64_T_TYPE = __SQUAD_TYPE; +pub const __LONG_MAX__ = c_long(9223372036854775807); +pub const __STDC_HOSTED__ = 1; +pub const __pic__ = 2; +pub const __PTRDIFF_WIDTH__ = 64; +pub const __INT_FAST16_FMTi__ = c"hi"; +pub const __INT_LEAST32_TYPE__ = int; +pub const __SCHAR_MAX__ = 127; +pub const __USE_POSIX2 = 1; +pub const __LDBL_DENORM_MIN__ = 0.000000; +pub const __HAVE_FLOATN_NOT_TYPEDEF = 0; +pub const __FLT16_MIN_EXP__ = -14; +pub const __TIMESIZE = __WORDSIZE; +pub const RAND_MAX = 2147483647; +pub const __USE_XOPEN2K = 1; +pub const __FLOAT_WORD_ORDER = __BYTE_ORDER; +pub const _IOFBF = 0; +pub const __PRFCHW__ = 1; +pub const __USE_FORTIFY_LEVEL = 0; +pub const __ELF__ = 1; +pub const __INT64_C_SUFFIX__ = L; +pub const __FSFILCNT_T_TYPE = __SYSCALL_ULONG_TYPE; +pub const __LDBL_MANT_DIG__ = 64; +pub const __PTHREAD_MUTEX_LOCK_ELISION = 1; +pub const __SSIZE_T_TYPE = __SWORD_TYPE; +pub const __USE_XOPEN2K8 = 1; +pub const MaxRGBFloat = 65535.000000; +pub const __CLANG_ATOMIC_INT_LOCK_FREE = 2; +pub const __SIZEOF_PTRDIFF_T__ = 8; +pub const ExtendedSignedIntegralType = magick_int64_t; +pub const __SIG_ATOMIC_MAX__ = 2147483647; +pub const __struct_FILE_defined = 1; +pub const _IO_EOF_SEEN = 16; +pub const __USE_ATFILE = 1; +pub const __UINT64_FMTX__ = c"lX"; +pub const __WALL = 1073741824; +pub const __UINT64_MAX__ = c_ulong(18446744073709551615); +pub const __DBL_MANT_DIG__ = 53; +pub const __FLT_DECIMAL_DIG__ = 9; +pub const _____fpos_t_defined = 1; +pub const __INT_LEAST32_MAX__ = 2147483647; +pub const __DBL_DIG__ = 15; +pub const __GLIBC_USE_DEPRECATED_SCANF = 0; +pub const MagickLogFilename = c"log.mgk"; +pub const __ATOMIC_ACQUIRE = 2; +pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = 1; +pub const __USE_ISOC95 = 1; +pub const __FLT16_HAS_DENORM__ = 1; +pub const __UID_T_TYPE = __U32_TYPE; +pub const __UINT_FAST16_FMTu__ = c"hu"; +pub const __INTPTR_FMTi__ = c"li"; +pub const __UINT_FAST8_FMTX__ = c"hhX"; +pub const __LITTLE_ENDIAN__ = 1; +pub const __SSE__ = 1; +pub const __FLT_HAS_QUIET_NAN__ = 1; +pub const __SIZEOF_SIZE_T__ = 8; +pub const __UINT_LEAST16_FMTo__ = c"ho"; +pub const __UINT8_FMTo__ = c"hho"; +pub const MagickSizeType = magick_int64_t; +pub const __HAVE_FLOAT32 = 1; +pub const __UINT_LEAST16_FMTx__ = c"hx"; +pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = 2; +pub const MagickFalse = 0; +pub const __UINT_FAST16_FMTX__ = c"hX"; +pub const __UINT_FAST32_FMTx__ = c"x"; +pub const __VERSION__ = c"4.2.1 Compatible Clang 8.0.0 (tags/RELEASE_800/final)"; +pub const MagickQuantumDepth = c"Q16"; +pub const __UINTPTR_MAX__ = c_ulong(18446744073709551615); +pub const __UINT_FAST8_FMTu__ = c"hhu"; +pub const __UINT_LEAST8_FMTu__ = c"hhu"; +pub const __UINT_LEAST64_FMTo__ = c"lo"; +pub const __clockid_t_defined = 1; +pub const __UINT_LEAST8_MAX__ = 255; +pub const OpaqueOpacity = c_ulong(0); +pub const __SYSCALL_ULONG_TYPE = __ULONGWORD_TYPE; +pub const __warnattr = msg; +pub const __RDRND__ = 1; +pub const __STD_TYPE = typedef; +pub const __SIZEOF_WCHAR_T__ = 4; +pub const __MOVBE__ = 1; +pub const __GLIBC_USE_DEPRECATED_GETS = 0; +pub const MaxMap = c_uint(65535); +pub const __LDBL_MAX__ = inf; +pub const __UINT16_MAX__ = 65535; +pub const _LP64 = 1; +pub const __CLOCK_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const FD_SETSIZE = __FD_SETSIZE; +pub const __x86_64 = 1; +pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED = 1; +pub const __code_model_small_ = 1; +pub const linux = 1; +pub const __SIZEOF_WINT_T__ = 4; +pub const DestroyDrawingWand = MagickDestroyDrawingWand; +pub const __UINTMAX_FMTo__ = c"lo"; +pub const __FLT_DIG__ = 6; +pub const __UINT_LEAST8_FMTX__ = c"hhX"; +pub const __INT16_MAX__ = 32767; +pub const __HAVE_FLOAT64X = 1; +pub const MagickReleaseDate = c"2019-06-15"; +pub const __HAVE_FLOAT16 = 0; +pub const __WINT_UNSIGNED__ = 1; +pub const __FLT_MAX_10_EXP__ = 38; +pub const MAGICK_UINTPTR_F = c"l"; +pub const _FEATURES_H = 1; +pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = 2; +pub const __UINTPTR_FMTX__ = c"lX"; +pub const __UINT_LEAST16_FMTu__ = c"hu"; +pub const __WINT_WIDTH__ = 32; +pub const MagickChangeDate = c"20190615"; +pub const __F16C__ = 1; +pub const AreaResource = UndefinedResource; +pub const __SHRT_MAX__ = 32767; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; +pub const MagickLibInterfaceNewest = 23; +pub const __GCC_ATOMIC_BOOL_LOCK_FREE = 2; +pub const __POINTER_WIDTH__ = 64; +pub const __PTRDIFF_MAX__ = c_long(9223372036854775807); +pub const __tune_corei7__ = 1; +pub const __FLT16_DIG__ = 3; +pub const __INT32_FMTd__ = c"d"; +pub const __DBL_MIN__ = 0.000000; +pub const __SIZEOF_LONG__ = 8; +pub const __S32_TYPE = int; +pub const __TIME_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const __INTPTR_WIDTH__ = 64; +pub const __FLT16_MAX_10_EXP__ = 4; +pub const __INT_FAST32_TYPE__ = int; +pub const __TIME64_T_TYPE = __TIME_T_TYPE; +pub const __W_CONTINUED = 65535; +pub const __NO_INLINE__ = 1; +pub const __UINT_FAST32_FMTX__ = c"X"; +pub const _POSIX_SOURCE = 1; +pub const __LITTLE_ENDIAN = 1234; +pub const __HAVE_FLOAT128 = 0; +pub const __gnu_linux__ = 1; +pub const __INT_FAST32_MAX__ = 2147483647; +pub const _BITS_PTHREADTYPES_COMMON_H = 1; +pub const __corei7__ = 1; +pub const __UINTMAX_FMTu__ = c"lu"; +pub const __BMI__ = 1; +pub const __FILE_defined = 1; +pub const CloneDrawingWand = MagickCloneDrawingWand; +pub const _____fpos64_t_defined = 1; +pub const __FLT_RADIX__ = 2; +pub const __GLIBC_MINOR__ = 29; +pub const __timer_t_defined = 1; +pub const __FLT16_HAS_INFINITY__ = 1; +pub const MaxMapDepth = 16; +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1; +pub const __GCC_ATOMIC_INT_LOCK_FREE = 2; +pub const _BITS_BYTESWAP_H = 1; +pub const IndexChannel = BlackChannel; +pub const __SGX__ = 1; +pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = 3; +pub const _STRUCT_TIMESPEC = 1; +pub const _BITS_STDINT_INTN_H = 1; +pub const __FLT16_DECIMAL_DIG__ = 5; +pub const __PRAGMA_REDEFINE_EXTNAME = 1; +pub const __INT_FAST8_FMTd__ = c"hhd"; +pub const __KEY_T_TYPE = __S32_TYPE; +pub const SEEK_SET = 0; +pub const __INT32_TYPE__ = int; +pub const __USE_POSIX199506 = 1; +pub const __CPU_MASK_TYPE = __SYSCALL_ULONG_TYPE; +pub const MagickFail = 0; +pub const FOPEN_MAX = 16; +pub const MAGICK_OPTIMIZE_FUNC = opt; +pub const MAGICK_INT64_F = c"l"; +pub const __UINTMAX_WIDTH__ = 64; +pub const MAGICK_SSIZE_T_F = c"l"; +pub const __PTHREAD_MUTEX_USE_UNION = 0; +pub const __FLT_MIN__ = 0.000000; +pub const __INT64_FMTi__ = c"li"; +pub const __UINT_FAST64_FMTu__ = c"lu"; +pub const __INT8_FMTd__ = c"hhd"; +pub const MagickLibVersion = 2301952; +pub const __INT_FAST16_TYPE__ = short; +pub const YCbCrColorspace = Rec601YCbCrColorspace; +pub const __HAVE_DISTINCT_FLOAT128 = 0; +pub const __FLT_MAX_EXP__ = 128; +pub const __XSAVE__ = 1; +pub const __DBL_MAX_10_EXP__ = 308; +pub const __LDBL_MIN__ = 0.000000; +pub const __INT_FAST64_FMTi__ = c"li"; +pub const __INT_LEAST8_FMTd__ = c"hhd"; +pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = 2; +pub const __FSFILCNT64_T_TYPE = __UQUAD_TYPE; +pub const MAGICK_RANDOM_MAX = 4294967295; +pub const __UINT_LEAST32_FMTX__ = c"X"; +pub const __PIC__ = 2; +pub const __GID_T_TYPE = __U32_TYPE; +pub const MagickLibVersionText = c"1.3.32"; +pub const __UINTMAX_MAX__ = c_ulong(18446744073709551615); +pub const __UINT_FAST16_FMTo__ = c"ho"; +pub const _DEFAULT_SOURCE = 1; +pub const __FD_SETSIZE = 1024; +pub const __LDBL_DECIMAL_DIG__ = 21; +pub const __UINT_LEAST64_FMTX__ = c"lX"; +pub const __clang_minor__ = 0; +pub const __LDBL_REDIR_DECL = name; +pub const __OFF64_T_TYPE = __SQUAD_TYPE; +pub const __SIZEOF_FLOAT128__ = 16; +pub const __CLOCKID_T_TYPE = __S32_TYPE; +pub const __UINT_FAST64_FMTo__ = c"lo"; +pub const __SIZE_FMTx__ = c"lx"; +pub const __DBL_MAX__ = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878; +pub const __DBL_EPSILON__ = 0.000000; +pub const __UINT64_FMTx__ = c"lx"; +pub const MAGICK_UINTMAX_F = c"l"; +pub const P_tmpdir = c"/tmp"; +pub const __BLKCNT_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const __CHAR_BIT__ = 8; +pub const __WCOREFLAG = 128; +pub const SEEK_END = 2; +pub const __INT16_FMTi__ = c"hi"; +pub const __SLONG32_TYPE = int; +pub const SEEK_CUR = 1; +pub const _DEBUG = 1; +pub const __GNUC_MINOR__ = 2; +pub const __restrict_arr = __restrict; +pub const __UINT_FAST32_MAX__ = c_uint(4294967295); +pub const __RLIM_T_MATCHES_RLIM64_T = 1; +pub const __UINT8_FMTX__ = c"hhX"; +pub const NFDBITS = __NFDBITS; +pub const __FLT_EPSILON__ = 0.000000; +pub const __UINTPTR_WIDTH__ = 64; +pub const MAGICK_PIXELS_BGRA = 1; +pub const __llvm__ = 1; +pub const __UINT_FAST64_MAX__ = c_ulong(18446744073709551615); +pub const __INT_FAST32_FMTi__ = c"i"; +pub const __WNOTHREAD = 536870912; +pub const __time_t_defined = 1; +pub const __FLT_HAS_INFINITY__ = 1; +pub const __FSWORD_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const __DADDR_T_TYPE = __S32_TYPE; +pub const __AES__ = 1; +pub const NULL = if (@typeId(@typeOf(0)) == @import("builtin").TypeId.Pointer) @ptrCast([*c]void, 0) else if (@typeId(@typeOf(0)) == @import("builtin").TypeId.Int) @intToPtr([*c]void, 0) else ([*c]void)(0); +pub const __OFF_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const __UINT8_FMTx__ = c"hhx"; +pub const __INTMAX_C_SUFFIX__ = L; +pub const __ORDER_LITTLE_ENDIAN__ = 1234; +pub const __time64_t = __time_t; +pub const MagickRationalType = double; +pub const DrawClearException = MagickDrawClearException; +pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2; +pub const __INT16_FMTd__ = c"hd"; +pub const __UINT32_FMTX__ = c"X"; +pub const __SUSECONDS_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const HasX11 = 1; +pub const MAGICK_INT32_F = c""; +pub const __PTHREAD_MUTEX_NUSERS_AFTER_KIND = 0; +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1; +pub const MagickPass = 1; +pub const __UINT32_C_SUFFIX__ = U; +pub const MagickSignedType = magick_int64_t; +pub const __INT32_MAX__ = 2147483647; +pub const __GCC_ATOMIC_CHAR_LOCK_FREE = 2; +pub const __INTMAX_WIDTH__ = 64; +pub const MaxRGB = c_uint(65535); +pub const __INO64_T_TYPE = __UQUAD_TYPE; +pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = 2; +pub const EXIT_FAILURE = 1; +pub const __USE_POSIX = 1; +pub const __BIT_TYPES_DEFINED__ = 1; +pub const TransparentOpacity = MaxRGB; +pub const __SIZE_FMTo__ = c"lo"; +pub const __DBL_HAS_QUIET_NAN__ = 1; +pub const __PDP_ENDIAN = 3412; +pub const __INT_FAST8_FMTi__ = c"hhi"; +pub const __UINT_LEAST32_FMTo__ = c"o"; +pub const __STDC_UTF_16__ = 1; +pub const __UINT_LEAST32_MAX__ = c_uint(4294967295); +pub const __ATOMIC_RELEASE = 3; +pub const __UINT_FAST16_FMTx__ = c"hx"; +pub const __UINTMAX_C_SUFFIX__ = UL; +pub const __FLT_MIN_EXP__ = -125; +pub const __SIZEOF_LONG_DOUBLE__ = 16; +pub const __UINT_LEAST64_FMTu__ = c"lu"; +pub const __ldiv_t_defined = 1; +pub const __GCC_ATOMIC_LONG_LOCK_FREE = 2; +pub const __ORDER_PDP_ENDIAN__ = 3412; +pub const __SIZEOF_PTHREAD_BARRIER_T = 32; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT = 0; +pub const __INT_FAST64_FMTd__ = c"ld"; +pub const FILENAME_MAX = 4096; +pub const ExtendedUnsignedIntegralType = magick_uint64_t; +pub const __CLANG_ATOMIC_LONG_LOCK_FREE = 2; +pub const __GXX_ABI_VERSION = 1002; +pub const __INT16_TYPE__ = short; +pub const __SSE2_MATH__ = 1; +pub const __FLT_MANT_DIG__ = 24; +pub const __GLIBC_USE_IEC_60559_TYPES_EXT = 0; +pub const __UINT_FAST64_FMTx__ = c"lx"; +pub const __STDC__ = 1; +pub const __HAVE_FLOAT64X_LONG_DOUBLE = 1; +pub const __INT_FAST8_MAX__ = 127; +pub const __INTPTR_FMTd__ = c"ld"; +pub const __GNUC_PATCHLEVEL__ = 1; +pub const __SIZE_WIDTH__ = 64; +pub const __UINT_LEAST8_FMTx__ = c"hhx"; +pub const __MPX__ = 1; +pub const __INT_LEAST64_FMTi__ = c"li"; +pub const __HAVE_DISTINCT_FLOAT64 = 0; +pub const __SSE4_2__ = 1; +pub const __STDC_IEC_559__ = 1; +pub const __AVX__ = 1; +pub const __INT_FAST16_MAX__ = 32767; +pub const __USE_ISOC99 = 1; +pub const __INTPTR_MAX__ = c_long(9223372036854775807); +pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = 2; +pub const __UINT64_FMTu__ = c"lu"; +pub const __have_pthread_attr_t = 1; +pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__; +pub const __SSE2__ = 1; +pub const MaxMapDouble = 65535.000000; +pub const MAGICK_UINT64_F = c"l"; +pub const __INT_MAX__ = 2147483647; +pub const __BLKSIZE_T_TYPE = __SYSCALL_SLONG_TYPE; +pub const __INTMAX_FMTi__ = c"li"; +pub const __DBL_DENORM_MIN__ = 0.000000; +pub const __clang_major__ = 8; +pub const __FLT16_MANT_DIG__ = 11; +pub const __GNUC__ = 4; +pub const __UINT32_MAX__ = c_uint(4294967295); +pub const MaxRGBDouble = 65535.000000; +pub const _POSIX_C_SOURCE = c_long(200809); +pub const __FLT_DENORM_MIN__ = 0.000000; +pub const __DBL_MAX_EXP__ = 1024; +pub const __INT8_FMTi__ = c"hhi"; +pub const L_tmpnam = 20; +pub const __BIG_ENDIAN = 4321; +pub const __UINT_LEAST16_MAX__ = 65535; +pub const __HAVE_DISTINCT_FLOAT32X = 0; +pub const __XSAVES__ = 1; +pub const __LDBL_HAS_DENORM__ = 1; +pub const __FLT16_MIN_10_EXP__ = -13; +pub const __LDBL_HAS_QUIET_NAN__ = 1; +pub const TMP_MAX = 238328; +pub const __UINT_FAST8_MAX__ = 255; +pub const __DBL_MIN_10_EXP__ = -307; +pub const __GLIBC_USE_LIB_EXT2 = 0; +pub const __SIZEOF_PTHREAD_MUTEX_T = 40; +pub const __UINT8_FMTu__ = c"hhu"; +pub const __OFF_T_MATCHES_OFF64_T = 1; +pub const __RLIM64_T_TYPE = __UQUAD_TYPE; +pub const __HAVE_FLOAT128X = 0; +pub const __INT_FAST64_MAX__ = c_long(9223372036854775807); +pub const __SSE3__ = 1; +pub const __UINT16_FMTu__ = c"hu"; +pub const __ATOMIC_SEQ_CST = 5; +pub const __SIZE_FMTu__ = c"lu"; +pub const __LDBL_MIN_EXP__ = -16381; +pub const __UINT_FAST32_FMTu__ = c"u"; +pub const DrawAllocateWand = MagickDrawAllocateWand; +pub const __SSP_STRONG__ = 2; +pub const __BYTE_ORDER = __LITTLE_ENDIAN; +pub const __clang_patchlevel__ = 0; +pub const MaxMapFloat = 65535.000000; +pub const __SIZEOF_LONG_LONG__ = 8; +pub const __BMI2__ = 1; +pub const EOF = -1; +pub const __HAVE_DISTINCT_FLOAT64X = 0; +pub const __GNUC_STDC_INLINE__ = 1; +pub const MagickTrue = 1; +pub const __FXSR__ = 1; +pub const __PCLMUL__ = 1; +pub const __UINT8_MAX__ = 255; +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1; +pub const _IOLBF = 1; +pub const __UINT32_FMTx__ = c"x"; +pub const __UINT16_FMTo__ = c"ho"; +pub const __POPCNT__ = 1; +pub const __OPENCL_MEMORY_SCOPE_DEVICE = 2; +pub const __SIZEOF_PTHREAD_CONDATTR_T = 4; +pub const __UINT32_FMTu__ = c"u"; +pub const WNOHANG = 1; +pub const __SIZEOF_PTHREAD_COND_T = 48; +pub const __SIZEOF_POINTER__ = 8; +pub const __TIMER_T_TYPE = [*c]void; +pub const __SIZE_MAX__ = c_ulong(18446744073709551615); +pub const __unix = 1; +pub const _BITS_UINTN_IDENTITY_H = 1; +pub const __GLIBC_USE_IEC_60559_BFP_EXT = 0; +pub const MagickPackageName = c"GraphicsMagick"; +pub const __INT_FAST16_FMTd__ = c"hd"; +pub const unix = 1; +pub const __UINT_LEAST32_FMTu__ = c"u"; +pub const __FLT_MAX__ = 340282346999999984391321947108527833088.000000; +pub const __corei7 = 1; +pub const BUFSIZ = 8192; +pub const __HAVE_DISTINCT_FLOAT32 = 0; +pub const __USE_ISOC11 = 1; +pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2; +pub const __ATOMIC_CONSUME = 1; +pub const __unix__ = 1; +pub const __x86_64__ = 1; +pub const __LDBL_HAS_INFINITY__ = 1; +pub const __WORDSIZE_TIME64_COMPAT32 = 1; +pub const __UINTMAX_FMTx__ = c"lx"; +pub const __UINT64_C_SUFFIX__ = UL; +pub const __GNU_LIBRARY__ = 6; +pub const __INT_LEAST16_MAX__ = 32767; +pub const __FLT_MIN_10_EXP__ = -37; +pub const __clock_t_defined = 1; +pub const __UINT32_FMTo__ = c"o"; +pub const __UINTPTR_FMTo__ = c"lo"; +pub const _SYS_SELECT_H = 1; +pub const MaxColormapSize = c_uint(65536); +pub const __INT_LEAST16_FMTd__ = c"hd"; +pub const __UINTPTR_FMTx__ = c"lx"; +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1; +pub const _IONBF = 2; +pub const __INT_LEAST64_FMTd__ = c"ld"; +pub const _SYS_TYPES_H = 1; +pub const __INT_LEAST16_TYPE__ = short; +pub const __attribute_alloc_size__ = params; +pub const __attribute_copy__ = arg; +pub const __ORDER_BIG_ENDIAN__ = 4321; +pub const __LDBL_MIN_10_EXP__ = -4931; +pub const __INT_LEAST8_MAX__ = 127; +pub const __SIZEOF_INT__ = 4; +pub const __USE_POSIX_IMPLICITLY = 1; +pub const __GCC_ATOMIC_POINTER_LOCK_FREE = 2; +pub const NodesInAList = 1536; +pub const _IO_ERR_SEEN = 32; +pub const __amd64 = 1; +pub const _BITS_TIME64_H = 1; +pub const __OBJC_BOOL_IS_BOOL = 0; +pub const __ADX__ = 1; +pub const __LDBL_MAX_10_EXP__ = 4932; +pub const L_ctermid = 9; +pub const __SIZEOF_INT128__ = 16; +pub const __UINT_FAST8_FMTx__ = c"hhx"; +pub const __SIZEOF_PTHREAD_RWLOCK_T = 56; +pub const __glibc_c99_flexarr_available = 1; +pub const __linux = 1; +pub const __sigset_t_defined = 1; +pub const __UINT16_FMTx__ = c"hx"; +pub const MaxTreeDepth = 8; +pub const __UINTPTR_FMTu__ = c"lu"; +pub const __UINT_LEAST16_FMTX__ = c"hX"; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T = 4; +pub const __CLFLUSHOPT__ = 1; +pub const __amd64__ = 1; +pub const __UINT_FAST32_FMTo__ = c"o"; +pub const __linux__ = 1; +pub const __clang__ = 1; +pub const __LP64__ = 1; +pub const __SYSCALL_WORDSIZE = 64; +pub const __PTRDIFF_FMTi__ = c"li"; +pub const __SSE4_1__ = 1; +pub const __LDBL_DIG__ = 18; +pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2; +pub const _BITS_TYPESIZES_H = 1; +pub const DefaultResizeFilter = LanczosFilter; +pub const WCONTINUED = 8; +pub const ReplaceCompositeOp = CopyCompositeOp; +pub const __XSAVEOPT__ = 1; +pub const __UINT64_FMTo__ = c"lo"; +pub const __INT_FAST32_FMTd__ = c"d"; +pub const __HAVE_DISTINCT_FLOAT128X = __HAVE_FLOAT128X; +pub const _BITS_PTHREADTYPES_ARCH_H = 1; +pub const BIG_ENDIAN = __BIG_ENDIAN; +pub const __ATOMIC_ACQ_REL = 4; +pub const PDP_ENDIAN = __PDP_ENDIAN; +pub const __SIZEOF_PTHREAD_BARRIERATTR_T = 4; +pub const __LONG_LONG_MAX__ = c_longlong(9223372036854775807); +pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = 4; +pub const ____mbstate_t_defined = 1; +pub const _ENDIAN_H = 1; +pub const __INO_T_MATCHES_INO64_T = 1; +pub const __GLIBC__ = 2; +pub const WUNTRACED = 2; +pub const DefaultThumbnailFilter = BoxFilter; +pub const __INTMAX_MAX__ = c_long(9223372036854775807); +pub const __UINT_LEAST32_FMTx__ = c"x"; +pub const __WORDSIZE = 64; +pub const MagickUnsignedType = magick_uint64_t; +pub const __WCHAR_MAX__ = 2147483647; +pub const __INT64_MAX__ = c_long(9223372036854775807); +pub const WSTOPPED = 2; +pub const MAGICK_SIZE_T_F = c"l"; +pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = 2; +pub const MagickCopyright = c"Copyright (C) 2002-2019 GraphicsMagick Group.\nAdditional copyrights and licenses apply to this software.\nSee http://www.GraphicsMagick.org/www/Copyright.html for details."; +pub const __INT_LEAST64_MAX__ = c_long(9223372036854775807); +pub const WNOWAIT = 16777216; +pub const __UINTMAX_FMTX__ = c"lX"; +pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = 0; +pub const __FLT_HAS_DENORM__ = 1; +pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__; +pub const __SYSCALL_SLONG_TYPE = __SLONGWORD_TYPE; +pub const __WCLONE = 2147483648; +pub const __DEV_T_TYPE = __UQUAD_TYPE; +pub const __INT32_FMTi__ = c"i"; +pub const __DBL_HAS_INFINITY__ = 1; +pub const QuantumDepth = 16; +pub const __FINITE_MATH_ONLY__ = 0; +pub const __va_list_tag = struct___va_list_tag; +pub const _G_fpos_t = struct__G_fpos_t; +pub const _G_fpos64_t = struct__G_fpos64_t; +pub const _IO_marker = struct__IO_marker; +pub const _IO_codecvt = struct__IO_codecvt; +pub const _IO_wide_data = struct__IO_wide_data; +pub const _IO_FILE = struct__IO_FILE; +pub const timeval = struct_timeval; +pub const timespec = struct_timespec; +pub const __pthread_rwlock_arch_t = struct___pthread_rwlock_arch_t; +pub const __pthread_internal_list = struct___pthread_internal_list; +pub const __pthread_mutex_s = struct___pthread_mutex_s; +pub const __pthread_cond_s = struct___pthread_cond_s; +pub const random_data = struct_random_data; +pub const drand48_data = struct_drand48_data; +pub const _PixelPacket = struct__PixelPacket; +pub const _PrimaryInfo = struct__PrimaryInfo; +pub const _ChromaticityInfo = struct__ChromaticityInfo; +pub const _RectangleInfo = struct__RectangleInfo; +pub const _ErrorInfo = struct__ErrorInfo; +pub const _Timer = struct__Timer; +pub const _TimerInfo = struct__TimerInfo; +pub const _ExceptionInfo = struct__ExceptionInfo; +pub const _ImageExtra = struct__ImageExtra; +pub const _CacheInfo = struct__CacheInfo; +pub const _ThreadViewSet = struct__ThreadViewSet; +pub const _ImageAttribute = struct__ImageAttribute; +pub const _Ascii85Info = struct__Ascii85Info; +pub const _BlobInfo = struct__BlobInfo; +pub const _SemaphoreInfo = struct__SemaphoreInfo; +pub const _Image = struct__Image; +pub const _AffineMatrix = struct__AffineMatrix; +pub const _DoublePixelPacket = struct__DoublePixelPacket; +pub const _FloatPixelPacket = struct__FloatPixelPacket; +pub const _FrameInfo = struct__FrameInfo; +pub const _LongPixelPacket = struct__LongPixelPacket; +pub const _MontageInfo = struct__MontageInfo; +pub const _ProfileInfo = struct__ProfileInfo; +pub const _SegmentInfo = struct__SegmentInfo; +pub const _ImageInfo = struct__ImageInfo; +pub const _ImageCharacteristics = struct__ImageCharacteristics; +pub const _HistogramColorPacket = struct__HistogramColorPacket; +pub const _DifferenceImageOptions = struct__DifferenceImageOptions; +pub const _DifferenceStatistics = struct__DifferenceStatistics; +pub const _CompositeOptions_t = struct__CompositeOptions_t; +pub const _ExportPixelAreaOptions = struct__ExportPixelAreaOptions; +pub const _ExportPixelAreaInfo = struct__ExportPixelAreaInfo; +pub const _ImportPixelAreaOptions = struct__ImportPixelAreaOptions; +pub const _ImportPixelAreaInfo = struct__ImportPixelAreaInfo; +pub const _DelegateInfo = struct__DelegateInfo; +pub const _TypeInfo = struct__TypeInfo; +pub const _GradientInfo = struct__GradientInfo; +pub const _ElementReference = struct__ElementReference; +pub const _DrawInfoExtra = struct__DrawInfoExtra; +pub const _DrawInfo = struct__DrawInfo; +pub const _PointInfo = struct__PointInfo; +pub const _TypeMetric = struct__TypeMetric; +pub const _DrawContext = struct__DrawContext; +pub const _MagickRandomKernel = struct__MagickRandomKernel; +pub const _MagickInfo = struct__MagickInfo; +pub const _PixelIteratorOptions = struct__PixelIteratorOptions; +pub const _QuantizeInfo = struct__QuantizeInfo; +pub const _SignatureInfo = struct__SignatureInfo; +pub const _ImageChannelStatistics = struct__ImageChannelStatistics; +pub const _ImageStatistics = struct__ImageStatistics; +pub const _TokenInfo = struct__TokenInfo; +pub const _PixelWand = struct__PixelWand; +pub const _DrawingWand = struct__DrawingWand; +pub const _MagickWand = struct__MagickWand; diff --git a/src/main.zig b/src/main.zig index f21087e..d5cd92d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,293 +1,39 @@ const std = @import("std"); const langs = @import("lang.zig"); const runners = @import("runner.zig"); -const printer = @import("printer.zig"); - -const log = std.log.scoped(.scritcher); test "scritcher" { _ = @import("lang.zig"); _ = @import("runner.zig"); } -const readline = @cImport({ - @cInclude("stdio.h"); - @cInclude("stdlib.h"); - - @cInclude("readline/readline.h"); - @cInclude("readline/history.h"); -}); - -fn wrapInCmdList(allocator: std.mem.Allocator, cmd: *langs.Command) !langs.CommandList { - var cmds = langs.CommandList.init(allocator); - try cmds.append(cmd); - return cmds; -} - -fn copyCommandToHeap(allocator: std.mem.Allocator, command: langs.Command, comptime tag: langs.Command.Tag) !*langs.Command { - const CommandStruct = langs.Command.tagToType(tag); - const casted = command.cast(CommandStruct).?; - var heap_cmd = try allocator.create(CommandStruct); - - heap_cmd.* = casted.*; - log.debug("casted: {}", .{casted}); - log.debug("heap_cmd: {}", .{heap_cmd}); - - return &heap_cmd.base; -} - -pub fn doRepl(allocator: std.mem.Allocator, args_it: anytype) !void { - var stdout_file = std.io.getStdOut(); - const stdout = &stdout_file.writer(); - const scri_path = (args_it.next() orelse @panic("expected scri path")); - errdefer allocator.free(scri_path); - defer allocator.free(scri_path); - - var file_read_opt: ?std.fs.File = std.fs.cwd().openFile(scri_path, .{}) catch |err| blk: { - if (err == error.FileNotFound) break :blk null; - return err; - }; - const total_bytes = if (file_read_opt) |file_read| try file_read.getEndPos() else 0; - - var cmds = langs.CommandList.init(allocator); - defer cmds.deinit(); +pub fn main() !void { + const allocator = std.heap.direct_allocator; var lang = langs.Lang.init(allocator); defer lang.deinit(); - if (total_bytes > 0) { - const scri_existing = try allocator.alloc(u8, total_bytes); - _ = try file_read_opt.?.read(scri_existing); - defer allocator.free(scri_existing); + var args_it = std.process.args(); - // we can't defer this directly because we copy the - // Command pointers to the cmds list. running deinit() directly - // would cause those pointers to be freed. - var existing_cmds = try lang.parse(scri_existing); - defer existing_cmds.list.deinit(); + _ = try (args_it.next(allocator) orelse @panic("expected exe name")); + const scri_path = try (args_it.next(allocator) orelse @panic("expected scri path")); - // copy the existing command list into the repl's command list - for (existing_cmds.list.items) |existing_cmd| { - try cmds.append(existing_cmd); - } - } else { - // if there isn't any commands on the file, we load our default - // 'load :0' command - - // TODO: deliberate memleak here. we only allocate this - // command once, for the start of the file, so. - var load_cmd = try allocator.create(langs.Command.Load); - load_cmd.path = ":0"; - load_cmd.base.tag = langs.Command.Tag.load; - - // taking address is fine, because load_cmd lives in the lifetime - // of the allocator. - try cmds.append(&load_cmd.base); - } - - if (file_read_opt) |file_read| { - file_read.close(); - } - - var file = try std.fs.cwd().createFile(scri_path, .{ - .read = false, - .truncate = true, - }); - defer file.close(); - - var out = file.writer(); - const stream = &out; - - // since we opened the file for writing, it becomes empty, so, to ensure - // we don't fuck up later on, we print cmds before starting the repl - try printer.printList(cmds, stdout); - try printer.printList(cmds, stream); - - // we keep - // - a CommandList with the full commands we have right now - // - a Command with the current last typed successful command - - // - one runner that contains the current full state of the image - // as if the current cmds was ran over it (TODO better wording) - // - one runner that gets copied from the original on every new - // command the user issues - - var current: langs.Command = undefined; - - var runner = runners.Runner.init(allocator, true); - defer runner.deinit(); - - // run the load command - try runner.runCommands(cmds, true); - - const wanted_runner: []const u8 = std.posix.getenv("SCRITCHER_RUNNER") orelse "ristretto"; - - var runqs_cmd = langs.Command.RunQS{ - .base = langs.Command{ .tag = langs.Command.Tag.runqs }, - .program = wanted_runner, - }; - - while (true) { - lang.reset(); - - var rd_line = readline.readline("> "); - if (rd_line == null) { - log.debug("leaving from eof", .{}); - break; - } - readline.add_history(rd_line); - //defer std.heap.c_allocator.destroy(rd_line); - - const line = rd_line[0..std.mem.len(rd_line)]; - - if (std.mem.eql(u8, line, "push")) { - const heap_cmd = switch (current.tag) { - .noop => try copyCommandToHeap(allocator, current, .noop), - .load => try copyCommandToHeap(allocator, current, .load), - .quicksave => try copyCommandToHeap(allocator, current, .quicksave), - .runqs => try copyCommandToHeap(allocator, current, .runqs), - .amp => try copyCommandToHeap(allocator, current, .amp), - .rflanger => try copyCommandToHeap(allocator, current, .rflanger), - .eq => try copyCommandToHeap(allocator, current, .eq), - .phaser => try copyCommandToHeap(allocator, current, .phaser), - .mbeq => try copyCommandToHeap(allocator, current, .mbeq), - .chorus => try copyCommandToHeap(allocator, current, .chorus), - .pitchscaler => try copyCommandToHeap(allocator, current, .pitchscaler), - .reverb => try copyCommandToHeap(allocator, current, .reverb), - .highpass => try copyCommandToHeap(allocator, current, .highpass), - .delay => try copyCommandToHeap(allocator, current, .delay), - .vinyl => try copyCommandToHeap(allocator, current, .vinyl), - .revdelay => try copyCommandToHeap(allocator, current, .revdelay), - .gate => try copyCommandToHeap(allocator, current, .gate), - .detune => try copyCommandToHeap(allocator, current, .detune), - .overdrive => try copyCommandToHeap(allocator, current, .overdrive), - .degrade => try copyCommandToHeap(allocator, current, .degrade), - .repsycho => try copyCommandToHeap(allocator, current, .repsycho), - .talkbox => try copyCommandToHeap(allocator, current, .talkbox), - .dyncomp => try copyCommandToHeap(allocator, current, .dyncomp), - .thruzero => try copyCommandToHeap(allocator, current, .thruzero), - .foverdrive => try copyCommandToHeap(allocator, current, .foverdrive), - .gverb => try copyCommandToHeap(allocator, current, .gverb), - .invert => try copyCommandToHeap(allocator, current, .invert), - .tapedelay => try copyCommandToHeap(allocator, current, .tapedelay), - .moddelay => try copyCommandToHeap(allocator, current, .moddelay), - .multichorus => try copyCommandToHeap(allocator, current, .multichorus), - .saturator => try copyCommandToHeap(allocator, current, .saturator), - .vintagedelay => try copyCommandToHeap(allocator, current, .vintagedelay), - .noise => try copyCommandToHeap(allocator, current, .noise), - .wildnoise => try copyCommandToHeap(allocator, current, .wildnoise), - .write => try copyCommandToHeap(allocator, current, .write), - .embed => try copyCommandToHeap(allocator, current, .embed), - .rotate => try copyCommandToHeap(allocator, current, .rotate), - }; - - try cmds.append(heap_cmd); - - // run the current added command to main cmds list - // with the main parent runner - var cmds_wrapped = try wrapInCmdList(allocator, heap_cmd); - defer cmds_wrapped.deinit(); - try runner.runCommands(cmds_wrapped, true); - - continue; - } else if (std.mem.eql(u8, line, "list")) { - try printer.printList(cmds, stdout); - continue; - } else if (std.mem.eql(u8, line, "save")) { - // seek to 0 instead of appending the new command - // NOTE appending single command might be faster - try file.seekTo(0); - try printer.printList(cmds, stream); - continue; - } else if (std.mem.eql(u8, line, "quit") or std.mem.eql(u8, line, "q")) { - log.debug("leaving", .{}); - break; - } else if (std.mem.startsWith(u8, line, "#")) { - continue; - } - - var cmds_parsed = lang.parse(line) catch |err| { - log.debug("repl: error while parsing: {}", .{err}); - continue; - }; - - // no command? ignore! - if (cmds_parsed.list.items.len == 0) continue; - current = cmds_parsed.list.items[0].*; - - // by cloning the parent runner, we can iteratively write - // whatever command we want and only commit the good results - // back to the parent runner - var runner_clone = try runner.clone(); - defer runner_clone.deinit(); - - // taking address is fine, because runqs_cmd lives in the lifetime - // of this function. - try cmds_parsed.append(&runqs_cmd.base); - - try runner_clone.runCommands(cmds_parsed, true); - _ = try stdout.write("\n"); - } -} - -fn doHelp() void { - log.debug("scritcher!", .{}); - log.debug("usage: scritcher [run|help|repl]", .{}); - log.debug("\tscritcher run path_to_script.scri path_to_input_file.bmp", .{}); - log.debug("\tscritcher repl path_to_script.scri path_to_input_file.bmp", .{}); -} - -fn doRun(allocator: std.mem.Allocator, args_it: anytype) !void { - var lang = langs.Lang.init(allocator); - defer lang.deinit(); - - var runner = runners.Runner.init(allocator, false); - defer runner.deinit(); - - const scri_path = (args_it.next() orelse @panic("run: expected scri path")); - - var file = try std.fs.cwd().openFile(scri_path, .{}); + var file = try std.fs.File.openRead(scri_path); defer file.close(); // sadly, we read it all into memory. such is life const total_bytes = try file.getEndPos(); - const data = try allocator.alloc(u8, total_bytes); + var data = try allocator.alloc(u8, total_bytes); defer allocator.free(data); _ = try file.read(data); var cmds = try lang.parse(data); defer cmds.deinit(); - try runner.runCommands(cmds, true); -} - -pub fn main() !void { - var allocator_instance = std.heap.GeneralPurposeAllocator(.{}){}; - defer { - _ = allocator_instance.deinit(); - } - const allocator = allocator_instance.allocator(); - - var args_it = try std.process.argsWithAllocator(allocator); - defer args_it.deinit(); - - _ = args_it.skip(); - const cli_command_opt = args_it.next(); - if (cli_command_opt == null) { - return doHelp(); - } - - const cli_command = cli_command_opt.?; - - if (std.mem.eql(u8, cli_command, "help")) { - return doHelp(); - } else if (std.mem.eql(u8, cli_command, "repl")) { - return try doRepl(allocator, &args_it); - } else if (std.mem.eql(u8, cli_command, "run")) { - return try doRun(allocator, &args_it); - } else { - log.debug("unknown command: '{s}'", .{cli_command}); - return error.UnknownCommand; - } + // not needed for bug reproduction + //var runner = runners.Runner.init(allocator); + //defer runner.deinit(); + + //try runner.runCommands(cmds, true); } diff --git a/src/plugin.zig b/src/plugin.zig index 29ec224..daf8023 100644 --- a/src/plugin.zig +++ b/src/plugin.zig @@ -3,7 +3,6 @@ const std = @import("std"); const lv2 = @import("lv2_helpers.zig"); const c = lv2.c; -const log = std.log.scoped(.scritcher_plugin); const ImageError = @import("image.zig").ImageError; /// Control port @@ -17,7 +16,7 @@ pub const Param = struct { /// List of parameters to be set to control ports. pub const ParamList = std.ArrayList(Param); -pub const ParamMap = std.StringHashMap(f32); +pub const ParamMap = std.AutoHashMap([]const u8, f32); /// Represents an absolute position in the image. pub const SeekPos = struct { @@ -35,8 +34,7 @@ pub const Position = struct { index: usize, pub fn seekPos(self: Position, total_size: usize) SeekPos { - std.debug.assert(self.index <= self.split); - const tot = total_size / self.split; + var tot = total_size / self.split; return SeekPos{ .start = self.index * tot, @@ -47,7 +45,7 @@ pub const Position = struct { /// Represents the starting context for a single plugin run. pub const Context = struct { - allocator: std.mem.Allocator, + allocator: *std.mem.Allocator, world: *c.LilvWorld, plugin: *const c.LilvPlugin, @@ -62,11 +60,29 @@ pub const Context = struct { /// Specific run context for non-plugins. pub const RunBuffers = struct { - // we use [2]f32 to account for stereo plugins, however - // we only use in_buf[0] and out_buf[0], and don't use the - // (supposedly) right side of neither input or output. - in: [2]f32 = [_]f32{0} ** 2, - out: [2]f32 = [_]f32{0} ** 2, + allocator: *std.mem.Allocator, + + in: []f32, + out: []f32, + + pub fn init(allocator: *std.mem.Allocator) !RunBuffers { + // we allocate []f32 with size 2 to account for stereo plugins, however + // we only use &in_buf[0] and &out_buf[0], and don't use the + // (supposedly) right side of neither input or output. + var in_buf = try allocator.alloc(f32, 2); + std.mem.secureZero(f32, in_buf); + + return RunBuffers{ + .allocator = allocator, + .in = in_buf, + .out = try allocator.alloc(f32, 2), + }; + } + + pub fn deinit(self: *RunBuffers) void { + self.allocator.free(self.in); + self.allocator.free(self.out); + } }; /// Represents the specific run context of plugin instantation. @@ -75,12 +91,10 @@ pub const RunContext = struct { instance: *c.LilvInstance, pub fn init( - allocator: std.mem.Allocator, + allocator: *std.mem.Allocator, plugin: *const c.LilvPlugin, ) !RunContext { - _ = allocator; // TODO batch RunBuffers? - - const instance = c.lilv_plugin_instantiate(plugin, @as(f64, 44100), null); + var instance = c.lilv_plugin_instantiate(plugin, f64(44100), null); errdefer c.lilv_instance_free(instance); if (instance == null) { @@ -88,67 +102,63 @@ pub const RunContext = struct { } return RunContext{ - .buffers = RunBuffers{}, + .buffers = try RunBuffers.init(allocator), .instance = instance.?, }; } pub fn deinit(self: *RunContext) void { c.lilv_instance_free(self.instance); + self.buffers.deinit(); } pub fn connectPorts(self: *RunContext, ports: []lv2.Port) void { var i: usize = 0; var o: usize = 0; - for (ports, 0..) |_, p_idx| { - const p = @as(u32, @intCast(p_idx)); + var in_buf = self.buffers.in; + var out_buf = self.buffers.out; + + for (ports) |_, p_idx| { + var p = @intCast(u32, p_idx); var port: *lv2.Port = &ports[p_idx]; switch (port.ptype) { .Control => lv2.lilv_instance_connect_port(self.instance, p, &port.value), - .Audio => { + .Audio => blk: { if (port.is_input) { - lv2.lilv_instance_connect_port( - self.instance, - p, - &self.buffers.in[i], - ); + lv2.lilv_instance_connect_port(self.instance, p, &in_buf[i]); i += 1; } else { - lv2.lilv_instance_connect_port( - self.instance, - p, - &self.buffers.out[o], - ); + lv2.lilv_instance_connect_port(self.instance, p, &out_buf[o]); o += 1; } }, - // else => lv2.lilv_instance_connect_port(self.instance, p, null), + else => lv2.lilv_instance_connect_port(self.instance, p, null), } } } }; -pub fn makeContext(allocator: std.mem.Allocator, plugin_uri: []const u8) !Context { - const cstr_plugin_uri = try allocator.dupeZ(u8, plugin_uri); +pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Context { + const cstr_plugin_uri = try std.cstr.addNullByte(allocator, plugin_uri); defer allocator.free(cstr_plugin_uri); - const world: *c.LilvWorld = c.lilv_world_new().?; + var world: *c.LilvWorld = c.lilv_world_new().?; errdefer c.lilv_world_free(world); c.lilv_world_load_all(world); - const uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse { - log.debug("Invalid plugin URI <{s}>", .{plugin_uri}); + var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse blk: { + std.debug.warn("Invalid plugin URI <{}>\n", plugin_uri); return ImageError.InvalidPlugin; }; defer c.lilv_node_free(uri); - const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world).?; + const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world); - const plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse { - log.debug("Plugin <{s}> not found", .{plugin_uri}); + var plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse blk: { + std.debug.warn("Plugin <{}> not found\n", plugin_uri); return ImageError.UnknownPlugin; }; diff --git a/src/printer.zig b/src/printer.zig deleted file mode 100644 index b3da89b..0000000 --- a/src/printer.zig +++ /dev/null @@ -1,88 +0,0 @@ -const std = @import("std"); -const langs = @import("lang.zig"); - -const log = std.log.scoped(.scritcher_printer); - -fn printCommandWithParams(stream: anytype, command: anytype) !void { - const Parameters = @TypeOf(command.parameters); - try stream.print(" {d} {d}", .{ command.split, command.index }); - inline for (@typeInfo(Parameters).Struct.fields) |field| { - if (field.type == f32 or field.type == f64) { - try stream.print(" {}", .{@field(command.parameters, field.name)}); - } else if (field.type == usize or field.type == u64) { - try stream.print(" {d}", .{@field(command.parameters, field.name)}); - } else { - try stream.print(" {s}", .{@field(command.parameters, field.name)}); - } - } -} - -fn printCommand(stream: anytype, cmd: *langs.Command, comptime tag: langs.Command.Tag) !void { - const CommandStruct = langs.Command.tagToType(tag); - const casted = cmd.cast(CommandStruct).?; - - const ctype = CommandStruct.command_type; - switch (ctype) { - .lv2_command => try printCommandWithParams(stream, casted), - .custom_command => try printCommandWithParams(stream, casted), - } -} - -pub fn printList(list: langs.CommandList, stream: anytype) !void { - for (list.list.items) |cmd| { - const command = @tagName(cmd.tag); - try stream.print("{s}", .{command}); - - switch (cmd.tag) { - .load => { - const load = cmd.cast(langs.Command.Load).?; - try stream.print(" {s}", .{load.path}); - }, - .runqs => { - const runqs = cmd.cast(langs.Command.RunQS).?; - try stream.print(" {s}", .{runqs.program}); - }, - .noop, .quicksave => {}, - .rotate => { - const rotate = cmd.cast(langs.Command.Rotate).?; - try stream.print(" {d} {s}", .{ rotate.deg, rotate.bgfill }); - }, - - .amp => try printCommand(stream, cmd, .amp), - .rflanger => try printCommand(stream, cmd, .rflanger), - .eq => try printCommand(stream, cmd, .eq), - .phaser => try printCommand(stream, cmd, .phaser), - .mbeq => try printCommand(stream, cmd, .mbeq), - .chorus => try printCommand(stream, cmd, .chorus), - .pitchscaler => try printCommand(stream, cmd, .pitchscaler), - .reverb => try printCommand(stream, cmd, .reverb), - .highpass => try printCommand(stream, cmd, .highpass), - .delay => try printCommand(stream, cmd, .delay), - .vinyl => try printCommand(stream, cmd, .vinyl), - .revdelay => try printCommand(stream, cmd, .revdelay), - .gate => try printCommand(stream, cmd, .gate), - .detune => try printCommand(stream, cmd, .detune), - .overdrive => try printCommand(stream, cmd, .overdrive), - .degrade => try printCommand(stream, cmd, .degrade), - .repsycho => try printCommand(stream, cmd, .repsycho), - .talkbox => try printCommand(stream, cmd, .talkbox), - .dyncomp => try printCommand(stream, cmd, .dyncomp), - .thruzero => try printCommand(stream, cmd, .thruzero), - .foverdrive => try printCommand(stream, cmd, .foverdrive), - .gverb => try printCommand(stream, cmd, .gverb), - .invert => try printCommand(stream, cmd, .invert), - .tapedelay => try printCommand(stream, cmd, .tapedelay), - .moddelay => try printCommand(stream, cmd, .moddelay), - .multichorus => try printCommand(stream, cmd, .multichorus), - .saturator => try printCommand(stream, cmd, .saturator), - .vintagedelay => try printCommand(stream, cmd, .vintagedelay), - - .noise => try printCommand(stream, cmd, .noise), - .wildnoise => try printCommand(stream, cmd, .wildnoise), - .write => try printCommand(stream, cmd, .write), - .embed => try printCommand(stream, cmd, .embed), - } - - _ = try stream.write(";\n"); - } -} diff --git a/src/runner.zig b/src/runner.zig index 85b8d79..625c1f1 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -5,8 +5,6 @@ const plugin = @import("plugin.zig"); const custom = @import("custom.zig"); const magick = @import("magick.zig"); -const log = std.log.scoped(.scritcher_runner); - const Position = plugin.Position; const ParamList = plugin.ParamList; const ParamMap = plugin.ParamMap; @@ -20,21 +18,12 @@ pub const RunError = error{ }; pub const Runner = struct { - allocator: std.mem.Allocator, - - /// The currently opened image in the runner + allocator: *std.mem.Allocator, image: ?*Image = null, - /// If the runner is in REPL mode - repl: bool, - - args: []const [:0]u8, - - pub fn init(allocator: std.mem.Allocator, repl: bool) Runner { + pub fn init(allocator: *std.mem.Allocator) Runner { return Runner{ .allocator = allocator, - .repl = repl, - .args = std.process.argsAlloc(allocator) catch unreachable, }; } @@ -42,59 +31,41 @@ pub const Runner = struct { if (self.image) |image| { image.close(); } - - std.process.argsFree(self.allocator, self.args); - } - - pub fn clone(self: *Runner) !Runner { - const cloned_image = if (self.image) |image| try image.clone() else null; - return Runner{ - .allocator = self.allocator, - .image = cloned_image, - .repl = self.repl, - .args = self.args, - }; } fn resolveArg(self: *Runner, load_path: []const u8) ![]const u8 { - std.debug.assert(load_path.len > 0); if (load_path[0] == ':') { // parse the index from 1 to end - var index = try std.fmt.parseInt(usize, load_path[1..], 10); + const index = try std.fmt.parseInt(usize, load_path[1..], 10); + var args_it = std.process.args(); + _ = args_it.skip(); - // if it isn't in the repl, args look like this: - // 'scritcher ./script ./image' - // if it is, it looks like this - // 'scritcher repl ./script ./image' - - // ':0' should ALWAYS point to the image. - if (self.repl) index += 3 else index += 3; - - for (self.args, 0..) |arg, idx| { - log.debug("arg{d} = {s}", .{ idx, arg }); + var i: usize = 0; + while (i <= index) : (i += 1) { + _ = args_it.skip(); } - log.debug("fetch arg idx={d}", .{index}); - log.debug("fetch arg val={s}", .{self.args[index]}); - return self.args[index]; + + const arg = try (args_it.next(self.allocator) orelse @panic("expected argument")); + + return arg; } else { return load_path; } } - // Caller owns returned memory. fn resolveArgPath(self: *Runner, path_or_argidx: []const u8) ![]const u8 { const path = try self.resolveArg(path_or_argidx); const resolved_path = try std.fs.path.resolve( self.allocator, - &[_][]const u8{path}, + [_][]const u8{path}, ); return resolved_path; } fn loadCmd(self: *Runner, path_or_argidx: []const u8) !void { - const load_path = try self.resolveArgPath(path_or_argidx); - log.debug("\tload path: {s}", .{load_path}); + var load_path = try self.resolveArgPath(path_or_argidx); + std.debug.warn("\tload path: {}\n", load_path); // we could use ImageMagick to convert from X to BMP // but i can't find an easy way to do things in memory. @@ -103,15 +74,14 @@ pub const Runner = struct { // before loading the file into scritcher. for example, you can start // krita/gimp and make it export a bmp and while in the program you can // apply filters, etc. - if (!std.mem.endsWith(u8, load_path, ".bmp") and !std.mem.endsWith(u8, load_path, ".ppm")) { - log.debug("Only BMP files are allowed to be loaded. Got path '{s}'", .{load_path}); + if (!std.mem.endsWith(u8, load_path, ".bmp")) { + std.debug.warn("Only BMP files are allowed to be loaded.\n"); return RunError.NoBMP; } // we don't copy load_path into a temporary file because we're already // loading it under the SFM_READ mode, which won't cause any destructive // operations on the file. - if (self.image) |image| image.close(); self.image = try Image.open(self.allocator, load_path); } @@ -119,21 +89,20 @@ pub const Runner = struct { if (self.image) |image| { return image; } else { - log.debug("image is required!", .{}); + std.debug.warn("image is required!\n"); return RunError.ImageRequired; } } - /// Caller owns returned memory. fn makeGlitchedPath(self: *Runner) ![]const u8 { // we want to transform basename, if it is "x.bmp" to "x_gN.bmp", where // N is the maximum non-used integer. - const image = try self.getImage(); + var image = try self.getImage(); const basename = std.fs.path.basename(image.path); const dirname = std.fs.path.dirname(image.path).?; - var dir = try std.fs.cwd().openDir(dirname, .{ .iterate = true }); + var dir = try std.fs.Dir.open(self.allocator, dirname); defer dir.close(); const period_idx = std.mem.lastIndexOf(u8, basename, ".").?; @@ -141,18 +110,18 @@ pub const Runner = struct { // starts_with would be "x_g", we want to find all files in the directory // that start with that name. - const starts_with = try std.fmt.allocPrint(self.allocator, "{s}_g", .{ + const starts_with = try std.fmt.allocPrint( + self.allocator, + "{}_g", basename[0..period_idx], - }); + ); defer self.allocator.free(starts_with); var max: usize = 0; - var it = dir.iterate(); - - while (try it.next()) |entry| { + while (try dir.next()) |entry| { switch (entry.kind) { - .file => blk: { + .File => blk: { if (!std.mem.startsWith(u8, entry.name, starts_with)) break :blk {}; // we want to get the N in x_gN.ext @@ -166,8 +135,6 @@ pub const Runner = struct { // if N isn't a number, we just ignore that file const idx_str = entry.name[entry_gidx + 2 .. entry_pidx]; const idx = std.fmt.parseInt(usize, idx_str, 10) catch |err| { - log.debug("ignoring file {s}", .{@errorName(err)}); - break :blk {}; }; @@ -177,12 +144,14 @@ pub const Runner = struct { } } - const out_path = try std.fmt.allocPrint(self.allocator, "{s}/{s}{d}{s}", .{ + const out_path = try std.fmt.allocPrint( + self.allocator, + "{}/{}{}{}", dirname, starts_with, max + 1, extension, - }); + ); return out_path; } @@ -190,155 +159,333 @@ pub const Runner = struct { fn quicksaveCmd(self: *Runner) !void { var image = try self.getImage(); const out_path = try self.makeGlitchedPath(); - defer self.allocator.free(out_path); try image.saveTo(out_path); } - fn runQSCmd(self: *Runner, cmd: *lang.Command) !void { - const runqs = cmd.cast(lang.Command.RunQS).?; + fn runQSCmd(self: *Runner, program: []const u8) !void { var image = try self.getImage(); const out_path = try self.makeGlitchedPath(); - defer self.allocator.free(out_path); try image.saveTo(out_path); - var proc = std.ChildProcess.init( - &[_][]const u8{ runqs.program, out_path }, + var proc = try std.ChildProcess.init( + [_][]const u8{ program, out_path }, self.allocator, ); - //defer proc.deinit(); + defer proc.deinit(); - log.debug("running '{s} {s}'", .{ runqs.program, out_path }); + std.debug.warn("running '{} {}'", program, out_path); _ = try proc.spawnAndWait(); } - fn rotateCmd(self: *Runner, cmd: *lang.Command) !void { - const rotate_cmd = cmd.cast(lang.Command.Rotate).?; - - const image = try self.getImage(); - const c_bgfill = try self.allocator.dupeZ(u8, rotate_cmd.bgfill); - defer self.allocator.free(c_bgfill); - - try magick.runRotate(image, rotate_cmd.deg, c_bgfill); + /// Run the http://lv2plug.in/plugins/eg-amp plugin over the file. + fn ampCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://lv2plug.in/plugins/eg-amp", pos, params); } - fn executeLV2Command(self: *@This(), command: anytype) !void { - const pos = plugin.Position{ - .split = command.split, - .index = command.index, - }; + fn rFlangerCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/retroFlange", pos, params); + } + fn eqCmd(self: *Runner, position: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/dj_eq_mono", position, params); + } + + fn phaserCmd(self: *Runner, position: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/lfoPhaser", position, params); + } + + fn mbeqCmd(self: *Runner, position: Position, bands: []const f32) !void { + var image = try self.getImage(); var params = ParamList.init(self.allocator); defer params.deinit(); - const typ = @TypeOf(command); - - inline for (@typeInfo(@TypeOf(command.parameters)).Struct.fields) |cmd_field| { + for (bands) |band_value, idx| { + var sym = try std.fmt.allocPrint(self.allocator, "band_{}", idx + 1); try params.append(plugin.Param{ - .sym = cmd_field.name, - .value = @field(command.parameters, cmd_field.name), + .sym = sym, + .value = band_value, }); } - var image = try self.getImage(); - try image.runPlugin(typ.lv2_url, pos, params); + try image.runPlugin("http://plugin.org.uk/swh-plugins/mbeq", position, params); } - fn executeCustomCommand(self: *@This(), command: anytype) !void { - const pos = plugin.Position{ - .split = command.split, - .index = command.index, - }; - + fn chorusCmd(self: *Runner, pos: Position, params: ParamList) !void { var image = try self.getImage(); - try image.runCustomPlugin(@TypeOf(command).plugin_type, pos, command.parameters); + try image.runPlugin("http://plugin.org.uk/swh-plugins/multivoiceChorus", pos, params); } - fn runSingleCommand( - self: *@This(), - cmd: *lang.Command, - comptime tag: lang.Command.Tag, + fn pitchScalerCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/pitchScaleHQ", pos, params); + } + + fn reverbCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://invadarecords.com/plugins/lv2/erreverb/mono", pos, params); + } + + fn highpassCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://invadarecords.com/plugins/lv2/filter/hpf/mono", pos, params); + } + + fn delayCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/delayorama", pos, params); + } + + fn vinylCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/vynil", pos, params); + } + + fn revDelayCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/revdelay", pos, params); + } + + fn noiseCmd(self: *Runner, pos: Position, map: *ParamMap) !void { + var image = try self.getImage(); + try image.runCustomPlugin(custom.RandomNoise, pos, map); + } + + fn wildNoiseCmd(self: *Runner, pos: Position, map: *ParamMap) !void { + var image = try self.getImage(); + try image.runCustomPlugin(custom.WildNoise, pos, map); + } + + fn writeCmd(self: *Runner, pos: Position, map: *ParamMap) !void { + var image = try self.getImage(); + try image.runCustomPlugin(custom.Write, pos, map); + } + + fn rotateCmd( + self: *Runner, + deg: f32, + bgfill: []const u8, ) !void { - const typ = lang.Command.tagToType(tag); - const command = cmd.cast(typ).?; - const ctype = typ.command_type; - switch (ctype) { - .lv2_command => try self.executeLV2Command(command.*), - .custom_command => try self.executeCustomCommand(command.*), - } + var image = try self.getImage(); + var c_bgfill = try std.cstr.addNullByte(self.allocator, bgfill); + defer self.allocator.free(c_bgfill); + + try magick.runRotate(image, deg, c_bgfill); } - fn runCommand(self: *@This(), cmd: *lang.Command) !void { - switch (cmd.tag) { - .noop => {}, - .load => { - const command = cmd.cast(lang.Command.Load).?; - try self.loadCmd(command.path); + fn runCommand(self: *Runner, cmd: *lang.Command) !void { + var params = ParamList.init(self.allocator); + defer params.deinit(); + + var map = ParamMap.init(self.allocator); + defer map.deinit(); + + return switch (cmd.command) { + .Noop => {}, + .Load => blk: { + var path = cmd.args.at(0); + try self.loadCmd(path); + break :blk; }, - .quicksave => try self.quicksaveCmd(), - .rotate => try self.rotateCmd(cmd), - .runqs => try self.runQSCmd(cmd), + .Quicksave => try self.quicksaveCmd(), + .RunQS => try self.runQSCmd(cmd.args.at(0)), - .amp => try self.runSingleCommand(cmd, .amp), - .rflanger => try self.runSingleCommand(cmd, .rflanger), - .eq => try self.runSingleCommand(cmd, .eq), - .phaser => try self.runSingleCommand(cmd, .phaser), - .mbeq => try self.runSingleCommand(cmd, .mbeq), - .chorus => try self.runSingleCommand(cmd, .chorus), - .pitchscaler => try self.runSingleCommand(cmd, .pitchscaler), - .reverb => try self.runSingleCommand(cmd, .reverb), - .highpass => try self.runSingleCommand(cmd, .highpass), - .delay => try self.runSingleCommand(cmd, .delay), - .vinyl => try self.runSingleCommand(cmd, .vinyl), - .revdelay => try self.runSingleCommand(cmd, .revdelay), - .gate => try self.runSingleCommand(cmd, .gate), - .detune => try self.runSingleCommand(cmd, .detune), - .overdrive => try self.runSingleCommand(cmd, .overdrive), - .degrade => try self.runSingleCommand(cmd, .degrade), - .repsycho => try self.runSingleCommand(cmd, .repsycho), - .talkbox => try self.runSingleCommand(cmd, .talkbox), - .dyncomp => try self.runSingleCommand(cmd, .dyncomp), - .thruzero => try self.runSingleCommand(cmd, .thruzero), - .foverdrive => try self.runSingleCommand(cmd, .foverdrive), - .gverb => try self.runSingleCommand(cmd, .gverb), - .invert => try self.runSingleCommand(cmd, .invert), - .tapedelay => try self.runSingleCommand(cmd, .tapedelay), - .moddelay => try self.runSingleCommand(cmd, .moddelay), - .multichorus => try self.runSingleCommand(cmd, .multichorus), - .saturator => try self.runSingleCommand(cmd, .saturator), - .vintagedelay => try self.runSingleCommand(cmd, .vintagedelay), + .Amp => blk: { + const pos = try cmd.consumePosition(); + try cmd.appendParam(¶ms, "gain"); + try self.ampCmd(pos, params); + }, - .noise => try self.runSingleCommand(cmd, .noise), - .wildnoise => try self.runSingleCommand(cmd, .wildnoise), - .write => try self.runSingleCommand(cmd, .write), - .embed => try self.runSingleCommand(cmd, .embed), - } + .RFlanger => blk: { + const pos = try cmd.consumePosition(); + try cmd.appendParam(¶ms, "delay_depth_avg"); + try cmd.appendParam(¶ms, "law_freq"); + try self.rFlangerCmd(pos, params); + }, + + .Eq => blk: { + const pos = try cmd.consumePosition(); + try cmd.appendParam(¶ms, "lo"); + try cmd.appendParam(¶ms, "mid"); + try cmd.appendParam(¶ms, "hi"); + + try self.eqCmd(pos, params); + }, + + .Phaser => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "lfo_rate"); + try cmd.appendParam(¶ms, "lfo_depth"); + try cmd.appendParam(¶ms, "fb"); + try cmd.appendParam(¶ms, "spread"); + + try self.phaserCmd(pos, params); + }, + + .Mbeq => blk: { + const pos = try cmd.consumePosition(); + const bands = try cmd.floatArgMany(self.allocator, 2, 15, f32(0)); + defer self.allocator.free(bands); + + try self.mbeqCmd(pos, bands); + }, + + .Chorus => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "voices"); + try cmd.appendParam(¶ms, "delay_base"); + try cmd.appendParam(¶ms, "voice_spread"); + try cmd.appendParam(¶ms, "detune"); + try cmd.appendParam(¶ms, "law_freq"); + try cmd.appendParam(¶ms, "attendb"); + + try self.chorusCmd(pos, params); + }, + + .PitchScaler => blk: { + const pos = try cmd.consumePosition(); + try cmd.appendParam(¶ms, "mult"); + try self.pitchScalerCmd(pos, params); + }, + + .Reverb => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "roomLength"); + try cmd.appendParam(¶ms, "roomWidth"); + try cmd.appendParam(¶ms, "roomHeight"); + try cmd.appendParam(¶ms, "sourceLR"); + try cmd.appendParam(¶ms, "sourceFB"); + try cmd.appendParam(¶ms, "listLR"); + try cmd.appendParam(¶ms, "listFB"); + try cmd.appendParam(¶ms, "hpf"); + try cmd.appendParam(¶ms, "warmth"); + try cmd.appendParam(¶ms, "diffusion"); + + try self.reverbCmd(pos, params); + }, + + .Highpass => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "freq"); + try cmd.appendParam(¶ms, "gain"); + try cmd.appendParam(¶ms, "noClip"); + + try self.highpassCmd(pos, params); + }, + + .Delay => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "seed"); + try cmd.appendParam(¶ms, "gain"); + try cmd.appendParam(¶ms, "feedback_pc"); + try cmd.appendParam(¶ms, "tap_count"); + try cmd.appendParam(¶ms, "first_delay"); + try cmd.appendParam(¶ms, "delay_range"); + try cmd.appendParam(¶ms, "delay_scale"); + try cmd.appendParam(¶ms, "delay_rand_pc"); + try cmd.appendParam(¶ms, "gain_scale"); + try cmd.appendParam(¶ms, "wet"); + + try self.delayCmd(pos, params); + }, + + .Vinyl => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "year"); + try cmd.appendParam(¶ms, "rpm"); + try cmd.appendParam(¶ms, "warp"); + try cmd.appendParam(¶ms, "click"); + try cmd.appendParam(¶ms, "wear"); + + try self.vinylCmd(pos, params); + }, + + .RevDelay => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "delay_time"); + try cmd.appendParam(¶ms, "dry_level"); + try cmd.appendParam(¶ms, "wet_level"); + try cmd.appendParam(¶ms, "feedback"); + try cmd.appendParam(¶ms, "xfade_samp"); + + try self.revDelayCmd(pos, params); + }, + + .Noise => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParamMap(&map, "seed"); + try cmd.appendParamMap(&map, "fill_bytes"); + + try self.noiseCmd(pos, &map); + }, + + .WildNoise => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParamMap(&map, "seed"); + try cmd.appendParamMap(&map, "fill_bytes"); + + try self.wildNoiseCmd(pos, &map); + }, + + .Write => blk: { + const pos = try cmd.consumePosition(); + try cmd.appendParamMap(&map, "data"); + try self.writeCmd(pos, &map); + }, + + .Rotate => blk: { + const deg = try cmd.floatArgAt(0); + const bgfill = try cmd.argAt(1); + try self.rotateCmd(deg, bgfill); + }, + + else => blk: { + std.debug.warn("Unsupported command: {}\n", cmd.command); + break :blk RunError.UnknownCommand; + }, + }; } + /// Run a list of commands. pub fn runCommands( self: *Runner, cmds: lang.CommandList, debug_flag: bool, ) !void { - _ = debug_flag; - for (cmds.list.items) |cmd| { - cmd.print(); + var it = cmds.iterator(); + + while (it.next()) |cmd| { + if (debug_flag) cmd.print(); try self.runCommand(cmd); } } }; test "running noop" { - const allocator = std.testing.allocator; + const allocator = std.heap.direct_allocator; var cmds = lang.CommandList.init(allocator); defer cmds.deinit(); - const command = lang.Command{ .tag = .noop }; + var cmd_ptr = try allocator.create(lang.Command); + cmd_ptr.* = lang.Command{ + .command = .Noop, + .args = lang.ArgList.init(allocator), + }; + try cmds.append(cmd_ptr); - var noop = try allocator.create(lang.Command.Noop); - noop.* = lang.Command.Noop{ .base = command }; - try cmds.append(&noop.base); - - var runner = Runner.init(allocator, false); + var runner = Runner.init(allocator); defer runner.deinit(); try runner.runCommands(cmds, false);