mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Merge pull request #15 from G-e-n-e-v-e-n-s-i-S/combine-blend-alpha
Update combine_image.cpp
This commit is contained in:
@@ -311,12 +311,8 @@ void combine_image_do(Image& a, Image b) {
|
|||||||
|
|
||||||
void combine_image(Image& a, const Image& b, ImageCombine combine) {
|
void combine_image(Image& a, const Image& b, ImageCombine combine) {
|
||||||
// Images must have same size
|
// Images must have same size
|
||||||
assert(a.GetWidth() == b.GetWidth());
|
if (a.GetWidth() != b.GetWidth() || a.GetHeight() != b.GetHeight()) {
|
||||||
assert(a.GetHeight() == b.GetHeight());
|
throw Error(_ERROR_("images used for combine blending must have the same size"));
|
||||||
// Copy alpha channel?
|
|
||||||
if (b.HasAlpha()) {
|
|
||||||
if (!a.HasAlpha()) a.InitAlpha();
|
|
||||||
memcpy(a.GetAlpha(), b.GetAlpha(), a.GetWidth() * a.GetHeight());
|
|
||||||
}
|
}
|
||||||
// Combine image data, by dispatching to combineImageDo
|
// Combine image data, by dispatching to combineImageDo
|
||||||
switch(combine) {
|
switch(combine) {
|
||||||
|
|||||||
Reference in New Issue
Block a user