The other day I was trying to figure out the pixel DPI on my
map_view
so that I could size a raster_image on the map. I had always thought that
!window_system!.screen_resolution()
would do that for me. It seemed to work as long as I put in some additional empirical fudge factor. I discovered later that if I am working with
map_view
, I can use
map_view.pixel_size
to calculate DPI.
map_view.pixel_size
returns the size of a pixel in millimetres so to convert that to DPI...
_method map_view.if!dpi
## if!dpi : integer
##
## returns _self's DPI
_return (1/_self.pixel_size) * 25.4
_endmethod
No comments:
Post a Comment