Skip to content

Commit

Permalink
Render cg with layer blending (#566)
Browse files Browse the repository at this point in the history
Co-authored-by: namse <[email protected]>
  • Loading branch information
bigfoodK and namse authored Jul 3, 2023
1 parent aed5871 commit a6fe340
Show file tree
Hide file tree
Showing 106 changed files with 7,046 additions and 133 deletions.
9 changes: 6 additions & 3 deletions luda-editor/client/src/components/cg_render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ pub struct CgRenderProps {
}

pub fn render_cg(props: CgRenderProps, screen_cg: &ScreenCg, cg_file: &CgFile) -> RenderingTree {
render(screen_cg.parts.iter().map(|part| {
render(screen_cg.parts.iter().rev().map(|screen_part| {
try_render(|| {
let cg_part = cg_file.parts.iter().find(|part| part.name == part.name)?;
Some(render_cg_part(&props, part, cg_part))
let cg_part = cg_file
.parts
.iter()
.find(|part| part.name == screen_part.name())?;
Some(render_cg_part(&props, screen_part, cg_part))
})
}))
}
Expand Down
158 changes: 158 additions & 0 deletions luda-editor/psd/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
version: 2

jobs:

test:
docker:
- image: rust:latest
steps:
- checkout

- restore_cache:
keys:
- v3-cargo-cache-test-{{ arch }}-{{ .Branch }}
- v3-cargo-cache-test-{{ arch }}

# Install nightly & wasm
- run:
name: Install Rust nightly
command: rustup update nightly && rustup default nightly
- run:
name: Add wasm32 target
command: rustup target add wasm32-unknown-unknown

# Install wasm tools
- run:
name: Install wasm-pack
command: >
curl -L https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz
| tar --strip-components=1 --wildcards -xzf - "*/wasm-pack"
&& chmod +x wasm-pack
&& mv wasm-pack $CARGO_HOME/bin/
# Show versions
- run:
name: Show versions
command: rustc --version && cargo --version && wasm-pack --version

# Run tests
- run:
name: Run all tests
command: cargo test --all

# Save cache
- save_cache:
key: v3-cargo-cache-test-{{ arch }}-{{ .Branch }}
paths:
- target
- /usr/local/cargo
- save_cache:
key: v3-cargo-cache-test-{{ arch }}
paths:
- target
- /usr/local/cargo

site-build:
docker:
- image: rust:latest
steps:
- checkout
- restore_cache:
keys:
- v3-cargo-cache-site-{{ arch }}-{{ .Branch }}
- v3-cargo-cache-site-{{ arch }}

# Install nightly
- run:
name: Install Rust nightly
command: rustup update nightly && rustup default nightly

# Show versions
- run:
name: Show versions
command: rustc --version && cargo --version

# Install wasm tools
- run:
name: Install wasm-pack
command: >
curl -L https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz
| tar --strip-components=1 --wildcards -xzf - "*/wasm-pack"
&& chmod +x wasm-pack
&& mv wasm-pack $CARGO_HOME/bin/
# Install mdbook
- run:
name: Install mdbook
command: >
(test -x $CARGO_HOME/bin/cargo-install-update || cargo install cargo-update)
&& (test -x $CARGO_HOME/bin/mdbook || cargo install --vers "^0.4" mdbook)
&& mv ~/.gitconfig ~/.gitconfig.disabled # Workaround for https://github.com/nabijaczleweli/cargo-update/issues/100
&& cargo install-update -a
&& mv ~/.gitconfig.disabled ~/.gitconfig
# Build Site
- run:
name: Build Site
command: >
(cd book && mdbook build)
&& cargo doc --no-deps -p psd
&& cp -R target/doc book/book/api
&& (cd examples/drag-drop-browser && ./build-release.sh)
&& cp -R examples/drag-drop-browser/public book/book/drag-drop-demo
&& rm book/book/drag-drop-demo/.gitignore
&& sed -i -e 's/drag_drop_browser/psd\/drag-drop-demo\/drag_drop_browser/g' book/book/drag-drop-demo/index.html # Fix script path
&& sed -i -e 's/app.css/psd\/drag-drop-demo\/app.css/g' book/book/drag-drop-demo/index.html # Fix script path
- persist_to_workspace:
root: book
paths: book

# Save cache
- save_cache:
key: v3-cargo-cache-site-{{ arch }}-{{ .Branch }}
paths:
- target
- /usr/local/cargo
- save_cache:
key: v3-cargo-cache-site-{{ arch }}
paths:
- target
- /usr/local/cargo

site-deploy:
docker:
- image: node:10
steps:
- checkout
- attach_workspace:
at: book
- run:
name: Disable jekyll builds
command: touch book/book/.nojekyll
- run:
name: Install and configure dependencies
command: |
npm install -g --silent [email protected]
git config user.email "[email protected]"
git config user.name "ci-build"
- add_ssh_keys:
fingerprints:
- "74:9d:18:d2:11:b2:15:39:9f:d3:77:84:10:cd:f9:c1"
- run:
name: Deploy site to gh-pages branch
command: gh-pages --dotfiles --message "[skip ci] Updates" --dist book/book

workflows:
version: 2
build:
jobs:
- test
- site-build
- site-deploy:
requires:
- site-build
filters:
branches:
only: master
5 changes: 5 additions & 0 deletions luda-editor/psd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
**/*.rs.bk
Cargo.lock
.idea
.DS_Store
28 changes: 28 additions & 0 deletions luda-editor/psd/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# psd Changelog

Types of changes:

- `[added]` for new features.
- `[changed]` for changes in existing functionality.
- `[deprecated]` for once-stable features removed in upcoming releases.
- `[removed]` for deprecated features removed in this release.
- `[fixed]` for any bug fixes.
- `[security]` to invite users to upgrade in case of vulnerabilities.

## Not Yet Published

_Here we list notable things that have been merged into the master branch but have not been released yet._

- [added] Public information on the position of each layer (E.g. `layer_top`, `layer_bottom`. `layer_left`, `layer_right`).

## 0.1.8 - April 23, 2020

- [fixed] Parsing of slices resource section [PR][17]

## 0.1.7 - April 11, 2020

- [added] Support for PSD groups [PR][13]
- @tdakkota

[13]: https://github.com/chinedufn/psd/pull/13
[17]: https://github.com/chinedufn/psd/pull/17
24 changes: 24 additions & 0 deletions luda-editor/psd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "psd"
version = "0.3.4"
authors = ["Chinedu Francis Nwafili <[email protected]>"]
description = "A Rust API for parsing and working with PSD files."
keywords = ["psd", "photoshop", "texture", "png", "image"]
license = "MIT/Apache-2.0"
repository = "https://github.com/chinedufn/psd"
edition = "2018"

[dependencies]
thiserror = "1.0"

[dev-dependencies]
anyhow = "1.0"

[workspace]
members = [
"examples/drag-drop-browser"
]

[profile.release]
# We can re-enable lto for the demo when wasm-pack 0.2.38 is released. There's a bug in 0.2.37
# lto = true
Loading

0 comments on commit a6fe340

Please sign in to comment.