Hi,

Say I have 2D data array (x*y) = (2000*2000) in QwtMatrixRasterData with setInterval( Qt::XAxis, QwtInterval( 0, 2000, QwtInterval::ExcludeMaximum)) and same for YAxis.

When the ResampleMode == NearestNeighbour (default) in QwtMatrixRasterData, then the default QwtMatrixRasterData:ixelHint is returning :

rect = QRectF( intervalX.minValue(), intervalY.minValue(), d_data->dx, d_data->dy );

#1. If I zoom in a lot and want to display in plot coordinate the part (X,Y,W,H)= (500,500,3,3), this will have the nice effect of calling QwtMatrixRasterData::value( double x, double y ) only 9 times (from what I understand) independently of the image size displayed on screen. Thus initRaster would return me area x=500 y=500 w=3 h=3 and imgSize w=3 h=3. Perfect.

#2. Now if I zoom out a lot, to display the whole 2D array i.e in plot coordinate the part (X,Y,W,H)= (0,0,2000,2000), on a very small rendered screen area that is say only 20 pixels by 20 pixels, the rendering will happen in 2000x2000 instead of 20 by 20 pixels, because pixelHint is not set to render in target device ( f.e. screen ) resolution. This is normal. That means that initRaster would return area x=0 y=0 w=2000 h=2000 and imgSize w=2000 h=2000. The lag will be terrible.

The question is, when I fall in case #2 when I zoom out a lot, (so when the screen resolution is smaller than the area resolution to be displayed) then I want to change pixelHint and set it to null so it renders in screen resolution. What would be a proper implementation of PixelHint in this case? Note that always configuring PixelHint in screen resolution (null QRectF) would have the exact opposite behavior of rendering only a few pixels when we zoom out a lot but rendering all the pixels if we zoom in a lot even to display an area of 1 by 1 in plot coordinate (which makes no sense if we are in NearestNeighbour mode). So this has to be an adaptive PixelHint.

A partial answer to this issue is that I guess we'd need to know the size of the image in screen resolution in pixelHint and compare it against the area covered in plot coordinate, and then set pixelHint to null when the (area width in plot coordinate is > screen resolution width) && (area height in plot coordinate is > screen resolution height ) ?

Thanks!

M.Klein