Point Image Serialization/Deserialization fails for in-memory Image

Description

GitHub Issue #47, having set the ShapeDrawingOptions.Picture property to an in-memory Image, serializing the Picture property (via SaveLayerOptions) then restoring the Picture property (via LoadLayerOptions), the Image is not fully restored. This does not fail for disk-based Images.

Activity

Show:
Jerry Faust
December 2, 2017, 10:12 PM

Note that the same code is executed when doing a simple Image.Serialize, then Image.Deserialize, as in

string s = img.Serialize(true);
img.Deserialize(s);

Jerry Faust
December 2, 2017, 9:53 PM

The data buffer for in-memory images was being calculated as Width x Height x 3 (presumably for RGB components) and instead should have been Width x Height x 4 (to include the alpha component, ARGB).

Additionally, the image type was getting changed from istInMemory to istGDIPlus after being loaded. As a result, if the layer options were saved/restored a second time, an exception was thrown.

Done

Assignee

Jerry Faust

Reporter

Jerry Faust

Labels

None

Epic Link

None

Affects versions

Fix versions

Priority

Medium