Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Crunch
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Crunch
Commits
e4ff2ef6
Verified
Commit
e4ff2ef6
authored
1 year ago
by
Louis
Browse files
Options
Downloads
Patches
Plain Diff
Clippy Lints
parent
bee6ef6e
No related branches found
No related tags found
No related merge requests found
Pipeline
#546
waiting for manual action with stages
in 1 minute and 28 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.lock
+1
-1
1 addition, 1 deletion
Cargo.lock
src/commands/extract.rs
+1
-13
1 addition, 13 deletions
src/commands/extract.rs
src/commands/info.rs
+2
-3
2 additions, 3 deletions
src/commands/info.rs
src/commands/reduce.rs
+1
-1
1 addition, 1 deletion
src/commands/reduce.rs
with
5 additions
and
18 deletions
Cargo.lock
+
1
−
1
View file @
e4ff2ef6
...
...
@@ -233,7 +233,7 @@ dependencies = [
[[package]]
name = "crunch-cli"
version = "0.
6
.0"
version = "0.
7
.0"
dependencies = [
"anyhow",
"clap",
...
...
This diff is collapsed.
Click to expand it.
src/commands/extract.rs
+
1
−
13
View file @
e4ff2ef6
use
crate
::
utils
::
new_image
;
use
clap
::
Parser
;
use
image
::{
GenericImage
,
GenericImageView
,
Pixel
,
Rgba
,
RgbaImage
};
use
rayon
::
prelude
::
*
;
use
serde
::{
Deserialize
,
Serialize
};
use
std
::
collections
::
HashSet
;
use
std
::
ops
::{
Deref
,
DerefMut
};
use
std
::
path
::
PathBuf
;
use
std
::
sync
::
Arc
;
fn
default_max_size
()
->
usize
{
2048
}
/// Extract individual, non-square sprites from a given spritesheet
#[derive(Parser,
Serialize,
Deserialize,
Clone,
Debug)]
...
...
@@ -27,7 +20,6 @@ pub struct Extract {
struct
PixelData
{
x
:
u32
,
y
:
u32
,
pixel
:
Rgba
<
u8
>
,
}
#[derive(Debug)]
...
...
@@ -133,11 +125,7 @@ impl Extract {
continue
;
}
current
.push
(
PixelData
{
x
:
cx
,
y
:
cy
,
pixel
,
});
current
.push
(
PixelData
{
x
:
cx
,
y
:
cy
});
let
x
=
[
-
1
,
0
,
1
];
let
y
=
[
-
1
,
0
,
1
];
...
...
This diff is collapsed.
Click to expand it.
src/commands/info.rs
+
2
−
3
View file @
e4ff2ef6
use
crate
::
utils
::
TypedOutputFormat
;
use
clap
::{
Parser
,
ValueEnum
};
use
image
::{
imageops
,
GenericImage
,
ImageFormat
,
Pixel
};
use
clap
::
Parser
;
use
image
::{
GenericImage
,
ImageFormat
,
Pixel
};
use
serde
::{
Deserialize
,
Serialize
};
/// Extract Information About An Image
...
...
This diff is collapsed.
Click to expand it.
src/commands/reduce.rs
+
1
−
1
View file @
e4ff2ef6
...
...
@@ -24,7 +24,7 @@ pub struct Reduce {
}
impl
Reduce
{
pub
fn
run
<
T
:
GenericImage
>
(
&
self
,
_image
:
&
T
)
->
anyhow
::
Result
<
RgbaOutputFormat
>
{
pub
fn
_
run
<
T
:
GenericImage
>
(
&
self
,
_image
:
&
T
)
->
anyhow
::
Result
<
RgbaOutputFormat
>
{
Err
(
Error
::
msg
(
"Reduce is not implemented"
))
// TODO: Reduce impl
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment