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

Add BitMap methods for bitwise boolean operations #91093

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

basilicon
Copy link

@basilicon basilicon commented Apr 24, 2024

Created methods for BitMap for boolean operators AND, OR, XOR, and NOT.

The methods for the binary operators (AND, OR, XOR) all have a parameter "other" for the secondary bitmap (the one being compared to). Additionally, there is a BitwiseSizeMode enum which controls the size of the new bitmap being made, in the case that the bitmaps are not the same size. The method bitwise_not is unary, and thus does not have any parameters.

This is an uninstrusive QOL change for handling bitmaps. Combining and operating on bitmaps is a common operation in many games that use them. I, for one, am working on a puzzle game where geometry is generated from bitmaps you edit. Ordinarily, comparing two bitmaps can be tedious, usually involving some sort of nested double for loop. This can obviously bloat your game's codebase. The new methods in this PR will make combining bitmaps much simpler for developers.

@basilicon basilicon requested a review from a team as a code owner April 24, 2024 01:21
@dalexeev dalexeev added this to the 4.x milestone Apr 24, 2024
@AThousandShips AThousandShips changed the title Created BitMap methods for bitwise boolean operations Add BitMap methods for bitwise boolean operations Apr 24, 2024
doc/classes/BitMap.xml Outdated Show resolved Hide resolved
@Calinou

This comment was marked as resolved.

@basilicon
Copy link
Author

Alright, I just opened a proposal and linked this PR. Sorry; it's my first time committing to this engine; I've worked on another engine before but it was niche and the organizer could personally review each PR.
I have no idea what is going on with these failed test cases. None of them seem relevant to BitMap, which is the only thing which I've changed.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, useful

scene/resources/bit_map.h Outdated Show resolved Hide resolved
scene/resources/bit_map.cpp Outdated Show resolved Hide resolved
scene/resources/bit_map.cpp Outdated Show resolved Hide resolved
scene/resources/bit_map.cpp Outdated Show resolved Hide resolved
scene/resources/bit_map.cpp Outdated Show resolved Hide resolved
basilicon and others added 2 commits April 27, 2024 14:46
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add BitMap methods for bitwise boolean operations
5 participants