Skip to content

shape_combine definition is invalid - TypeError: Missing required argument destination_window #262

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

Open
acidkewpie opened this issue Mar 15, 2023 · 0 comments

Comments

@acidkewpie
Copy link

acidkewpie commented Mar 15, 2023

I thought I was missing something, but it's looking like no one has EVER used shape_combine, but the definition of the function does not attempt to create the object with the required destination_window parameter:

class Combine(rq.Request):

    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(3),
        rq.RequestLength(),
        OP('operation'),
        KIND('destination_kind'),
        KIND('source_kind'),
        rq.Pad(1),
        rq.Window('destination_window'),
        rq.Int16('x_offset'),
        rq.Int16('y_offset'),
        rq.Window('source_window'),
    )
[...]
def combine(self, operation, destination_kind, source_kind, x_offset, y_offset):
    Combine(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        source_window=self,
        operation=operation,
        destination_kind=destination_kind,
        source_kind=source_kind,
        x_offset=x_offset,
        y_offset=y_offset,
    )

shape_mask is, in believe, only different from shape_combine in that it takes in a window of varying colour depth, instead of a binary bitmap. As such the parameters should be identical except the source_bitmap parameter in shape_mask should instead be the source_kind option (present) and source_window (missing!) in shape_combine. mask is defined as:

def mask(self, operation, destination_kind, x_offset, y_offset, source_bitmap):
    Mask(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        destination_window=self,
        operation=operation,
        destination_kind=destination_kind,
        x_offset=x_offset,
        y_offset=y_offset,
        source_bitmap=source_bitmap,
    )

so combine should actually be defined as:

def combine(self, operation, destination_kind, source_kind, x_offset, y_offset):
    Combine(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        source_window=source_window
        destination_window=self,
        operation=operation,
        destination_kind=destination_kind,
        source_kind=source_kind,
        x_offset=x_offset,
        y_offset=y_offset,
        source_window=source_window
    )

Indeed it seems that parameters for source and destination windows have in fact been... wait for it... combined!

#263

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