Ok, well, managed to do it based 
on 
https://stackoverflow.com/questions/4763992/finding-out-what-portion-of-a-qgraphicsitem-is-visible-in-a-qgraphicsview#

FYI, this gives a visible rectangle inside an imageitem, in its coordinates:

            view = self.getViewBox().getViewWidget()
            portRect = view.viewport().rect()
            sceneRect = view.mapToScene(portRect).boundingRect()
            itemRect = self.mapRectFromScene(sceneRect)
            isec = itemRect.intersected(self.boundingRect())


Kuba

On Friday, December 15, 2017 at 4:10:09 PM UTC+1, Kuba Raczkowski wrote:
>
> Hi,
>
> I'm trying to annotate the ImageItem's pixels by a textual value on top of 
> every pixel. 
> Got it working by extending the paint() and adding necessary drawText() 
> calls, however, the performance is (obviously?) terrible.
>
> This is only meant to be useful when zooming in deeply - that I can 
> treshold by figuring out pixelSize() of ImageItem.
>
> However, all labels seem to be painted even if only a few pixels are 
> visible in the view. 
> Any idea how to figure out the pixels (or a rectangle) that are actually 
> visible in the view? I'm getting lost in all the coordinate mappings :/
>
>
> Best regards,
> Kuba
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/8a620fae-e972-4761-89da-25bf2490d095%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to