Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
ec1bf96e
Unverified
Commit
ec1bf96e
authored
Jun 07, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 07, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39200 from azagaya/fix-blend-2
Fixing wrong blending rect methods
parents
46d8d601
b211a86e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
image.cpp
core/image.cpp
+10
-12
No files found.
core/image.cpp
View file @
ec1bf96e
...
...
@@ -2539,12 +2539,11 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P
int
dst_y
=
dest_rect
.
position
.
y
+
i
;
Color
sc
=
img
->
get_pixel
(
src_x
,
src_y
);
Color
dc
=
get_pixel
(
dst_x
,
dst_y
);
dc
.
r
=
(
double
)(
sc
.
a
*
sc
.
r
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
r
);
dc
.
g
=
(
double
)(
sc
.
a
*
sc
.
g
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
g
);
dc
.
b
=
(
double
)(
sc
.
a
*
sc
.
b
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
b
);
dc
.
a
=
(
double
)(
sc
.
a
+
dc
.
a
*
(
1.0
-
sc
.
a
));
set_pixel
(
dst_x
,
dst_y
,
dc
);
if
(
sc
.
a
!=
0
)
{
Color
dc
=
get_pixel
(
dst_x
,
dst_y
);
dc
=
dc
.
blend
(
sc
);
set_pixel
(
dst_x
,
dst_y
,
dc
);
}
}
}
}
...
...
@@ -2594,12 +2593,11 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
int
dst_y
=
dest_rect
.
position
.
y
+
i
;
Color
sc
=
img
->
get_pixel
(
src_x
,
src_y
);
Color
dc
=
get_pixel
(
dst_x
,
dst_y
);
dc
.
r
=
(
double
)(
sc
.
a
*
sc
.
r
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
r
);
dc
.
g
=
(
double
)(
sc
.
a
*
sc
.
g
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
g
);
dc
.
b
=
(
double
)(
sc
.
a
*
sc
.
b
+
dc
.
a
*
(
1.0
-
sc
.
a
)
*
dc
.
b
);
dc
.
a
=
(
double
)(
sc
.
a
+
dc
.
a
*
(
1.0
-
sc
.
a
));
set_pixel
(
dst_x
,
dst_y
,
dc
);
if
(
sc
.
a
!=
0
)
{
Color
dc
=
get_pixel
(
dst_x
,
dst_y
);
dc
=
dc
.
blend
(
sc
);
set_pixel
(
dst_x
,
dst_y
,
dc
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment