Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add basic antialiasing support * Remove cache * Update tests / add tests * Add antialiasing flag * fix: remove rewritePrefix (#30) Releases configured with `"esy.release.rewritePrefix": true` cannot be installed into deep filesystem locations (the limit is around 108 characters). * Clip antialiasing check to correct dimensions * feat: Return diffCount and diffPercentage in nodejs bindings (#32) * Implement parsing results output for node bindings * Update ts typings * Use pattern matching over union Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Better error message Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Better error handling * Add more tests and format package.json Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Bump version * Update ts * chore: Split code into multiple opam packages (#28) (#31) * Split into multiple opam files * generate packages with dune-project * set "use_standard_c_and_cxx_flags" to false * fix public name of bin * Add opam release github action * ci: checkout project sources before releasing * ci: fetch tags * Add synopsis * Setup user and token * Remove --dry-run * feat: Return diffCount and diffPercentage in nodejs bindings (#32) * Implement parsing results output for node bindings * Update ts typings * Use pattern matching over union Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Better error message Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Better error handling * Add more tests and format package.json Co-authored-by: Torben Ewert <Torben@eWert-Online.com> * Bump version * Update ts * Split into multiple opam files * generate packages with dune-project * set "use_standard_c_and_cxx_flags" to false * fix public name of bin * Add opam release github action * ci: checkout project sources before releasing * ci: fetch tags * Add synopsis * Setup user and token * Remove --dry-run * ci: Update token location * ci: try cloning opam repo * Delete release-opam.yml investigate automatic releases on a separate branch Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com> * Add basic antialiasing support * Remove cache * Update tests / add tests * Add antialiasing flag * Clip antialiasing check to correct dimensions * Fix tests * Make bigarray-first IO version * WIP: add comparing debuggers * Commit test file * Fix compilation * Implement flat bigarray based architecture for antialsing * Fix antialiasing with --diff-mask * More precise type checking for rowPointers fields * switch to 32bit bigarray Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com>
- Loading branch information
1 parent
77964ba
commit 31a1680
Showing
26 changed files
with
477 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
open Odiff.ImageIO; | ||
|
||
module IO: Odiff.ImageIO.ImageIO = { | ||
type rowPointers = int; | ||
type t = { | ||
rowPointers, | ||
bigarray: Bigarray.Array1.t(int32, Bigarray.int32_elt, Bigarray.c_layout), | ||
}; | ||
|
||
type row = int; | ||
let readDirectPixel = (~x: int, ~y: int, img) => { | ||
let pixel = (img.image.bigarray).{y * img.width + x} |> Int32.to_int; | ||
|
||
let a = pixel lsr 24 land 0xFF; | ||
let r = pixel lsr 16 land 0xFF; | ||
let g = pixel lsr 8 land 0xFF; | ||
let b = pixel land 0xFF; | ||
|
||
(r, g, b, a); | ||
}; | ||
|
||
let readRow = (img: Odiff.ImageIO.img(t), y): row => y; | ||
// row is always an int, so we can read pixel directly | ||
let readImgColor = (x, row: row, img: Odiff.ImageIO.img(t)) => | ||
readDirectPixel(~x, ~y=row, img); | ||
|
||
let setImgColor = (x, y, pixel, img: Odiff.ImageIO.img(t)) => { | ||
ReadPng.set_pixel_data(img.image.rowPointers, x, y, pixel); | ||
}; | ||
|
||
let loadImage = (filename): Odiff.ImageIO.img(t) => { | ||
let (width, height, rowbytes, rowPointers) = | ||
ReadPng.read_png_image(filename); | ||
|
||
let bigarray = | ||
ReadPng.row_pointers_to_bigarray(rowPointers, rowbytes, height, width); | ||
|
||
{ | ||
width, | ||
height, | ||
image: { | ||
bigarray, | ||
rowPointers, | ||
}, | ||
}; | ||
}; | ||
|
||
let saveImage = (img: Odiff.ImageIO.img(t), filename) => { | ||
ReadPng.write_png_file( | ||
img.image.rowPointers, | ||
img.width, | ||
img.height, | ||
filename, | ||
); | ||
}; | ||
|
||
let freeImage = (img: Odiff.ImageIO.img(t)) => { | ||
ReadPng.free_row_pointers(img.image.rowPointers, img.height); | ||
}; | ||
|
||
let makeSameAsLayout = (img: Odiff.ImageIO.img(t)) => { | ||
{ | ||
...img, | ||
image: { | ||
rowPointers: ReadPng.create_empty_img(img.height, img.width), | ||
bigarray: img.image.bigarray, | ||
}, | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.