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
df5b57cc
Verified
Commit
df5b57cc
authored
2 years ago
by
Louis
Browse files
Options
Downloads
Patches
Plain Diff
Remove redundant utils
parent
e30bbbb6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils.rs
+2
-18
2 additions, 18 deletions
src/utils.rs
with
2 additions
and
18 deletions
src/utils.rs
+
2
−
18
View file @
df5b57cc
...
...
@@ -27,22 +27,6 @@ pub type TypedOutputFormat<T: GenericImage> =
image
::
ImageBuffer
<
T
::
Pixel
,
Vec
<<
T
::
Pixel
as
image
::
Pixel
>
::
Subpixel
>>
;
pub
type
RgbaOutputFormat
=
TypedOutputFormat
<
RgbaImage
>
;
pub
fn
max_f32
(
a
:
f32
,
b
:
f32
)
->
f32
{
if
a
>
b
{
a
}
else
{
b
}
}
pub
fn
min_f32
(
a
:
f32
,
b
:
f32
)
->
f32
{
if
a
<
b
{
a
}
else
{
b
}
}
pub
fn
new_image
(
new_width
:
u32
,
new_height
:
u32
)
->
OutputFormat
{
let
mut
new_image
=
RgbaImage
::
new
(
new_width
,
new_height
);
let
(
new_image_x
,
new_image_y
,
new_image_width
,
new_image_height
)
=
new_image
.bounds
();
...
...
@@ -68,8 +52,8 @@ impl BasicRgba {
let
green
=
self
.g
as
f32
/
u8
::
MAX
as
f32
;
let
blue
=
self
.b
as
f32
/
u8
::
MAX
as
f32
;
let
minimum
=
min_f32
(
red
,
min
_f32
(
green
,
blue
)
)
;
let
maximum
=
max_f32
(
red
,
max
_f32
(
green
,
blue
)
)
;
let
minimum
=
red
.
min
(
green
)
.min
(
blue
);
let
maximum
=
red
.
max
(
green
)
.max
(
blue
);
let
mut
hue
=
if
red
>=
green
&&
red
>=
blue
{
(
green
-
blue
)
/
(
maximum
-
minimum
)
...
...
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