Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap object size does not behave as expected #65

Open
kociak opened this issue Dec 19, 2022 · 0 comments
Open

Bitmap object size does not behave as expected #65

kociak opened this issue Dec 19, 2022 · 0 comments

Comments

@kociak
Copy link

kociak commented Dec 19, 2022

I am using a Bitmap object and it seemed to work until I used some .pngwith alpha layer to 0. Then I understood that there was an ambiguity in the dimensions definitions, which are obvious with a transparent layer.
The image is a file with a given dimension (say, for a square, an edge of size Fsize in pixels). Then the bitmap has another dimension, (shape), say Bitsize. Finally, the button has also another size (Butsize, specified by parameters widthand height).
If Bitsize << Butsize, then a square is drawn around the button, the image might be too small but everything seems fine. If Bitsize = Butsize, the image appears larger than the button (we can see the frame of the button being smaller than the image), with potential overlap between the images of different buttons. Buttons clickable area is within the frame, as expected.
I don't think Fsize affects anything.
I am wondering if this is an expected behaviour, but I doubt...

Here is an example code:

self.StageSafeIcon=Bitmap.Bitmap(rgba_bitmap_data=CanvasItem.load_rgba_data_from_bytes(pkgutil.get_data(__name__, "resources/StageSafe.png"), "png"),
                      shape=Geometry.IntSize(42, 42))
        self.StageFocusIcon = Bitmap.Bitmap(rgba_bitmap_data=CanvasItem.load_rgba_data_from_bytes(pkgutil.get_data(__name__, "resources/StageFocus.png"), "png"),
                      shape=Geometry.IntSize(42, 42))

self.StageFocusSShftZ = ui.create_push_button( name="StageFocusSShftZ_pb",icon='StageFocusIcon', on_clicked="StageFocusSShftZ",width = 42, height = 42)
            self.StageSafeSShftZ = ui.create_push_button( name="StageSafeSShftZ_pb", icon = 'StageSafeIcon', width = 42, height = 42,
                                                          on_clicked="StageSafeSShftZ")
@kociak kociak changed the title Bitmap object size does not behaves as expected Bitmap object size does not behave as expected Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant