Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

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. so these will be held in an array so that these image representations could be held. Currently we are planning for images for 3 dpi values 100%, 150% and 200% The image selection will be according to the following table. This calculated based on the 100% correspond to 96 in Windows and Linux and 72 for Mac link

Icon Size Windows Linux(GTK) Mac
100% 16X16 0-143 0-143 0-107
150% 24X24 144-191 144-191 108-143
200% 32X32 >191 >191 >144


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. Assumption: The image file name passed is assumed to be at 100% zoom level.

A new constructor

Image(Device, String[] 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. here the the images are in the order of 100%,150% and 200%.

a new set of apis will be will be provided.

Image.addRepresentation(Image, int zoomLevel)-The zoom level will be defaulted to 100% Image.addRepresentation(ImageData, int zoomLevel) -The zoom level will be defaulted to 100% Image.addRepresentation(InputStream, int zoomLevel)-The zoom level will be defaulted to 100% Image.addRepresentation(Filename, int zoomLevel) - 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 zoom level 100%. in case of Icons it will be 16X16. Image.getImageData(int zoomLevel) - will return Imagedata specified for zoomLevel if found else null. Null check is required. Image.getDefaultImageData() - will return the Image data for the monitor currenlty selected(based on the dpi of the monitor).

Back to the top