Bug 421383 - Graphics Scaling issues on high DPI displays
Capture the the design discussion for the Bug 421383
New Api changes
The following api needs to modified
Point Device.getDpi() - This api is currently used by printing functionality this will be extended to displays so that it return pixels per inch in each direction. this will be added to Monitor class as well.
Additional changes in Monitor class a new attribute Point dpi will be added to Monitor class and getDPI() will return this attribute. this will be calculated per Monitor and held in this object
Image class modifications.
The image data is held through NSimage in Cocoa, Image handle in Windows, pixmap resource in GTK+2 and Cairo surface for GTK+3. Now this particular structure needs to modified to hold multiple entries to these along with their size. Preferable datastructure Map
Image(Device, String filename) constructer will be modified to search for all images in that location and add to Image data list. here is the example on how this works. if the file name provided is /home/eclipse/plugins/images/eclipse_icon.png. This constructor will look for files /home/eclipse/plugins/images/eclipse_icon.png and /home/eclipse/plugins/images/eclipse_icon@*x.png. This way it can get the file names eclipse_icon.png, eclipse_icon_2x.png etc. These will be added to Image data list.
A new constructor
Image(Device, List filenames) will be provided so that user can provide the image names in a list. but I am assuming this may not be used that much.
a new set of apis will be will be provided.
Image.addRepresentation(Image) Image.addRepresentation(ImageData) Image.addRepresentation(InputStream) Image.addRepresentation(Filename) - this case we will not search for multiple entries(multiple image search is provide only through constructor) Image.getImageData() - will return the Image data for the first Image. in case of Icons it will be 16X16.
Image.getImageData(int size) - will return Imagedata specified for sizeXsize if found else null. Null check is required.
1. Multiple images are used to represent the icons only and they will not be used for other images like splash screen etc.