Skip to content

NonUniformImage: implement floating point boundingRect#2587

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:nonuniformimage-databounds
Jan 21, 2023
Merged

NonUniformImage: implement floating point boundingRect#2587
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:nonuniformimage-databounds

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Jan 14, 2023

using QPicture.boundingRect() to compute boundingRect() has issues, which includes rounding the values to the next integral value.

The data bounds are easily computed. The bulk of the code deals with handling the optional border rectangle.

@pijyoi
Copy link
Copy Markdown
Contributor Author

pijyoi commented Jan 15, 2023

Note: ImageItem's boundingRect() does not take into account the pen width of the optional border. Probably the border is not often used.

@pijyoi pijyoi force-pushed the nonuniformimage-databounds branch from 3040b41 to b9f7d55 Compare January 19, 2023 12:55
@pijyoi pijyoi force-pushed the nonuniformimage-databounds branch from b9f7d55 to b6dbb8f Compare January 21, 2023 01:45
@pijyoi pijyoi changed the title NonUniformImage: implement dataBounds and pixelPadding NonUniformImage: implement floating point boundingRect Jan 21, 2023
@pijyoi
Copy link
Copy Markdown
Contributor Author

pijyoi commented Jan 21, 2023

I am reducing the scope of this PR. Only boundingRect() will be implemented in terms of the data coordinates.

We can cross the bridge of the border pen width when we get there.
Given that ImageItem:

  • also has this issue
  • is much more used
  • has no issue being raised about it

there's no point complicating this PR at this point of time.

A simple way to test the effects of this PR is by modifying examples/NonUniformImage.py. By scaling the variables tau and w to be less than 1, you will be able to see that master does not range the item properly.

@pijyoi pijyoi marked this pull request as ready for review January 21, 2023 01:57
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Jan 21, 2023

Hi @pijyoi

Thanks for the PR, I'm good w/ limiting the scope. LGTM, merging!

@j9ac9k j9ac9k merged commit 96f68d1 into pyqtgraph:master Jan 21, 2023
@pijyoi pijyoi deleted the nonuniformimage-databounds branch January 21, 2023 03:53
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

Successfully merging this pull request may close these issues.

2 participants