Skip to content

Commit

Permalink
epam#2183 - Preview: PNG images aren't on the bottom layer on preview…
Browse files Browse the repository at this point in the history
… and after save to PNG and SVG formats (epam#2187)
  • Loading branch information
even1024 authored Aug 6, 2024
1 parent 358925a commit 4927ba5
Show file tree
Hide file tree
Showing 7 changed files with 365 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ multi.png rendering status: OK
single_arrow.png rendering status: OK
images.png rendering status: OK
test1png.png rendering status: OK
image_first.png rendering status: OK
344 changes: 344 additions & 0 deletions api/tests/integration/tests/rendering/reactions/image_first.ket

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
renderer.renderToFile(reac, joinPathPy("out/test1png.png", __file__))
print(checkImageSimilarity("test1png.png"))

reac = indigo.loadReactionFromFile(
joinPathPy("reactions/image_first.ket", __file__)
)
reac.layout()
indigo.setOption("render-output-format", "png")
renderer.renderToFile(reac, joinPathPy("out/image_first.png", __file__))
print(checkImageSimilarity("image_first.png"))

if isIronPython():
renderer.Dispose()
indigo.Dispose()
12 changes: 12 additions & 0 deletions core/render2d/src/render_item_aux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,19 @@ void RenderItemAuxiliary::_drawMeta(bool idle)
{
_rc.setSingleSource(CWC_BASE);
const auto& md = meta->metaData();
// images go first
std::vector<int> order_indexes, back_indexes;
for (int i = 0; i < md.size(); ++i)
{
const auto& mobj = *md[i];
if (mobj._class_id == KETImage::CID)
order_indexes.push_back(i);
else
back_indexes.push_back(i);
}
order_indexes.insert(order_indexes.end(), back_indexes.begin(), back_indexes.end());

for (auto i : order_indexes)
{
const auto& mobj = *md[i];
switch (mobj._class_id)
Expand Down

0 comments on commit 4927ba5

Please sign in to comment.