Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Bitmap in Icon

Bitmap in Icon

Hi,

There seems to be some issue with using Bitmaps in Icons in version 1.18.0 of OpenModelica. The image is loaded correctly and stored in the model, but it is flipped both horizontally and vertically. This used to work in earlier versions.

Is there some way around this issue?

Re: Bitmap in Icon

Please share a minimal test model.

If you think it is a bug then report it here https://github.com/OpenModelica/OpenMod … new/choose

Adeel.

Re: Bitmap in Icon

Here's a model that shows the issue:

model iconTest
equation

annotation(
    Icon(graphics = {Bitmap(extent = {{-100, 100}, {100, -100}}, imageSource = "/9j/4AAQSkZJRgABAQIAJQAlAAD/4QhoRXhpZgAASUkqAAgAAAAGABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAwAAADEBAgANAAAAZgAAADIBAgAUAAAAdAAAAGmHBAABAAAAiAAAAJoAAADOAgAAEwAAAM4CAAATAAAAR0lNUCAyLjEwLjIwAAAyMDIxOjEwOjE0IDE1OjE4OjEwAAEAAaADAAEAAAABAAAAAAAAAAgAAAEEAAEAAAAAAQAAAQEEAAEAAAAAAQAAAgEDAAMAAAAAAQAAAwEDAAEAAAAGAAAABgEDAAEAAAAGAAAAFQEDAAEAAAADAAAAAQIEAAEAAAAGAQAAAgIEAAEAAABZBwAAAAAAAAgACAAIAP/Y/+AAEEpGSUYAAQEAAAEAAQAA/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgBAAEAAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A9/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiqVAF2isekoA2aKyK0aAJqKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoornqANmuKrlq9GoA84rWr1GigDhKsV2dFAHndZNetUUAeP13ddBXKUAddTq8cr1ugCxRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFU6AMmuLqjXsFABUlFFABRRRQAUUUUAFFFFABRRRQBn15XXslZtAFqrFeQ169QAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFeWV6bXldAHo9adFFABRRTaAHUVylcrQB6rRXn9dxQBYooooAKKKKACiiigDgq3a1680oA9UooooAKKKKACiiigAooooAKKKKACiiigAooooA56supq0KAN+iiigArymu5rm6ANGpK6yuIoA5yqNfNFfUlAHqNWq8wr0+gAooooAKKya82oA9frxmvTa4ygD0ulplPoAKKKKACiiigAooooAKKKKACiiigAooooA5CtOqNMoA62iiigDiazq62vM6AL1RV4pXq1AHTVtV2VY9AHl1e015tXpNABRRRQB5lW7W/XBUAQ1drs6fQAVo15TXq1ABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAGdXD16RXj1AHsVFNp1ABXm9ekUlAHkdaVdTXK0AdLXn1dlXY0AR1ZoooAKKKKACiiigAooooA87rqK1K8ioA9lopKWgAooooAKKKKACiiigAooooAKKKKACufroKKAPKa9NqhXDUAeo0V4lSUAe3UV4jRQB7dRXiNPoA9rorzmvQqAJKKKKACiiigAoorhqAO5rgK5SpqAPTa16gqegAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKzKhoA2aKxqKANmisaloAqVhV6BXmFAHp9FFFABRRRQAV5tXpNebUAdzWhWdWjQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAHPVVrq6KAOUorq6KAOUpa6qigArymvVq8hoA9eorma6WgBaKKKACvNq9JrzCgDvq0aq1aoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDh6y69MooA8zor0yigDzOn16TRQAlNp9FAHE1ydexUlAHnldfUdcxQBu1wtdTXX0AS0UUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBkVBRVagCzRVaigCzS1VpaAOmooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2QD/4gKwSUNDX1BST0ZJTEUAAQEAAAKgbGNtcwQwAABtbnRyUkdCIFhZWiAH5QAKAA4ADQARAARhY3NwTVNGVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMA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AyQUCGcGA8IGfGhaGC4uCz/8QAGxAAAwEBAAMAAAAAAAAAAAAAAgMEAQAFFBX/2gAIAQEAAQUC4q1ia6QaXVHoT2+U+a2ykSlEsMWLxq6ZmMZlO+nIrUo50YuYyVLS7//EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQMBAT8BB//EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQIBAT8BB//EACQQAAEDAwMEAwAAAAAAAAAAAAECERIAAyEEEDEiQVGBMlLC/9oACAEBAAY/AqKRJahzBJLVEOFfVQY7LKSymwfFW9Lp7Qu3cNafqUO59ck1aWlCpqE7eOC1BQLg5BpSFfFQY0JwuRwFHTk/qrlzEkSfw4oJJkecBhtIhHu2DUlWwT3Pnb//xAAgEAEAAQQCAgMAAAAAAAAAAAABEQAhMVFBYRBxgZHB/9oACAEBAAE/IaxBAPQlLHzTRIcy4tw5O/GL1NhsNZhAyk2p4HIc2WmGbZvuifeHpeJoAQoGEq9siDTUpHEik0oB9RHVWDjkHJT8oJcjgEswEsBO/Chldz9tKFUiDDTs6fH/2gAMAwEAAgADAAAAEIJIIIBIJP/EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQMBAT8QB//EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQIBAT8QB//EAB4QAQEAAwADAAMAAAAAAAAAAAERACExEEFRYYGh/9oACAEBAAE/EMoU0OuDEViMQx5h56r/ABBAiChFK98FM2uCKpHsUf1gSIHe1cgooUsaCfTysmjnYBkVdGEHaWjUFEfYmGyhpRhGJx33Gm/hPNjq1sNnDqV62lWugtzoJv3m1/E4XDE0AVA1CBhCIC6iT6OCx9qEvj/YPx4//9k=")}));
