Problem with Plotmetrics

Found a bug? Tell us about it here

Moderator: DPlotAdmin

Post Reply
coylen
Posts: 1
Joined: Fri Mar 13, 2009 5:49 am

Problem with Plotmetrics

Post by coylen »

I have had a look round the forum and can't find any previous posts of this problem, my appologies if it is already elsewhere.

I have been interfacing with dplot using the dplotlib to achieve some graphing functions with VB.net 2008. I have been using the DPLOT_GetBitmapEx function and have noticed a strange anomoly.

It would appear that when the bitmap requested becomes small that the program whilst retruning the requested sized bitmap does not provide the correct metrics as it changes the bitmap from being one drawn at the requested size to one that is generated at the default size and then scaled to the requested size.

In way of example when i request a 310×344 bitmap the retuned metrics are:
hll=55
vll=300
hur=292
vur=34

whereas a small chane in requested size 265×344 returns:

hll=55
vll=644
hur=512
vur=34

given the rest of the information returned i cannot find the size of the plot on which the metrics are based and therefore cannot work out how to scale the metrics to suit the retruned bitmap.

Am I doing something stupid?
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

No, you aren't doing anything stupid. The bitmap scaling was added fairly recently and I didn't think to update the "metrics" values. I'll spend some time on this over the weekend. Off the top of my head... if the requested width or height are less than 300 pixels then both are both multiplied by whatever power of 2 makes them > 300. So dividing hll, vll, etc. by that same scale factor should give you the correct answers. One obvious problem is that the result often won't be a whole number. So whatever you're doing with those values may be off by 1 pixel.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Fixed in version 2.2.3.4
Bug fix: Starting with version 2.2.2.7, if a bitmap was requested with width or height less than 300 pixels, then DPlot multiplies those values by whatever power of 2 achieves a width and height > 300, then resizes the bitmap by that same scale factor. This all works well, but the associated DPLOT_PLOTMETRICS values obtained with DPlot_GetBitmapEx were those for the larger bitmap, not the bitmap returned. This made it impossible to scale mouse position to plot space (unless, of course, your program knew the scale factor used by DPlot).
Visualize Your Data
support@dplot.com
Post Reply