├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ └── R-CMD-check.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS ├── R └── gifski.R ├── cleanup ├── cleanup.win ├── configure ├── configure.ucrt ├── gifski.Rproj ├── man └── gifski.Rd ├── readme.md ├── src ├── Makevars ├── Makevars.ucrt ├── Makevars.win ├── myrustlib │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── gifski.h │ ├── src │ │ └── lib.rs │ ├── vendor-authors.R │ ├── vendor-config.toml │ └── vendor-update.sh ├── old-1.4.3 │ ├── Cargo.lock │ └── Cargo.toml ├── old-1.6.6 │ ├── Cargo.lock │ └── Cargo.toml └── wrapper.c └── tools ├── rustarch.R └── winlibs.R /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^src/myrustlib/target 4 | ^src/myrustlib/vendor/ 5 | \.rs\.bk$ 6 | ^readme.md$ 7 | ^.travis.yml$ 8 | ^appveyor.yml$ 9 | \.png$ 10 | \.gif$ 11 | \.github$ 12 | ^src/.cargo 13 | ^\.github$ 14 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | pull_request: 6 | 7 | name: R-CMD-check 8 | 9 | jobs: 10 | R-CMD-check: 11 | runs-on: ${{ matrix.config.os }} 12 | 13 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.FORCE_STATIC_GIFSKI }} 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - {os: windows-latest, r: '4.1'} 20 | - {os: windows-latest, r: '4.1', FORCE_STATIC_GIFSKI: 'static'} 21 | - {os: windows-latest, r: '4.2', FORCE_STATIC_GIFSKI: 'static'} 22 | - {os: windows-latest, r: '4.3', FORCE_STATIC_GIFSKI: 'static'} 23 | - {os: windows-latest, r: 'release'} 24 | - {os: windows-latest, r: 'release', FORCE_STATIC_GIFSKI: 'static'} 25 | - {os: windows-latest, r: 'devel'} 26 | - {os: macOS-13, r: 'release'} 27 | - {os: macOS-14, r: 'release'} 28 | - {os: macOS-15, r: 'next'} 29 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 30 | - {os: ubuntu-24.04, r: 'release'} 31 | - {os: ubuntu-22.04, r: 'release'} 32 | 33 | env: 34 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 35 | R_KEEP_PKG_SOURCE: yes 36 | 37 | steps: 38 | - if: runner.os == 'linux' 39 | run: | 40 | rustup self uninstall -y 41 | sudo apt-get update -y 42 | sudo apt-get install -y cargo 43 | cargo --version 44 | rustc --version 45 | 46 | - uses: actions/checkout@v4 47 | 48 | - uses: r-lib/actions/setup-r@v2 49 | with: 50 | r-version: ${{ matrix.config.r }} 51 | http-user-agent: ${{ matrix.config.http-user-agent }} 52 | use-public-rspm: true 53 | 54 | - uses: r-lib/actions/setup-r-dependencies@v2 55 | with: 56 | extra-packages: any::rcmdcheck 57 | needs: check 58 | 59 | - uses: r-lib/actions/check-r-package@v2 60 | with: 61 | upload-results: true 62 | env: 63 | FORCE_STATIC_GIFSKI: ${{ matrix.config.FORCE_STATIC_GIFSKI }} 64 | MAKEFLAGS: -j4 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | src/*.o 5 | src/*.so 6 | src/*.dll 7 | src/*.a 8 | src/myrustlib/target/* 9 | *.png 10 | *.gif 11 | src/.cargo 12 | src/myrustlib/vendor.tar.xz 13 | src/myrustlib/vendor/* 14 | inst/AUTHORS 15 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: gifski 2 | Type: Package 3 | Title: Highest Quality GIF Encoder 4 | Version: 1.33.0 5 | Authors@R: c( 6 | person("Jeroen", "Ooms", ,"jeroenooms@gmail.com", role = c("aut", "cre"), 7 | comment = c(ORCID = "0000-0002-4035-0289")), 8 | person("Kornel Lesiński", role = "aut", comment = "Gifski Rust library"), 9 | person("Authors of the dependency Rust crates", role = "aut", 10 | comment = "see AUTHORS file")) 11 | Description: Multi-threaded GIF encoder written in Rust: . 12 | Converts images to GIF animations using pngquant's efficient cross-frame 13 | palettes and temporal dithering with thousands of colors per frame. 14 | License: MIT + file LICENSE 15 | URL: https://r-rust.r-universe.dev/gifski 16 | BugReports: https://github.com/r-rust/gifski/issues 17 | SystemRequirements: Cargo (Rust's package manager), rustc 18 | Encoding: UTF-8 19 | RoxygenNote: 7.1.1 20 | Suggests: 21 | ggplot2, 22 | gapminder 23 | Language: en-US 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2018 2 | COPYRIGHT HOLDER: Jeroen Ooms 3 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(gifski) 4 | export(save_gif) 5 | useDynLib(gifski,R_png_to_gif) 6 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 1.32.0-2 2 | - Fix parallel make; cleanup after build 3 | 4 | 1.32.0 5 | - Update embedded libgifski to upstream 1.32.0 6 | 7 | 1.12.2 8 | - Windows: support aarch64-pc-windows-gnullvm 9 | - Update embedded libgifski to upstream 1.12.2 10 | 11 | 1.12.0-2 12 | - Vendor rust code as requested by CRAN 13 | - CRAN request: use role="aut" for rust dependencies 14 | - CRAN request: use -j2 instead of CARGO_BUILD_JOBS=2 15 | 16 | 1.12.0-1 17 | - Windows: add -lntdll linker flag required by Rust 1.70 18 | 19 | 1.12.0 20 | - Update embedded libgifski to upstream 1.12.0 21 | - Windows: if Cargo is available, default to source build of libgifski 22 | 23 | 1.6.6-1 24 | - Fix for legacy Windows Vista/2008 (for the old winbuilder) 25 | 26 | 1.6.6 27 | - Update vendored gifski to upstream 1.6.6 28 | - Note gifski 1.6.6 requires at least Rust 1.56 / Windows 7. On older 29 | systems we fall back on the previous gifski 1.4.3 version. This 30 | includes the old CRAN winbuilder used for R < 4.2. 31 | 32 | 1.4.3-1: 33 | - Add libgifski ucrt64 binary 34 | 35 | 1.4.3 36 | - Major update in gifski rust library. This also required different 37 | threading implementation in the bindings. 38 | 39 | 0.8.7.1 40 | - Add workaround for compiling with old rustc compilers 41 | - Add workaround for linking error with experimental UCRT toolchain 42 | 43 | 0.8.7 44 | - CRAN insists that we override the standard cargo/rust behaviour which 45 | stores registry and crate data in ~/.cargo, because policy. So we now 46 | build with CARGO_HOME set to a temporary dir that is deleted afterwards. 47 | This probably makes this slower and more error prone, but I don't make 48 | these rules. 49 | 50 | 0.8.6 51 | - Update gifski crate to 0.8.6 52 | - save_gif() now properly closes graphics device when expr errors 53 | - More rubust C code to prevent segfaults on write errors 54 | - File paths are now converted to UTF-8 as described in gifski.h 55 | -------------------------------------------------------------------------------- /R/gifski.R: -------------------------------------------------------------------------------- 1 | #' Gifski 2 | #' 3 | #' Gifski converts image frames to high quality GIF animations. Either provide input 4 | #' png files, or automatically render animated graphics from the R graphics device. 5 | #' 6 | #' @export 7 | #' @rdname gifski 8 | #' @useDynLib gifski R_png_to_gif 9 | #' @param png_files vector of png files 10 | #' @param gif_file output gif file 11 | #' @param width gif width in pixels 12 | #' @param height gif height in pixel 13 | #' @param delay time to show each image in seconds 14 | #' @param loop if the gif should be repeated. Set to FALSE to only play 15 | #' once, or a number to indicate how many times to repeat after the first. 16 | #' @param progress print some verbose status output 17 | #' @examples 18 | #' # Manually convert png files to gif 19 | #' png_path <- file.path(tempdir(), "frame%03d.png") 20 | #' png(png_path) 21 | #' par(ask = FALSE) 22 | #' for(i in 1:10) 23 | #' plot(rnorm(i * 10), main = i) 24 | #' dev.off() 25 | #' png_files <- sprintf(png_path, 1:10) 26 | #' gif_file <- tempfile(fileext = ".gif") 27 | #' gifski(png_files, gif_file) 28 | #' unlink(png_files) 29 | #' \donttest{utils::browseURL(gif_file)} 30 | #' 31 | gifski <- function(png_files, gif_file = 'animation.gif', width = 800, height = 600, 32 | delay = 1, loop = TRUE, progress = TRUE){ 33 | png_files <- normalizePath(png_files, mustWork = TRUE) 34 | gif_file <- normalizePath(gif_file, mustWork = FALSE) 35 | if(!file.exists(dirname(gif_file))) 36 | stop("Target directory does not exist:", dirname(gif_file)) 37 | width <- as.integer(width) 38 | height <- as.integer(height) 39 | delay <- as.numeric(delay) 40 | repeats <- if(is.logical(loop) || loop == 0){ 41 | isTRUE(loop) - 1 # Set to negative to disable loop 42 | } else { 43 | as.integer(loop) 44 | } 45 | progress <- as.logical(progress) 46 | .Call(R_png_to_gif, enc2utf8(png_files), enc2utf8(gif_file), width, height, delay, repeats, progress) 47 | } 48 | 49 | #' @export 50 | #' @rdname gifski 51 | #' @param expr an R expression that creates graphics 52 | #' @param ... other graphical parameters passed to \link{png} 53 | #' @examples 54 | #' \donttest{ 55 | #' # Example borrowed from gganimate 56 | #' library(gapminder) 57 | #' library(ggplot2) 58 | #' makeplot <- function(){ 59 | #' datalist <- split(gapminder, gapminder$year) 60 | #' lapply(datalist, function(data){ 61 | #' p <- ggplot(data, aes(gdpPercap, lifeExp, size = pop, color = continent)) + 62 | #' scale_size("population", limits = range(gapminder$pop)) + geom_point() + ylim(20, 90) + 63 | #' scale_x_log10(limits = range(gapminder$gdpPercap)) + ggtitle(data$year) + theme_classic() 64 | #' print(p) 65 | #' }) 66 | #' } 67 | #' 68 | #' # High Definition images: 69 | #' gif_file <- file.path(tempdir(), 'gapminder.gif') 70 | #' save_gif(makeplot(), gif_file, 1280, 720, res = 144) 71 | #' utils::browseURL(gif_file)} 72 | save_gif <- function(expr, gif_file = 'animation.gif', width = 800, height = 600, delay = 1, 73 | loop = TRUE, progress = TRUE, ...){ 74 | imgdir <- tempfile('tmppng') 75 | dir.create(imgdir) 76 | on.exit(unlink(imgdir, recursive = TRUE)) 77 | filename <- file.path(imgdir, "tmpimg_%05d.png") 78 | grDevices::png(filename, width = width, height = height, ...) 79 | graphics::par(ask = FALSE) 80 | tryCatch(eval(expr), finally = grDevices::dev.off()) 81 | images <- list.files(imgdir, pattern = 'tmpimg_\\d{5}.png', full.names = TRUE) 82 | gifski(images, gif_file = gif_file, width = width, height = height, delay = delay, loop = loop, progress = progress) 83 | } 84 | -------------------------------------------------------------------------------- /cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PATH="$HOME/.cargo/bin:$PATH" 3 | cd src/myrustlib 4 | ./vendor-update.sh 5 | 6 | # Update ../inst/AUTHORS 7 | ${R_HOME}/bin/Rscript vendor-authors.R 8 | -------------------------------------------------------------------------------- /cleanup.win: -------------------------------------------------------------------------------- 1 | cleanup -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # mimics: source ~/.cargo/env 3 | export PATH="$HOME/.cargo/bin:$PATH" 4 | 5 | # On Debian, cargo and rustc are sometimes different 6 | VERSION=$(rustc --version) 7 | if [ $? -eq 0 ]; then 8 | echo "Using `which cargo`" 9 | echo "Rustc version: $VERSION" 10 | 11 | # Check for old version of rustc (edition:2021 requires rust 1.56) 12 | VERNUM=$(echo $VERSION | cut -d' ' -f2) || true 13 | MAJOR=$(echo $VERNUM | cut -d'.' -f1) || true 14 | MINOR=$(echo $VERNUM | cut -d'.' -f2) || true 15 | if [ "$MAJOR" -eq "1" ] && [ "$MINOR" -lt "56" ]; then 16 | echo "Found old rust. Using legacy gifski 1.4.3 build." 17 | rm -f src/myrustlib/vendor.tar.xz 18 | cp -f src/old-1.4.3/* src/myrustlib/ 19 | elif [ "$MAJOR" -eq "1" ] && [ "$MINOR" -lt "74" ]; then 20 | echo "Found old rust. Using legacy gifski 1.6.6 build." 21 | rm -f src/myrustlib/vendor.tar.xz 22 | cp -f src/old-1.6.6/* src/myrustlib/ 23 | ./cleanup || true 24 | fi 25 | exit 0 26 | fi 27 | 28 | # Try local version on MacOS, otherwise error 29 | echo "------------------ RUST COMPILER NOT FOUND --------------------" 30 | echo "" 31 | echo "Cargo was not found on the PATH. Please install cargo / rustc:" 32 | echo "" 33 | echo " - yum install cargo (Fedora/CentOS)" 34 | echo " - apt-get install cargo (Debian/Ubuntu)" 35 | echo " - brew install rust (MacOS)" 36 | echo "" 37 | echo "Alternatively install Rust from: " 38 | echo "" 39 | echo "---------------------------------------------------------------" 40 | echo "" 41 | exit 1 42 | -------------------------------------------------------------------------------- /configure.ucrt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PATH="$HOME/.cargo/bin:$PATH" 3 | CARGO=$(which cargo) 4 | if [ $? -eq 0 ] && [ -z "${FORCE_STATIC_GIFSKI}" ]; then 5 | echo "Building from source using ${CARGO} $(cargo --version)" 6 | rustc --version || true 7 | else 8 | rm -f src/Makevars.ucrt 9 | fi 10 | exit 0 11 | -------------------------------------------------------------------------------- /gifski.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: bddc0489-96c5-4eab-bfcd-73fb3dd26e8c 3 | 4 | RestoreWorkspace: Default 5 | SaveWorkspace: Default 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: Sweave 14 | LaTeX: pdfLaTeX 15 | 16 | AutoAppendNewline: Yes 17 | StripTrailingWhitespace: Yes 18 | 19 | BuildType: Package 20 | PackageUseDevtools: Yes 21 | PackageInstallArgs: --no-multiarch --with-keep.source 22 | -------------------------------------------------------------------------------- /man/gifski.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gifski.R 3 | \name{gifski} 4 | \alias{gifski} 5 | \alias{save_gif} 6 | \title{Gifski} 7 | \usage{ 8 | gifski( 9 | png_files, 10 | gif_file = "animation.gif", 11 | width = 800, 12 | height = 600, 13 | delay = 1, 14 | loop = TRUE, 15 | progress = TRUE 16 | ) 17 | 18 | save_gif( 19 | expr, 20 | gif_file = "animation.gif", 21 | width = 800, 22 | height = 600, 23 | delay = 1, 24 | loop = TRUE, 25 | progress = TRUE, 26 | ... 27 | ) 28 | } 29 | \arguments{ 30 | \item{png_files}{vector of png files} 31 | 32 | \item{gif_file}{output gif file} 33 | 34 | \item{width}{gif width in pixels} 35 | 36 | \item{height}{gif height in pixel} 37 | 38 | \item{delay}{time to show each image in seconds} 39 | 40 | \item{loop}{if the gif should be repeated. Set to FALSE to only play 41 | once, or a number to indicate how many times to repeat after the first.} 42 | 43 | \item{progress}{print some verbose status output} 44 | 45 | \item{expr}{an R expression that creates graphics} 46 | 47 | \item{...}{other graphical parameters passed to \link{png}} 48 | } 49 | \description{ 50 | Gifski converts image frames to high quality GIF animations. Either provide input 51 | png files, or automatically render animated graphics from the R graphics device. 52 | } 53 | \examples{ 54 | # Manually convert png files to gif 55 | png_path <- file.path(tempdir(), "frame\%03d.png") 56 | png(png_path) 57 | par(ask = FALSE) 58 | for(i in 1:10) 59 | plot(rnorm(i * 10), main = i) 60 | dev.off() 61 | png_files <- sprintf(png_path, 1:10) 62 | gif_file <- tempfile(fileext = ".gif") 63 | gifski(png_files, gif_file) 64 | unlink(png_files) 65 | \donttest{utils::browseURL(gif_file)} 66 | 67 | \donttest{ 68 | # Example borrowed from gganimate 69 | library(gapminder) 70 | library(ggplot2) 71 | makeplot <- function(){ 72 | datalist <- split(gapminder, gapminder$year) 73 | lapply(datalist, function(data){ 74 | p <- ggplot(data, aes(gdpPercap, lifeExp, size = pop, color = continent)) + 75 | scale_size("population", limits = range(gapminder$pop)) + geom_point() + ylim(20, 90) + 76 | scale_x_log10(limits = range(gapminder$gdpPercap)) + ggtitle(data$year) + theme_classic() 77 | print(p) 78 | }) 79 | } 80 | 81 | # High Definition images: 82 | gif_file <- file.path(tempdir(), 'gapminder.gif') 83 | save_gif(makeplot(), gif_file, 1280, 720, res = 144) 84 | utils::browseURL(gif_file)} 85 | } 86 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # gifski in R 2 | 3 | [![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/gifski)](http://cran.r-project.org/web/packages/gifski/index.html) 4 | 5 | 6 | > gifski converts video frames to GIF animations using pngquant's fancy features 7 | for efficient cross-frame palettes and temporal dithering. It produces animated GIFs that 8 | use thousands of colors per frame. 9 | 10 | This R package wraps the [gifski](https://crates.io/crates/gifski) cargo crate, see also the [website](https://gif.ski/). 11 | 12 | ## Examples 13 | 14 | Minimal example from the `?gifski` manual page. 15 | 16 | ```r 17 | png("frame%03d.png") 18 | par(ask = FALSE) 19 | for(i in 1:10) 20 | plot(rnorm(i * 10), main = i) 21 | dev.off() 22 | png_files <- sprintf("frame%03d.png", 1:10) 23 | gif_file <- gifski(png_files) 24 | unlink(png_files) 25 | utils::browseURL(gif_file) 26 | ``` 27 | 28 | ## Installation in R 29 | 30 | The [hellorust readme](https://github.com/r-rust/hellorust#installation) has instructions on how to setup rust on Windows, MacOS or Linux. After that you can just do: 31 | 32 | ```r 33 | devtools::install_github("r-rust/gifski") 34 | ``` 35 | -------------------------------------------------------------------------------- /src/Makevars: -------------------------------------------------------------------------------- 1 | LIBDIR = myrustlib/target/release 2 | STATLIB = $(LIBDIR)/libmyrustlib.a 3 | PKG_CFLAGS = -pthread $(C_VISIBILITY) 4 | PKG_LIBS = -L$(LIBDIR) -lmyrustlib 5 | 6 | all: $(SHLIB) cleanup 7 | 8 | $(SHLIB): $(STATLIB) 9 | 10 | # CRAN wants to avoid writing in $HOME 11 | export CARGO_HOME=$(PWD)/.cargo 12 | CRANFLAGS=-j 2 13 | 14 | $(STATLIB): 15 | if [ -f myrustlib/vendor.tar.xz ]; then tar xf myrustlib/vendor.tar.xz && mkdir -p $(CARGO_HOME) && cp myrustlib/vendor-config.toml $(CARGO_HOME)/config.toml; fi 16 | PATH="${PATH}:${HOME}/.cargo/bin" cargo build ${CRANFLAGS} --release --manifest-path=myrustlib/Cargo.toml 17 | rm -Rf $(CARGO_HOME) vendor || true 18 | rm -Rf $(LIBDIR)/build || true 19 | 20 | cleanup: $(SHLIB) 21 | rm -Rf $(STATLIB) myrustlib/target 22 | -------------------------------------------------------------------------------- /src/Makevars.ucrt: -------------------------------------------------------------------------------- 1 | TARGET = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript.exe" "../tools/rustarch.R") 2 | LIBDIR = myrustlib/target/$(TARGET)/release 3 | STATLIB = $(LIBDIR)/libmyrustlib.a 4 | PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lws2_32 -ladvapi32 -luserenv -ldbghelp -lbcrypt -lntdll 5 | 6 | all: $(SHLIB) cleanup 7 | 8 | $(SHLIB): $(STATLIB) 9 | 10 | $(STATLIB): 11 | @echo Building for $(TARGET) from vendor.tar.xz sources! 12 | if [ -f myrustlib/vendor.tar.xz ]; then tar xf myrustlib/vendor.tar.xz && mkdir -p .cargo && cp myrustlib/vendor-config.toml .cargo/config.toml; fi 13 | PATH="$(USERPROFILE)\\.cargo\\bin:$(PATH)" cargo build --target=$(TARGET) --release --manifest-path=myrustlib/Cargo.toml 14 | rm -Rf $(LIBDIR)/build 15 | 16 | cleanup: $(SHLIB) 17 | @rm -Rf $(STATLIB) myrustlib/target 18 | -------------------------------------------------------------------------------- /src/Makevars.win: -------------------------------------------------------------------------------- 1 | RWINLIB = ../windows/libgifski 2 | PKG_CPPFLAGS = -I$(RWINLIB)/include 3 | 4 | ifneq ($(R_COMPILED_BY),gcc 8.3.0) 5 | NTDLL=-lntdll 6 | endif 7 | 8 | PKG_LIBS = -L$(RWINLIB)/lib \ 9 | -L$(RWINLIB)/lib$(R_ARCH) \ 10 | -lgifski -lws2_32 -ladvapi32 -luserenv -ldbghelp -lbcrypt $(NTDLL) 11 | 12 | all: $(SHLIB) cleanup 13 | 14 | $(OBJECTS): winlibs 15 | 16 | winlibs: 17 | "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" 18 | 19 | cleanup: $(SHLIB) 20 | @rm -Rf $(RWINLIB) 21 | -------------------------------------------------------------------------------- /src/myrustlib/.gitignore: -------------------------------------------------------------------------------- 1 | x 2 | **/*.rs.bk 3 | Cargo.lock 4 | -------------------------------------------------------------------------------- /src/myrustlib/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "adler2" 7 | version = "2.0.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 10 | 11 | [[package]] 12 | name = "anstream" 13 | version = "0.6.15" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" 16 | dependencies = [ 17 | "anstyle", 18 | "anstyle-parse", 19 | "anstyle-query", 20 | "anstyle-wincon", 21 | "colorchoice", 22 | "is_terminal_polyfill", 23 | "utf8parse", 24 | ] 25 | 26 | [[package]] 27 | name = "anstyle" 28 | version = "1.0.8" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" 31 | 32 | [[package]] 33 | name = "anstyle-parse" 34 | version = "0.2.5" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" 37 | dependencies = [ 38 | "utf8parse", 39 | ] 40 | 41 | [[package]] 42 | name = "anstyle-query" 43 | version = "1.1.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" 46 | dependencies = [ 47 | "windows-sys", 48 | ] 49 | 50 | [[package]] 51 | name = "anstyle-wincon" 52 | version = "3.0.4" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" 55 | dependencies = [ 56 | "anstyle", 57 | "windows-sys", 58 | ] 59 | 60 | [[package]] 61 | name = "arrayvec" 62 | version = "0.7.6" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" 65 | 66 | [[package]] 67 | name = "autocfg" 68 | version = "1.4.0" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 71 | 72 | [[package]] 73 | name = "bytemuck" 74 | version = "1.18.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" 77 | 78 | [[package]] 79 | name = "cfg-if" 80 | version = "1.0.0" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 83 | 84 | [[package]] 85 | name = "clap" 86 | version = "4.5.40" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" 89 | dependencies = [ 90 | "clap_builder", 91 | ] 92 | 93 | [[package]] 94 | name = "clap_builder" 95 | version = "4.5.40" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" 98 | dependencies = [ 99 | "anstream", 100 | "anstyle", 101 | "clap_lex", 102 | "strsim", 103 | ] 104 | 105 | [[package]] 106 | name = "clap_lex" 107 | version = "0.7.5" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" 110 | 111 | [[package]] 112 | name = "colorchoice" 113 | version = "1.0.2" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 116 | 117 | [[package]] 118 | name = "crc32fast" 119 | version = "1.4.2" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" 122 | dependencies = [ 123 | "cfg-if", 124 | ] 125 | 126 | [[package]] 127 | name = "crossbeam-channel" 128 | version = "0.5.15" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" 131 | dependencies = [ 132 | "crossbeam-utils", 133 | ] 134 | 135 | [[package]] 136 | name = "crossbeam-deque" 137 | version = "0.8.5" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" 140 | dependencies = [ 141 | "crossbeam-epoch", 142 | "crossbeam-utils", 143 | ] 144 | 145 | [[package]] 146 | name = "crossbeam-epoch" 147 | version = "0.9.18" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" 150 | dependencies = [ 151 | "crossbeam-utils", 152 | ] 153 | 154 | [[package]] 155 | name = "crossbeam-utils" 156 | version = "0.8.21" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" 159 | 160 | [[package]] 161 | name = "dunce" 162 | version = "1.0.5" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" 165 | 166 | [[package]] 167 | name = "either" 168 | version = "1.13.0" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 171 | 172 | [[package]] 173 | name = "flate2" 174 | version = "1.0.34" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" 177 | dependencies = [ 178 | "crc32fast", 179 | "miniz_oxide", 180 | ] 181 | 182 | [[package]] 183 | name = "gif" 184 | version = "0.13.1" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" 187 | dependencies = [ 188 | "weezl", 189 | ] 190 | 191 | [[package]] 192 | name = "gif-dispose" 193 | version = "5.0.1" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | checksum = "5e1aa07391f3d9c279f388cea6faf291555dd891df59bed01d4378583df946ac" 196 | dependencies = [ 197 | "gif", 198 | "imgref", 199 | "rgb", 200 | ] 201 | 202 | [[package]] 203 | name = "gifski" 204 | version = "1.33.0" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "788d10fe905c7c1957186a33cb3010f228e4c7df0a47a3b6682fb73ec5e5be3e" 207 | dependencies = [ 208 | "clap", 209 | "crossbeam-channel", 210 | "crossbeam-utils", 211 | "dunce", 212 | "gif", 213 | "gif-dispose", 214 | "imagequant", 215 | "imgref", 216 | "lodepng", 217 | "loop9", 218 | "natord", 219 | "num-traits", 220 | "ordered-channel", 221 | "pbr", 222 | "quick-error", 223 | "resize", 224 | "rgb", 225 | "wild", 226 | "y4m", 227 | "yuv", 228 | ] 229 | 230 | [[package]] 231 | name = "glob" 232 | version = "0.3.1" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" 235 | 236 | [[package]] 237 | name = "imagequant" 238 | version = "4.3.4" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "1cede25dbe6a6c3842989fa341cba6e2a4dc33ba12a33f553baeed257f965cb5" 241 | dependencies = [ 242 | "arrayvec", 243 | "once_cell", 244 | "rayon", 245 | "rgb", 246 | "thread_local", 247 | ] 248 | 249 | [[package]] 250 | name = "imgref" 251 | version = "1.11.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" 254 | 255 | [[package]] 256 | name = "is_terminal_polyfill" 257 | version = "1.70.1" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 260 | 261 | [[package]] 262 | name = "libc" 263 | version = "0.2.159" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" 266 | 267 | [[package]] 268 | name = "lodepng" 269 | version = "3.11.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "a7720115060cd38dcfe5c758525a43fd34dc615d0566374212ff0dc3b6151eac" 272 | dependencies = [ 273 | "crc32fast", 274 | "flate2", 275 | "libc", 276 | "rgb", 277 | ] 278 | 279 | [[package]] 280 | name = "loop9" 281 | version = "0.1.5" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" 284 | dependencies = [ 285 | "imgref", 286 | ] 287 | 288 | [[package]] 289 | name = "miniz_oxide" 290 | version = "0.8.0" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" 293 | dependencies = [ 294 | "adler2", 295 | ] 296 | 297 | [[package]] 298 | name = "myrustlib" 299 | version = "0.1.0" 300 | dependencies = [ 301 | "gifski", 302 | ] 303 | 304 | [[package]] 305 | name = "natord" 306 | version = "1.0.9" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" 309 | 310 | [[package]] 311 | name = "num-traits" 312 | version = "0.2.19" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 315 | dependencies = [ 316 | "autocfg", 317 | ] 318 | 319 | [[package]] 320 | name = "once_cell" 321 | version = "1.20.1" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" 324 | dependencies = [ 325 | "portable-atomic", 326 | ] 327 | 328 | [[package]] 329 | name = "ordered-channel" 330 | version = "1.2.0" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "95be4d57809897b5a7539fc15a7dfe0e84141bc3dfaa2e9b1b27caa90acf61ab" 333 | dependencies = [ 334 | "crossbeam-channel", 335 | ] 336 | 337 | [[package]] 338 | name = "pbr" 339 | version = "1.1.1" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "ed5827dfa0d69b6c92493d6c38e633bbaa5937c153d0d7c28bf12313f8c6d514" 342 | dependencies = [ 343 | "crossbeam-channel", 344 | "libc", 345 | "winapi", 346 | ] 347 | 348 | [[package]] 349 | name = "portable-atomic" 350 | version = "1.9.0" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" 353 | 354 | [[package]] 355 | name = "quick-error" 356 | version = "2.0.1" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" 359 | 360 | [[package]] 361 | name = "rayon" 362 | version = "1.10.0" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" 365 | dependencies = [ 366 | "either", 367 | "rayon-core", 368 | ] 369 | 370 | [[package]] 371 | name = "rayon-core" 372 | version = "1.12.1" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" 375 | dependencies = [ 376 | "crossbeam-deque", 377 | "crossbeam-utils", 378 | ] 379 | 380 | [[package]] 381 | name = "resize" 382 | version = "0.8.8" 383 | source = "registry+https://github.com/rust-lang/crates.io-index" 384 | checksum = "87a103d0b47e783f4579149402f7499397ab25540c7a57b2f70487a5d2d20ef0" 385 | dependencies = [ 386 | "rayon", 387 | "rgb", 388 | ] 389 | 390 | [[package]] 391 | name = "rgb" 392 | version = "0.8.50" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" 395 | dependencies = [ 396 | "bytemuck", 397 | ] 398 | 399 | [[package]] 400 | name = "strsim" 401 | version = "0.11.1" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 404 | 405 | [[package]] 406 | name = "thread_local" 407 | version = "1.1.8" 408 | source = "registry+https://github.com/rust-lang/crates.io-index" 409 | checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" 410 | dependencies = [ 411 | "cfg-if", 412 | "once_cell", 413 | ] 414 | 415 | [[package]] 416 | name = "utf8parse" 417 | version = "0.2.2" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 420 | 421 | [[package]] 422 | name = "weezl" 423 | version = "0.1.8" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" 426 | 427 | [[package]] 428 | name = "wild" 429 | version = "2.2.1" 430 | source = "registry+https://github.com/rust-lang/crates.io-index" 431 | checksum = "a3131afc8c575281e1e80f36ed6a092aa502c08b18ed7524e86fbbb12bb410e1" 432 | dependencies = [ 433 | "glob", 434 | ] 435 | 436 | [[package]] 437 | name = "winapi" 438 | version = "0.3.9" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 441 | dependencies = [ 442 | "winapi-i686-pc-windows-gnu", 443 | "winapi-x86_64-pc-windows-gnu", 444 | ] 445 | 446 | [[package]] 447 | name = "winapi-i686-pc-windows-gnu" 448 | version = "0.4.0" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 451 | 452 | [[package]] 453 | name = "winapi-x86_64-pc-windows-gnu" 454 | version = "0.4.0" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 457 | 458 | [[package]] 459 | name = "windows-sys" 460 | version = "0.52.0" 461 | source = "registry+https://github.com/rust-lang/crates.io-index" 462 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 463 | dependencies = [ 464 | "windows-targets", 465 | ] 466 | 467 | [[package]] 468 | name = "windows-targets" 469 | version = "0.52.6" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 472 | dependencies = [ 473 | "windows_aarch64_gnullvm", 474 | "windows_aarch64_msvc", 475 | "windows_i686_gnu", 476 | "windows_i686_gnullvm", 477 | "windows_i686_msvc", 478 | "windows_x86_64_gnu", 479 | "windows_x86_64_gnullvm", 480 | "windows_x86_64_msvc", 481 | ] 482 | 483 | [[package]] 484 | name = "windows_aarch64_gnullvm" 485 | version = "0.52.6" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 488 | 489 | [[package]] 490 | name = "windows_aarch64_msvc" 491 | version = "0.52.6" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 494 | 495 | [[package]] 496 | name = "windows_i686_gnu" 497 | version = "0.52.6" 498 | source = "registry+https://github.com/rust-lang/crates.io-index" 499 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 500 | 501 | [[package]] 502 | name = "windows_i686_gnullvm" 503 | version = "0.52.6" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 506 | 507 | [[package]] 508 | name = "windows_i686_msvc" 509 | version = "0.52.6" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 512 | 513 | [[package]] 514 | name = "windows_x86_64_gnu" 515 | version = "0.52.6" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 518 | 519 | [[package]] 520 | name = "windows_x86_64_gnullvm" 521 | version = "0.52.6" 522 | source = "registry+https://github.com/rust-lang/crates.io-index" 523 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 524 | 525 | [[package]] 526 | name = "windows_x86_64_msvc" 527 | version = "0.52.6" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 530 | 531 | [[package]] 532 | name = "y4m" 533 | version = "0.8.0" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" 536 | 537 | [[package]] 538 | name = "yuv" 539 | version = "0.1.9" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "8cbe2d856acbe6d86c0fa6f458b73e962834061ca2f7f94c6e4633afc9efd4d4" 542 | dependencies = [ 543 | "num-traits", 544 | "rgb", 545 | ] 546 | -------------------------------------------------------------------------------- /src/myrustlib/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "myrustlib" 3 | version = "0.1.0" 4 | authors = ["Jeroen "] 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["staticlib"] 9 | 10 | [dependencies] 11 | gifski = "1.33.0" 12 | -------------------------------------------------------------------------------- /src/myrustlib/gifski.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | struct gifski; 12 | typedef struct gifski gifski; 13 | 14 | /** 15 | How to use from C 16 | 17 | ```c 18 | gifski *g = gifski_new(&(GifskiSettings){ 19 | .quality = 90, 20 | }); 21 | gifski_set_file_output(g, "file.gif"); 22 | 23 | for(int i=0; i < frames; i++) { 24 | int res = gifski_add_frame_rgba(g, i, width, height, buffer, 5); 25 | if (res != GIFSKI_OK) break; 26 | } 27 | int res = gifski_finish(g); 28 | if (res != GIFSKI_OK) return; 29 | ``` 30 | 31 | It's safe and efficient to call `gifski_add_frame_*` in a loop as fast as you can get frames, 32 | because it blocks and waits until previous frames are written. 33 | 34 | To cancel processing, make progress callback return 0 and call `gifski_finish()`. The write callback 35 | may still be called between the cancellation and `gifski_finish()` returning. 36 | 37 | To build as a library: 38 | 39 | ```bash 40 | cargo build --release --lib 41 | ``` 42 | 43 | it will create `target/release/libgifski.a` (static library) 44 | and `target/release/libgifski.so`/`dylib` or `gifski.dll` (dynamic library) 45 | 46 | Static is recommended. 47 | 48 | To build for iOS: 49 | 50 | ```bash 51 | rustup target add aarch64-apple-ios 52 | cargo build --release --lib --target aarch64-apple-ios 53 | ``` 54 | 55 | it will build `target/aarch64-apple-ios/release/libgifski.a` (ignore the warning about cdylib). 56 | 57 | */ 58 | 59 | /** 60 | * Settings for creating a new encoder instance. See `gifski_new` 61 | */ 62 | typedef struct GifskiSettings { 63 | /** 64 | * Resize to max this width if non-0. 65 | */ 66 | uint32_t width; 67 | /** 68 | * Resize to max this height if width is non-0. Note that aspect ratio is not preserved. 69 | */ 70 | uint32_t height; 71 | /** 72 | * 1-100, but useful range is 50-100. Recommended to set to 90. 73 | */ 74 | uint8_t quality; 75 | /** 76 | * Lower quality, but faster encode. 77 | */ 78 | bool fast; 79 | /** 80 | * If negative, looping is disabled. The number of times the sequence is repeated. 0 to loop forever. 81 | */ 82 | int16_t repeat; 83 | } GifskiSettings; 84 | 85 | enum GifskiError { 86 | GIFSKI_OK = 0, 87 | /** one of input arguments was NULL */ 88 | GIFSKI_NULL_ARG, 89 | /** a one-time function was called twice, or functions were called in wrong order */ 90 | GIFSKI_INVALID_STATE, 91 | /** internal error related to palette quantization */ 92 | GIFSKI_QUANT, 93 | /** internal error related to gif composing */ 94 | GIFSKI_GIF, 95 | /** internal error - unexpectedly aborted */ 96 | GIFSKI_THREAD_LOST, 97 | /** I/O error: file or directory not found */ 98 | GIFSKI_NOT_FOUND, 99 | /** I/O error: permission denied */ 100 | GIFSKI_PERMISSION_DENIED, 101 | /** I/O error: file already exists */ 102 | GIFSKI_ALREADY_EXISTS, 103 | /** invalid arguments passed to function */ 104 | GIFSKI_INVALID_INPUT, 105 | /** misc I/O error */ 106 | GIFSKI_TIMED_OUT, 107 | /** misc I/O error */ 108 | GIFSKI_WRITE_ZERO, 109 | /** misc I/O error */ 110 | GIFSKI_INTERRUPTED, 111 | /** misc I/O error */ 112 | GIFSKI_UNEXPECTED_EOF, 113 | /** progress callback returned 0, writing aborted */ 114 | GIFSKI_ABORTED, 115 | /** should not happen, file a bug */ 116 | GIFSKI_OTHER, 117 | }; 118 | 119 | /* workaround for a wrong definition in an older version of this header. Please use GIFSKI_ABORTED directly */ 120 | #ifndef ABORTED 121 | #define ABORTED GIFSKI_ABORTED 122 | #endif 123 | 124 | typedef enum GifskiError GifskiError; 125 | 126 | /** 127 | * Call to start the process 128 | * 129 | * See `gifski_add_frame_png_file` and `gifski_end_adding_frames` 130 | * 131 | * Returns a handle for the other functions, or `NULL` on error (if the settings are invalid). 132 | */ 133 | gifski *gifski_new(const GifskiSettings *settings); 134 | 135 | 136 | /** Quality 1-100 of temporal denoising. Lower values reduce motion. Defaults to `settings.quality`. 137 | * 138 | * Only valid immediately after calling `gifski_new`, before any frames are added. */ 139 | GifskiError gifski_set_motion_quality(gifski *handle, uint8_t quality); 140 | 141 | /** Quality 1-100 of gifsicle compression. Lower values add noise. Defaults to `settings.quality`. 142 | * Has no effect if the `gifsicle` feature hasn't been enabled. 143 | * Only valid immediately after calling `gifski_new`, before any frames are added. */ 144 | GifskiError gifski_set_lossy_quality(gifski *handle, uint8_t quality); 145 | 146 | /** If `true`, encoding will be significantly slower, but may look a bit better. 147 | * 148 | * Only valid immediately after calling `gifski_new`, before any frames are added. */ 149 | GifskiError gifski_set_extra_effort(gifski *handle, bool extra); 150 | 151 | /** 152 | * Adds a frame to the animation. This function is asynchronous. 153 | * 154 | * File path must be valid UTF-8. 155 | * 156 | * `frame_number` orders frames (consecutive numbers starting from 0). 157 | * You can add frames in any order, and they will be sorted by their `frame_number`. 158 | * 159 | * Presentation timestamp (PTS) is time in seconds, since start of the file, when this frame is to be displayed. 160 | * For a 20fps video it could be `frame_number/20.0`. 161 | * Frames with duplicate or out-of-order PTS will be skipped. 162 | * 163 | * The first frame should have PTS=0. If the first frame has PTS > 0, it'll be used as a delay after the last frame. 164 | * 165 | * This function may block and wait until the frame is processed. Make sure to call `gifski_set_write_callback` or `gifski_set_file_output` first to avoid a deadlock. 166 | * 167 | * Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error. 168 | */ 169 | GifskiError gifski_add_frame_png_file(gifski *handle, 170 | uint32_t frame_number, 171 | const char *file_path, 172 | double presentation_timestamp); 173 | 174 | /** 175 | * Adds a frame to the animation. This function is asynchronous. 176 | * 177 | * `pixels` is an array width×height×4 bytes large. 178 | * The array is copied, so you can free/reuse it immediately after this function returns. 179 | * 180 | * `frame_number` orders frames (consecutive numbers starting from 0). 181 | * You can add frames in any order, and they will be sorted by their `frame_number`. 182 | * However, out-of-order frames are buffered in RAM, and will cause high memory usage 183 | * if there are gaps in the frame numbers. 184 | * 185 | * Presentation timestamp (PTS) is time in seconds, since start of the file, when this frame is to be displayed. 186 | * For a 20fps video it could be `frame_number/20.0`. First frame must have PTS=0. 187 | * Frames with duplicate or out-of-order PTS will be skipped. 188 | * 189 | * The first frame should have PTS=0. If the first frame has PTS > 0, it'll be used as a delay after the last frame. 190 | * 191 | * Colors are in sRGB, uncorrelated RGBA, with alpha byte last. 192 | * 193 | * This function may block and wait until the frame is processed. Make sure to call `gifski_set_write_callback` or `gifski_set_file_output` first to avoid a deadlock. 194 | * 195 | * Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error. 196 | */ 197 | GifskiError gifski_add_frame_rgba(gifski *handle, 198 | uint32_t frame_number, 199 | uint32_t width, 200 | uint32_t height, 201 | const unsigned char *pixels, 202 | double presentation_timestamp); 203 | 204 | /** Same as `gifski_add_frame_rgba`, but with bytes per row arg */ 205 | GifskiError gifski_add_frame_rgba_stride(gifski *handle, 206 | uint32_t frame_number, 207 | uint32_t width, 208 | uint32_t height, 209 | uint32_t bytes_per_row, 210 | const unsigned char *pixels, 211 | double presentation_timestamp); 212 | 213 | /** Same as `gifski_add_frame_rgba_stride`, except it expects components in ARGB order. 214 | 215 | Bytes per row must be multiple of 4, and greater or equal width×4. 216 | If the bytes per row value is invalid (e.g. an odd number), frames may look sheared/skewed. 217 | 218 | Colors are in sRGB, uncorrelated ARGB, with alpha byte first. 219 | 220 | `gifski_add_frame_rgba` is preferred over this function. 221 | */ 222 | GifskiError gifski_add_frame_argb(gifski *handle, 223 | uint32_t frame_number, 224 | uint32_t width, 225 | uint32_t bytes_per_row, 226 | uint32_t height, 227 | const unsigned char *pixels, 228 | double presentation_timestamp); 229 | 230 | /** Same as `gifski_add_frame_rgba_stride`, except it expects RGB components (3 bytes per pixel) 231 | 232 | Bytes per row must be multiple of 3, and greater or equal width×3. 233 | If the bytes per row value is invalid (not multiple of 3), frames may look sheared/skewed. 234 | 235 | Colors are in sRGB, red byte first. 236 | 237 | `gifski_add_frame_rgba` is preferred over this function. 238 | */ 239 | GifskiError gifski_add_frame_rgb(gifski *handle, 240 | uint32_t frame_number, 241 | uint32_t width, 242 | uint32_t bytes_per_row, 243 | uint32_t height, 244 | const unsigned char *pixels, 245 | double presentation_timestamp); 246 | 247 | /** 248 | * Get a callback for frame processed, and abort processing if desired. 249 | * 250 | * The callback is called once per input frame, 251 | * even if the encoder decides to skip some frames. 252 | * 253 | * It gets arbitrary pointer (`user_data`) as an argument. `user_data` can be `NULL`. 254 | * 255 | * The callback must return `1` to continue processing, or `0` to abort. 256 | * 257 | * The callback must be thread-safe (it will be called from another thread). 258 | * It must remain valid at all times, until `gifski_finish` completes. 259 | * 260 | * This function must be called before `gifski_set_file_output()` to take effect. 261 | */ 262 | void gifski_set_progress_callback(gifski *handle, int (*progress_callback)(void *user_data), void *user_data); 263 | 264 | /** 265 | * Get a callback when an error occurs. 266 | * This is intended mostly for logging and debugging, not for user interface. 267 | * 268 | * The callback function has the following arguments: 269 | * * A `\0`-terminated C string in UTF-8 encoding. The string is only valid for the duration of the call. Make a copy if you need to keep it. 270 | * * An arbitrary pointer (`user_data`). `user_data` can be `NULL`. 271 | * 272 | * The callback must be thread-safe (it will be called from another thread). 273 | * It must remain valid at all times, until `gifski_finish` completes. 274 | * 275 | * If the callback is not set, errors will be printed to stderr. 276 | * 277 | * This function must be called before `gifski_set_file_output()` to take effect. 278 | */ 279 | GifskiError gifski_set_error_message_callback(gifski *handle, void (*error_message_callback)(const char*, void*), void *user_data); 280 | 281 | /** 282 | * Start writing to the file at `destination_path` (overwrites if needed). 283 | * The file path must be ASCII or valid UTF-8. 284 | * 285 | * This function has to be called before any frames are added. 286 | * This call will not block. 287 | * 288 | * Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error. 289 | */ 290 | GifskiError gifski_set_file_output(gifski *handle, const char *destination_path); 291 | 292 | /** 293 | * Start writing via callback (any buffer, file, whatever you want). This has to be called before any frames are added. 294 | * This call will not block. 295 | * 296 | * The callback function receives 3 arguments: 297 | * - size of the buffer to write, in bytes. IT MAY BE ZERO (when it's zero, either do nothing, or flush internal buffers if necessary). 298 | * - pointer to the buffer. 299 | * - context pointer to arbitrary user data, same as passed in to this function. 300 | * 301 | * The callback should return 0 (`GIFSKI_OK`) on success, and non-zero on error. 302 | * 303 | * The callback function must be thread-safe. It must remain valid at all times, until `gifski_finish` completes. 304 | * 305 | * Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error. 306 | */ 307 | GifskiError gifski_set_write_callback(gifski *handle, 308 | int (*write_callback)(size_t buffer_length, const uint8_t *buffer, void *user_data), 309 | void *user_data); 310 | 311 | /** 312 | * The last step: 313 | * - stops accepting any more frames (gifski_add_frame_* calls are blocked) 314 | * - blocks and waits until all already-added frames have finished writing 315 | * 316 | * Returns final status of write operations. Remember to check the return value! 317 | * 318 | * Must always be called, otherwise it will leak memory. 319 | * After this call, the handle is freed and can't be used any more. 320 | * 321 | * Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error. 322 | */ 323 | GifskiError gifski_finish(gifski *g); 324 | 325 | #ifdef __cplusplus 326 | } 327 | #endif 328 | -------------------------------------------------------------------------------- /src/myrustlib/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Import dependencies 2 | extern crate gifski; 3 | -------------------------------------------------------------------------------- /src/myrustlib/vendor-authors.R: -------------------------------------------------------------------------------- 1 | if(!require('jsonlite')) install.packages('jsonlite', repos = 'https://cloud.r-project.org') 2 | metadata <- jsonlite::fromJSON(pipe("cargo metadata --format-version 1")) 3 | packages <- metadata$packages 4 | stopifnot(is.data.frame(packages)) 5 | packages <- subset(packages, sapply(packages$authors, length) > 0 & name != 'myrustlib') 6 | authors <- vapply(packages$authors, function(x) paste(sub(" <.*>", "", x), collapse = ', '), character(1)) 7 | lines <- sprintf(" - %s %s: %s", packages$name, packages$version, authors) 8 | dir.create('../../inst', showWarnings = FALSE) 9 | footer <- sprintf("\n(This file was auto-generated from 'cargo metadata' on %s)", Sys.Date()) 10 | writeLines(c('Authors of vendored cargo crates', lines, footer), '../../inst/AUTHORS') 11 | -------------------------------------------------------------------------------- /src/myrustlib/vendor-config.toml: -------------------------------------------------------------------------------- 1 | [source.crates-io] 2 | replace-with = "vendored-sources" 3 | 4 | [source.vendored-sources] 5 | directory = "vendor" 6 | 7 | -------------------------------------------------------------------------------- /src/myrustlib/vendor-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -Rf vendor vendor.tar.xz 3 | cargo vendor 4 | rm -Rf vendor/windows_x86_64_gnullvm/lib/* vendor/windows_*_msvc/lib/* vendor/windows_i686*/lib/* vendor/winapi-i686-pc-windows-gnu/lib/* 5 | XZ_OPT=-9 tar -cJ --no-xattrs -f vendor.tar.xz vendor 6 | rm -Rf vendor 7 | -------------------------------------------------------------------------------- /src/old-1.4.3/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "adler" 5 | version = "1.0.2" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 8 | 9 | [[package]] 10 | name = "ahash" 11 | version = "0.4.7" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" 14 | 15 | [[package]] 16 | name = "ansi_term" 17 | version = "0.11.0" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 20 | dependencies = [ 21 | "winapi", 22 | ] 23 | 24 | [[package]] 25 | name = "atty" 26 | version = "0.2.14" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 29 | dependencies = [ 30 | "hermit-abi", 31 | "libc", 32 | "winapi", 33 | ] 34 | 35 | [[package]] 36 | name = "autocfg" 37 | version = "1.0.1" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 40 | 41 | [[package]] 42 | name = "bitflags" 43 | version = "1.2.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 46 | 47 | [[package]] 48 | name = "bytemuck" 49 | version = "1.5.1" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58" 52 | 53 | [[package]] 54 | name = "cc" 55 | version = "1.0.67" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" 58 | 59 | [[package]] 60 | name = "cfg-if" 61 | version = "1.0.0" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 64 | 65 | [[package]] 66 | name = "clap" 67 | version = "2.33.3" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" 70 | dependencies = [ 71 | "ansi_term", 72 | "atty", 73 | "bitflags", 74 | "strsim", 75 | "textwrap", 76 | "unicode-width", 77 | "vec_map", 78 | ] 79 | 80 | [[package]] 81 | name = "color_quant" 82 | version = "1.1.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" 85 | 86 | [[package]] 87 | name = "crc32fast" 88 | version = "1.2.1" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" 91 | dependencies = [ 92 | "cfg-if", 93 | ] 94 | 95 | [[package]] 96 | name = "crossbeam-channel" 97 | version = "0.5.0" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" 100 | dependencies = [ 101 | "cfg-if", 102 | "crossbeam-utils", 103 | ] 104 | 105 | [[package]] 106 | name = "crossbeam-utils" 107 | version = "0.8.3" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" 110 | dependencies = [ 111 | "autocfg", 112 | "cfg-if", 113 | "lazy_static", 114 | ] 115 | 116 | [[package]] 117 | name = "dunce" 118 | version = "1.0.1" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" 121 | 122 | [[package]] 123 | name = "fallible_collections" 124 | version = "0.4.0" 125 | source = "registry+https://github.com/rust-lang/crates.io-index" 126 | checksum = "74bebf0efe2e883c1619c455e3f1764333064694ebd5125d2faddabfb5963186" 127 | dependencies = [ 128 | "hashbrown", 129 | ] 130 | 131 | [[package]] 132 | name = "flate2" 133 | version = "1.0.20" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" 136 | dependencies = [ 137 | "cfg-if", 138 | "crc32fast", 139 | "libc", 140 | "miniz_oxide", 141 | ] 142 | 143 | [[package]] 144 | name = "gif" 145 | version = "0.11.1" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "02efba560f227847cb41463a7395c514d127d4f74fff12ef0137fff1b84b96c4" 148 | dependencies = [ 149 | "color_quant", 150 | "weezl", 151 | ] 152 | 153 | [[package]] 154 | name = "gif-dispose" 155 | version = "3.1.1" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "243e0347e8f4384181cb12069d87b9dae021c41bdaada7bd0d6743ad6d95c1d7" 158 | dependencies = [ 159 | "gif", 160 | "imgref", 161 | "rgb", 162 | ] 163 | 164 | [[package]] 165 | name = "gifsicle" 166 | version = "1.92.5" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "36998a2316aad26c8bfd74c82a8809eaf12e2216a2938bc4dca5b83c59fb3e1a" 169 | dependencies = [ 170 | "cc", 171 | "libc", 172 | ] 173 | 174 | [[package]] 175 | name = "gifski" 176 | version = "1.4.3" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "7dffc8e619ce2f090feee34707cd33712b483c54736ce1930173e2fc9f349242" 179 | dependencies = [ 180 | "clap", 181 | "crossbeam-channel", 182 | "dunce", 183 | "gif", 184 | "gif-dispose", 185 | "gifsicle", 186 | "imagequant", 187 | "imgref", 188 | "lodepng", 189 | "natord", 190 | "pbr", 191 | "quick-error", 192 | "resize", 193 | "rgb", 194 | "wild", 195 | ] 196 | 197 | [[package]] 198 | name = "glob" 199 | version = "0.3.0" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 202 | 203 | [[package]] 204 | name = "hashbrown" 205 | version = "0.9.1" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" 208 | dependencies = [ 209 | "ahash", 210 | ] 211 | 212 | [[package]] 213 | name = "hermit-abi" 214 | version = "0.1.18" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" 217 | dependencies = [ 218 | "libc", 219 | ] 220 | 221 | [[package]] 222 | name = "imagequant" 223 | version = "3.0.4-alpha.2" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "52a4992e3d9f6250423b861d2b776028f1567f9ca61a27f86764bdaea65b6631" 226 | dependencies = [ 227 | "imagequant-sys", 228 | "libc", 229 | "rgb", 230 | ] 231 | 232 | [[package]] 233 | name = "imagequant-sys" 234 | version = "3.0.4-alpha.2" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | checksum = "f6c097d19a41f2f4053638e8fd7f35a19359ad1a8dfc1ac7d2391615a8c104d8" 237 | dependencies = [ 238 | "bitflags", 239 | "cc", 240 | "rgb", 241 | ] 242 | 243 | [[package]] 244 | name = "imgref" 245 | version = "1.8.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "13d8ff3fccb226c37a60bcc4937d0254a21cab3451b84d432117ceb01c41054a" 248 | 249 | [[package]] 250 | name = "lazy_static" 251 | version = "1.4.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 254 | 255 | [[package]] 256 | name = "libc" 257 | version = "0.2.90" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" 260 | 261 | [[package]] 262 | name = "lodepng" 263 | version = "3.4.5" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "c60778a2380faaea48875fd8d007bae8aea7786c47dd7a455c1c813c3a4c36d7" 266 | dependencies = [ 267 | "fallible_collections", 268 | "flate2", 269 | "libc", 270 | "rgb", 271 | ] 272 | 273 | [[package]] 274 | name = "miniz_oxide" 275 | version = "0.4.4" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" 278 | dependencies = [ 279 | "adler", 280 | "autocfg", 281 | ] 282 | 283 | [[package]] 284 | name = "myrustlib" 285 | version = "0.1.0" 286 | dependencies = [ 287 | "gifski", 288 | ] 289 | 290 | [[package]] 291 | name = "natord" 292 | version = "1.0.9" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" 295 | 296 | [[package]] 297 | name = "pbr" 298 | version = "1.0.4" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "ff5751d87f7c00ae6403eb1fcbba229b9c76c9a30de8c1cf87182177b168cea2" 301 | dependencies = [ 302 | "crossbeam-channel", 303 | "libc", 304 | "time", 305 | "winapi", 306 | ] 307 | 308 | [[package]] 309 | name = "quick-error" 310 | version = "2.0.0" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" 313 | 314 | [[package]] 315 | name = "resize" 316 | version = "0.7.2" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "a2a32135a3cd4df690ee74dc0e1a77ffe2cdd4611b4e58b84df26a856d92b4ef" 319 | dependencies = [ 320 | "fallible_collections", 321 | "rgb", 322 | ] 323 | 324 | [[package]] 325 | name = "rgb" 326 | version = "0.8.25" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3" 329 | dependencies = [ 330 | "bytemuck", 331 | ] 332 | 333 | [[package]] 334 | name = "strsim" 335 | version = "0.8.0" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 338 | 339 | [[package]] 340 | name = "textwrap" 341 | version = "0.11.0" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 344 | dependencies = [ 345 | "unicode-width", 346 | ] 347 | 348 | [[package]] 349 | name = "time" 350 | version = "0.1.44" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 353 | dependencies = [ 354 | "libc", 355 | "wasi", 356 | "winapi", 357 | ] 358 | 359 | [[package]] 360 | name = "unicode-width" 361 | version = "0.1.8" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" 364 | 365 | [[package]] 366 | name = "vec_map" 367 | version = "0.8.2" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 370 | 371 | [[package]] 372 | name = "wasi" 373 | version = "0.10.0+wasi-snapshot-preview1" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 376 | 377 | [[package]] 378 | name = "weezl" 379 | version = "0.1.4" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "4a32b378380f4e9869b22f0b5177c68a5519f03b3454fde0b291455ddbae266c" 382 | 383 | [[package]] 384 | name = "wild" 385 | version = "2.0.4" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" 388 | dependencies = [ 389 | "glob", 390 | ] 391 | 392 | [[package]] 393 | name = "winapi" 394 | version = "0.3.9" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 397 | dependencies = [ 398 | "winapi-i686-pc-windows-gnu", 399 | "winapi-x86_64-pc-windows-gnu", 400 | ] 401 | 402 | [[package]] 403 | name = "winapi-i686-pc-windows-gnu" 404 | version = "0.4.0" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 407 | 408 | [[package]] 409 | name = "winapi-x86_64-pc-windows-gnu" 410 | version = "0.4.0" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 413 | -------------------------------------------------------------------------------- /src/old-1.4.3/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "myrustlib" 3 | version = "0.1.0" 4 | authors = ["Jeroen "] 5 | 6 | [lib] 7 | crate-type = ["staticlib"] 8 | 9 | [dependencies] 10 | gifski = "1.4.3" 11 | -------------------------------------------------------------------------------- /src/old-1.6.6/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.7.6" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 16 | dependencies = [ 17 | "getrandom", 18 | "once_cell", 19 | "version_check", 20 | ] 21 | 22 | [[package]] 23 | name = "arrayvec" 24 | version = "0.7.2" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" 27 | 28 | [[package]] 29 | name = "atty" 30 | version = "0.2.14" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 33 | dependencies = [ 34 | "hermit-abi", 35 | "libc", 36 | "winapi", 37 | ] 38 | 39 | [[package]] 40 | name = "autocfg" 41 | version = "1.1.0" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 44 | 45 | [[package]] 46 | name = "bitflags" 47 | version = "1.3.2" 48 | source = "registry+https://github.com/rust-lang/crates.io-index" 49 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 50 | 51 | [[package]] 52 | name = "bytemuck" 53 | version = "1.9.1" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" 56 | 57 | [[package]] 58 | name = "cc" 59 | version = "1.0.73" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 62 | 63 | [[package]] 64 | name = "cfg-if" 65 | version = "1.0.0" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 68 | 69 | [[package]] 70 | name = "clap" 71 | version = "3.1.8" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" 74 | dependencies = [ 75 | "atty", 76 | "bitflags", 77 | "indexmap", 78 | "lazy_static", 79 | "os_str_bytes", 80 | "strsim", 81 | "termcolor", 82 | "textwrap", 83 | ] 84 | 85 | [[package]] 86 | name = "color_quant" 87 | version = "1.1.0" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" 90 | 91 | [[package]] 92 | name = "crc32fast" 93 | version = "1.3.2" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 96 | dependencies = [ 97 | "cfg-if", 98 | ] 99 | 100 | [[package]] 101 | name = "crossbeam-channel" 102 | version = "0.5.4" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" 105 | dependencies = [ 106 | "cfg-if", 107 | "crossbeam-utils", 108 | ] 109 | 110 | [[package]] 111 | name = "crossbeam-deque" 112 | version = "0.8.1" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" 115 | dependencies = [ 116 | "cfg-if", 117 | "crossbeam-epoch", 118 | "crossbeam-utils", 119 | ] 120 | 121 | [[package]] 122 | name = "crossbeam-epoch" 123 | version = "0.9.8" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" 126 | dependencies = [ 127 | "autocfg", 128 | "cfg-if", 129 | "crossbeam-utils", 130 | "lazy_static", 131 | "memoffset", 132 | "scopeguard", 133 | ] 134 | 135 | [[package]] 136 | name = "crossbeam-utils" 137 | version = "0.8.8" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" 140 | dependencies = [ 141 | "cfg-if", 142 | "lazy_static", 143 | ] 144 | 145 | [[package]] 146 | name = "dunce" 147 | version = "1.0.2" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" 150 | 151 | [[package]] 152 | name = "either" 153 | version = "1.6.1" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" 156 | 157 | [[package]] 158 | name = "fallible_collections" 159 | version = "0.4.4" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "52db5973b6a19247baf19b30f41c23a1bfffc2e9ce0a5db2f60e3cd5dc8895f7" 162 | dependencies = [ 163 | "hashbrown", 164 | ] 165 | 166 | [[package]] 167 | name = "flate2" 168 | version = "1.0.22" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" 171 | dependencies = [ 172 | "cfg-if", 173 | "crc32fast", 174 | "libc", 175 | "miniz_oxide", 176 | ] 177 | 178 | [[package]] 179 | name = "getrandom" 180 | version = "0.2.6" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" 183 | dependencies = [ 184 | "cfg-if", 185 | "libc", 186 | "wasi", 187 | ] 188 | 189 | [[package]] 190 | name = "gif" 191 | version = "0.11.3" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b" 194 | dependencies = [ 195 | "color_quant", 196 | "weezl", 197 | ] 198 | 199 | [[package]] 200 | name = "gif-dispose" 201 | version = "3.1.1" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "243e0347e8f4384181cb12069d87b9dae021c41bdaada7bd0d6743ad6d95c1d7" 204 | dependencies = [ 205 | "gif", 206 | "imgref", 207 | "rgb", 208 | ] 209 | 210 | [[package]] 211 | name = "gifsicle" 212 | version = "1.92.5" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "36998a2316aad26c8bfd74c82a8809eaf12e2216a2938bc4dca5b83c59fb3e1a" 215 | dependencies = [ 216 | "cc", 217 | "libc", 218 | ] 219 | 220 | [[package]] 221 | name = "gifski" 222 | version = "1.6.6" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "1c2c00346c2ed61cb4d2694d9e8c68c87ddd9262c4045d6a528ec74d7169a1a8" 225 | dependencies = [ 226 | "clap", 227 | "crossbeam-channel", 228 | "dunce", 229 | "gif", 230 | "gif-dispose", 231 | "gifsicle", 232 | "imagequant", 233 | "imgref", 234 | "lodepng", 235 | "natord", 236 | "pbr", 237 | "quick-error", 238 | "resize", 239 | "rgb", 240 | "wild", 241 | ] 242 | 243 | [[package]] 244 | name = "glob" 245 | version = "0.3.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 248 | 249 | [[package]] 250 | name = "hashbrown" 251 | version = "0.11.2" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 254 | dependencies = [ 255 | "ahash", 256 | ] 257 | 258 | [[package]] 259 | name = "hermit-abi" 260 | version = "0.1.19" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 263 | dependencies = [ 264 | "libc", 265 | ] 266 | 267 | [[package]] 268 | name = "imagequant" 269 | version = "4.0.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "49f533cecb7eb061d19dee3c938d0e302c02193270497483e1b662a0a1a5e343" 272 | dependencies = [ 273 | "arrayvec", 274 | "fallible_collections", 275 | "noisy_float", 276 | "once_cell", 277 | "rayon", 278 | "rgb", 279 | "thread_local", 280 | ] 281 | 282 | [[package]] 283 | name = "imgref" 284 | version = "1.9.1" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "41d0c0db6c932f8262e0ed8909f2e7f8c0e9b1cfb4da884267ce09a10be54365" 287 | 288 | [[package]] 289 | name = "indexmap" 290 | version = "1.8.1" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" 293 | dependencies = [ 294 | "autocfg", 295 | "hashbrown", 296 | ] 297 | 298 | [[package]] 299 | name = "lazy_static" 300 | version = "1.4.0" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 303 | 304 | [[package]] 305 | name = "libc" 306 | version = "0.2.121" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" 309 | 310 | [[package]] 311 | name = "lodepng" 312 | version = "3.6.1" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "7f84e1fdcdbe8b3f0f9caaadb6b86d0e0647786e993f6ea70686f6837b989ec7" 315 | dependencies = [ 316 | "crc32fast", 317 | "fallible_collections", 318 | "flate2", 319 | "libc", 320 | "rgb", 321 | ] 322 | 323 | [[package]] 324 | name = "memchr" 325 | version = "2.4.1" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 328 | 329 | [[package]] 330 | name = "memoffset" 331 | version = "0.6.5" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 334 | dependencies = [ 335 | "autocfg", 336 | ] 337 | 338 | [[package]] 339 | name = "miniz_oxide" 340 | version = "0.4.4" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" 343 | dependencies = [ 344 | "adler", 345 | "autocfg", 346 | ] 347 | 348 | [[package]] 349 | name = "myrustlib" 350 | version = "0.1.0" 351 | dependencies = [ 352 | "gifski", 353 | ] 354 | 355 | [[package]] 356 | name = "natord" 357 | version = "1.0.9" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" 360 | 361 | [[package]] 362 | name = "noisy_float" 363 | version = "0.2.0" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "978fe6e6ebc0bf53de533cd456ca2d9de13de13856eda1518a285d7705a213af" 366 | dependencies = [ 367 | "num-traits", 368 | ] 369 | 370 | [[package]] 371 | name = "num-traits" 372 | version = "0.2.14" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 375 | dependencies = [ 376 | "autocfg", 377 | ] 378 | 379 | [[package]] 380 | name = "num_cpus" 381 | version = "1.13.1" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 384 | dependencies = [ 385 | "hermit-abi", 386 | "libc", 387 | ] 388 | 389 | [[package]] 390 | name = "once_cell" 391 | version = "1.10.0" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" 394 | 395 | [[package]] 396 | name = "os_str_bytes" 397 | version = "6.0.0" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" 400 | dependencies = [ 401 | "memchr", 402 | ] 403 | 404 | [[package]] 405 | name = "pbr" 406 | version = "1.0.4" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "ff5751d87f7c00ae6403eb1fcbba229b9c76c9a30de8c1cf87182177b168cea2" 409 | dependencies = [ 410 | "crossbeam-channel", 411 | "libc", 412 | "time", 413 | "winapi", 414 | ] 415 | 416 | [[package]] 417 | name = "quick-error" 418 | version = "2.0.1" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" 421 | 422 | [[package]] 423 | name = "rayon" 424 | version = "1.5.1" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" 427 | dependencies = [ 428 | "autocfg", 429 | "crossbeam-deque", 430 | "either", 431 | "rayon-core", 432 | ] 433 | 434 | [[package]] 435 | name = "rayon-core" 436 | version = "1.9.1" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" 439 | dependencies = [ 440 | "crossbeam-channel", 441 | "crossbeam-deque", 442 | "crossbeam-utils", 443 | "lazy_static", 444 | "num_cpus", 445 | ] 446 | 447 | [[package]] 448 | name = "resize" 449 | version = "0.7.2" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "a2a32135a3cd4df690ee74dc0e1a77ffe2cdd4611b4e58b84df26a856d92b4ef" 452 | dependencies = [ 453 | "fallible_collections", 454 | "rgb", 455 | ] 456 | 457 | [[package]] 458 | name = "rgb" 459 | version = "0.8.32" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "e74fdc210d8f24a7dbfedc13b04ba5764f5232754ccebfdf5fff1bad791ccbc6" 462 | dependencies = [ 463 | "bytemuck", 464 | ] 465 | 466 | [[package]] 467 | name = "scopeguard" 468 | version = "1.1.0" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 471 | 472 | [[package]] 473 | name = "strsim" 474 | version = "0.10.0" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 477 | 478 | [[package]] 479 | name = "termcolor" 480 | version = "1.1.3" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 483 | dependencies = [ 484 | "winapi-util", 485 | ] 486 | 487 | [[package]] 488 | name = "textwrap" 489 | version = "0.15.0" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" 492 | 493 | [[package]] 494 | name = "thread_local" 495 | version = "1.1.4" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" 498 | dependencies = [ 499 | "once_cell", 500 | ] 501 | 502 | [[package]] 503 | name = "time" 504 | version = "0.1.43" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 507 | dependencies = [ 508 | "libc", 509 | "winapi", 510 | ] 511 | 512 | [[package]] 513 | name = "version_check" 514 | version = "0.9.4" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 517 | 518 | [[package]] 519 | name = "wasi" 520 | version = "0.10.2+wasi-snapshot-preview1" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 523 | 524 | [[package]] 525 | name = "weezl" 526 | version = "0.1.5" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e" 529 | 530 | [[package]] 531 | name = "wild" 532 | version = "2.0.4" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" 535 | dependencies = [ 536 | "glob", 537 | ] 538 | 539 | [[package]] 540 | name = "winapi" 541 | version = "0.3.9" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 544 | dependencies = [ 545 | "winapi-i686-pc-windows-gnu", 546 | "winapi-x86_64-pc-windows-gnu", 547 | ] 548 | 549 | [[package]] 550 | name = "winapi-i686-pc-windows-gnu" 551 | version = "0.4.0" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 554 | 555 | [[package]] 556 | name = "winapi-util" 557 | version = "0.1.5" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 560 | dependencies = [ 561 | "winapi", 562 | ] 563 | 564 | [[package]] 565 | name = "winapi-x86_64-pc-windows-gnu" 566 | version = "0.4.0" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 569 | -------------------------------------------------------------------------------- /src/old-1.6.6/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "myrustlib" 3 | version = "0.1.0" 4 | authors = ["Jeroen "] 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["staticlib"] 9 | 10 | [dependencies] 11 | gifski = "1.6.6" 12 | -------------------------------------------------------------------------------- /src/wrapper.c: -------------------------------------------------------------------------------- 1 | #define R_NO_REMAP 2 | #define STRICT_R_HEADERS 3 | #include 4 | #include 5 | #include 6 | 7 | // Import C headers for rust API 8 | #include "myrustlib/gifski.h" 9 | 10 | int cb(void *user_data){ 11 | int *counter = user_data; 12 | *counter = (*counter)+1; 13 | //Rprintf("\rProcessing frame %d...", *counter); 14 | return 1; 15 | } 16 | 17 | SEXP R_png_to_gif(SEXP png_files, SEXP gif_file, SEXP width, SEXP height, SEXP delay, SEXP repeats, SEXP progress){ 18 | if(!Rf_isString(png_files)) 19 | Rf_error("png_files must be character vector"); 20 | 21 | GifskiSettings settings = {0}; 22 | settings.height = Rf_asInteger(height); 23 | settings.width = Rf_asInteger(width); 24 | settings.quality = 100; 25 | settings.fast = 0; 26 | settings.repeat = Rf_asInteger(repeats); 27 | gifski *g = gifski_new(&settings); 28 | 29 | /* Set a callback */ 30 | int counter = 0; 31 | gifski_set_progress_callback(g, cb, &counter); 32 | gifski_set_file_output(g, CHAR(STRING_ELT(gif_file, 0))); 33 | 34 | /* add png frames in main thread */ 35 | for(uint32_t i = 0; i < Rf_length(png_files); i++){ 36 | double pts = i * Rf_asReal(delay); 37 | if(gifski_add_frame_png_file(g, i, CHAR(STRING_ELT(png_files, i)), pts) != GIFSKI_OK) 38 | REprintf("Failed to add frame %d\n", i); 39 | if(Rf_asLogical(progress)) 40 | REprintf("\rInserting image %d at %.2fs (%d%%)...", (i+1), pts, (i+1) * 100 / Rf_length(png_files)); 41 | } 42 | 43 | /* This will finalize the encoder thread as well */ 44 | if(Rf_asLogical(progress)) 45 | REprintf("\nEncoding to gif..."); 46 | if(gifski_finish(g) != GIFSKI_OK) 47 | Rf_error("Failed gifski_finish"); 48 | if(Rf_asLogical(progress)) 49 | REprintf(" done!\n"); 50 | return gif_file; 51 | } 52 | 53 | // Standard R package stuff 54 | static const R_CallMethodDef CallEntries[] = { 55 | {"R_png_to_gif", (DL_FUNC) &R_png_to_gif, 7}, 56 | {NULL, NULL, 0} 57 | }; 58 | 59 | attribute_visible void R_init_gifski(DllInfo *dll) { 60 | R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); 61 | R_useDynamicSymbols(dll, FALSE); 62 | } 63 | -------------------------------------------------------------------------------- /tools/rustarch.R: -------------------------------------------------------------------------------- 1 | # See notes in FAQ about ARM64 support: 2 | # https://github.com/r-rust/faq#does-rust-support-windows-on-arm64-aarch64 3 | arch <- if(grepl("aarch", R.version$platform)){ 4 | "aarch64-pc-windows-gnullvm" 5 | } else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ 6 | "x86_64-pc-windows-gnullvm" 7 | } else if(grepl("i386", R.version$platform)){ 8 | "i686-pc-windows-gnu" 9 | } else { 10 | "x86_64-pc-windows-gnu" 11 | } 12 | 13 | cat(arch) 14 | -------------------------------------------------------------------------------- /tools/winlibs.R: -------------------------------------------------------------------------------- 1 | if(!file.exists("../windows/libgifski/lib")){ 2 | unlink("../windows", recursive = TRUE) 3 | url <- if(grepl("aarch", R.version$platform)){ 4 | "https://github.com/r-windows/bundles/releases/download/gifski-1.32.0/gifski-1.32.0-clang-aarch64.tar.xz" 5 | } else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ 6 | "https://github.com/r-windows/bundles/releases/download/gifski-1.32.0/gifski-1.32.0-clang-x86_64.tar.xz" 7 | } else if(getRversion() >= "4.2") { 8 | "https://github.com/r-windows/bundles/releases/download/gifski-1.32.0/gifski-1.32.0-ucrt-x86_64.tar.xz" 9 | } else { 10 | "https://github.com/r-windows/bundles/releases/download/gifski-1.12.2/gifski-1.12.0-msvcrt.tar.xz" 11 | } 12 | download.file(url, basename(url), quiet = TRUE) 13 | dir.create("../windows", showWarnings = FALSE) 14 | untar(basename(url), exdir = "../windows", tar = 'internal') 15 | unlink(basename(url)) 16 | setwd("../windows") 17 | file.rename(list.files(), 'libgifski') 18 | } 19 | --------------------------------------------------------------------------------