When setting a wallpaper you can choose from tile, zoom, center, scale, fill or span options. What do they mean?
How scale option is different from zoom and span? I can't see the difference on any of my wallpapers.
12.04backgroundgnomeunitywallpaper
When setting a wallpaper you can choose from tile, zoom, center, scale, fill or span options. What do they mean?
How scale option is different from zoom and span? I can't see the difference on any of my wallpapers.
Best Answer
To understand the intricacies of the various options available, its worth just having a little dig around in the source-code to see what happens with each option. I'll try my best to put this is simply as possible, but with the caveat - you need to enjoy a bit of mathematics!
Lets grab the source-code:
Now open the following source-module with your favourite text editor:
There are two key functions to examine:
get_scaled_pixbuf
and the function:
draw_image_area
This is described by the case option
G_DESKTOP_BACKGROUND_STYLE_SPANNED
The wallpaper (pixbuf) is first scaled to the area to be filled (pixbuf_scale_to_fit) i.e. take the original wallpaper and expand its width and height to match the area.
It uses the following algorithm to expand:
src_ is the wallpaper dimension width or height, whereas max_ is the area dimension width or height
Quite a complicated algorithm as you can see, but basically it tries to see what is the minimum dimension that needs to be expanded before scaling both dimensions linearly by the same factor it has calculated.
This area is the combined area of your monitor or monitors.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the whole area.
This is described by the case option
G_DESKTOP_BACKGROUND_STYLE_SCALED
As you can see in the source code, its very similar to SPAN. It uses the same algorithm to scale the picture as SPAN.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
This is described by the case option
G_DESKTOP_BACKGROUND_ZOOM
The wallpaper (pixbuf) is first scaled to the area to be filled (pixbuf_scale_to_min) i.e. take the original wallpaper and expand its width and height to match the area.
It uses the following algorithm to expand:
src_ is the wallpaper dimension width or height, whereas max_ is the area dimension width or height*
Notice the subtle difference than the previous two options - it calculates the maximum dimension that needs to be expanded before scaling both dimensions linearly by the same factor it has calculated.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
This is described by the case option
G_DESKTOP_BACKGROUND_STRETCHED
The wallpaper (pixbuf) is expanded both width-wise and height-wise to the area - thus you can get a distortion if your wallpaper is not the exact dimensions of the wallpaper
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
This is described by the case option
G_DESKTOP_BACKGROUND_CENTRED
The wallpaper (pixbuf) is actually clipped to size if its too large to fit the area i.e. the the width is reduced to the area width and the height is reduced to the area height.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually. The resulting image is then drawn into the center of the overall area of the monitor.
This is described by the case option
G_DESKTOP_BACKGROUND_WALLPAPER
The wallpaper (pixbuf) is similarly clipped as the Center option.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually. The resulting image is copied repeatedly starting in one corner filling the overall area with each image i.e. tiled width-wise and height-wise.