end iconTest;

Re: Bitmap in Icon

Looking at the extents in the annotation I can see that it should be vertically flipped. And I get the same behavior in OMEdit.
I even tested your model in Dymola and got the same output.

Here is the code where bitmap should be drawn without any vertical or horizontal flip,

Code:

model iconTest

equation

annotation(
    Icon(graphics = {Bitmap(extent = {{-100, -100}, {100, 100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REVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A9/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiqVAF2isekoA2aKyK0aAJqKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoornqANmuKrlq9GoA84rWr1GigDhKsV2dFAHndZNetUUAeP13ddBXKUAddTq8cr1ugCxRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFU6AMmuLqjXsFABUlFFABRRRQAUUUUAFFFFABRRRQBn15XXslZtAFqrFeQ169QAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFeWV6bXldAHo9adFFABRRTaAHUVylcrQB6rRXn9dxQBYooooAKKKKACiiigDgq3a1680oA9UooooAKKKKACiiigAooooAKKKKACiiigAooooA56supq0KAN+iiigArymu5rm6ANGpK6yuIoA5yqNfNFfUlAHqNWq8wr0+gAooooAKKya82oA9frxmvTa4ygD0ulplPoAKKKKACiiigAooooAKKKKACiiigAooooA5CtOqNMoA62iiigDiazq62vM6AL1RV4pXq1AHTVtV2VY9AHl1e015tXpNABRRRQB5lW7W/XBUAQ1drs6fQAVo15TXq1ABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAGdXD16RXj1AHsVFNp1ABXm9ekUlAHkdaVdTXK0AdLXn1dlXY0AR1ZoooAKKKKACiiigAooooA87rqK1K8ioA9lopKWgAooooAKKKKACiiigAooooAKKKKACufroKKAPKa9NqhXDUAeo0V4lSUAe3UV4jRQB7dRXiNPoA9rorzmvQqAJKKKKACiiigAoorhqAO5rgK5SpqAPTa16gqegAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKzKhoA2aKxqKANmisaloAqVhV6BXmFAHp9FFFABRRRQAV5tXpNebUAdzWhWdWjQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAHPVVrq6KAOUorq6KAOUpa6qigArymvVq8hoA9eorma6WgBaKKKACvNq9JrzCgDvq0aq1aoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDh6y69MooA8zor0yigDzOn16TRQAlNp9FAHE1ydexUlAHnldfUdcxQBu1wtdTXX0AS0UUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBkVBRVagCzRVaigCzS1VpaAOmooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2QD/4gKwSUNDX1BST0ZJTEUAAQEAAAKgbGNtcwQwAABtbnRyUkdCIFhZWiAH5QAKAA4ADQARAARhY3NwTVNGVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1kZXNjAAABIAAAAEBjcHJ0AAABYAAAADZ3dHB0AAABmAAAABRjaGFkAAABrAAAACxyWFlaAAAB2AAAABRiWFlaAAAB7AAAABRnWFlaAAACAAAAABRyVFJDAAACFAAAACBnVFJDAAACFAAAACBiVFJDAAACFAAAACBjaHJtAAACNAAAACRkbW5kAAACWAAAACRkbWRkAAACfAAAACRtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACQAAAAcAEcASQBNAFAAIABiAHUAaQBsAHQALQBpAG4AIABzAFIARwBCbWx1YwAAAAAAAAAB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FHTk/qrlzEkSfw4oJJkecBhtIhHu2DUlWwT3Pnb//xAAgEAEAAQQCAgMAAAAAAAAAAAABEQAhMVFBYRBxgZHB/9oACAEBAAE/IaxBAPQlLHzTRIcy4tw5O/GL1NhsNZhAyk2p4HIc2WmGbZvuifeHpeJoAQoGEq9siDTUpHEik0oB9RHVWDjkHJT8oJcjgEswEsBO/Chldz9tKFUiDDTs6fH/2gAMAwEAAgADAAAAEIJIIIBIJP/EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQMBAT8QB//EABQRAQAAAAAAAAAAAAAAAAAAAED/2gAIAQIBAT8QB//EAB4QAQEAAwADAAMAAAAAAAAAAAERACExEEFRYYGh/9oACAEBAAE/EMoU0OuDEViMQx5h56r/ABBAiChFK98FM2uCKpHsUf1gSIHe1cgooUsaCfTysmjnYBkVdGEHaWjUFEfYmGyhpRhGJx33Gm/hPNjq1sNnDqV62lWugtzoJv3m1/E4XDE0AVA1CBhCIC6iT6OCx9qEvj/YPx4//9k=")}));
end iconTest;

Adeel.

Re: Bitmap in Icon

Thanks! True. So I guess you need to update the Bitmap tool in OMEdit to make sure bitmaps are stored with correct orientation in future versions.

There are 0 guests and 0 other users also viewing this topic