Icon-O-Matic: Save alpha of reference images
Change-Id: I821521c2f58052d70e9f27c7ffc9849095e540a0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6658 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
d1e42115d0
commit
4ed150bdc3
@ -65,6 +65,7 @@ ReferenceImage::ReferenceImage(const ReferenceImage& other)
|
|||||||
SetName(other.Name());
|
SetName(other.Name());
|
||||||
SetImage(bitmap);
|
SetImage(bitmap);
|
||||||
SetTransform(other);
|
SetTransform(other);
|
||||||
|
Style()->SetAlpha(other.Style()->Alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ ReferenceImage::Unarchive(BMessage* archive)
|
|||||||
if (ret < B_OK)
|
if (ret < B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// read transformation
|
// transformation
|
||||||
const double* matrix;
|
const double* matrix;
|
||||||
ssize_t dataSize;
|
ssize_t dataSize;
|
||||||
ret = archive->FindData("transformation", B_DOUBLE_TYPE,
|
ret = archive->FindData("transformation", B_DOUBLE_TYPE,
|
||||||
@ -103,11 +104,18 @@ ReferenceImage::Unarchive(BMessage* archive)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
LoadFrom(matrix);
|
LoadFrom(matrix);
|
||||||
|
|
||||||
|
// image
|
||||||
BBitmap* bitmap = dynamic_cast<BBitmap*>(BBitmap::Instantiate(archive));
|
BBitmap* bitmap = dynamic_cast<BBitmap*>(BBitmap::Instantiate(archive));
|
||||||
if (bitmap == NULL)
|
if (bitmap == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
SetImage(bitmap);
|
SetImage(bitmap);
|
||||||
|
|
||||||
|
// alpha
|
||||||
|
uint8 alpha;
|
||||||
|
if(archive->FindUInt8("alpha", &alpha) < B_OK)
|
||||||
|
alpha = 255;
|
||||||
|
Style()->SetAlpha(alpha);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +138,12 @@ ReferenceImage::Archive(BMessage* into, bool deep) const
|
|||||||
|
|
||||||
// image
|
// image
|
||||||
ret = Style()->Bitmap()->Archive(into, deep);
|
ret = Style()->Bitmap()->Archive(into, deep);
|
||||||
|
if (ret < B_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
// alpha
|
||||||
|
ret = into->AddUInt8("alpha", Style()->Alpha());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user