Backgrounds

The following routines can be used to create new backgrounds and to remove them.
background_duplicate(ind) Creates a duplicate of the background with the given index. It returns the index of the new background. When an error occurs -1 is returned.
background_assign(ind,back) Assigns the indicated background to background ind. So this makes a copy of the background.
background_add(fname,transparent,smooth,preload) Adds the image stored in the file fname to the set of background resources. Many different types of images can be dealt with. transparent indicates whether the image is partially transparent. smooth indicates whether to smooth the edges. preload indicates whether to preload the image into texture memory. The function returns the index of the new background that you can then use to draw it or to assign it to the variable background_index[0] to make it visible in the current room. When an error occurs -1 is returned.
background_add_alpha(fname,preload) Adds the image stored in the file fname to the set of background resources, but this time the file has an alpha channel to indicate transparency (as for example in .png files). The arguments are the same as above (but two are missing as they are not relevant in this case). When an error occurs -1 is returned.
background_replace(ind,fname,transparent,smooth,preload) Same as above but in this case the background with index ind is replaced. The function returns whether it is successful. When the background is currently visible in the room it wil be replaced also.
background_replace_alpha(ind,fname,preload) Same as above but in this case the file has an alpha channel.
background_create_color(w,h,col,preload) Creates a background of the given size and with the given color. It returns the index of the new background. When an error occurs -1 is returned.
background_create_gradient(w,h,col1,col2,kind,preload) Creates a gradient filled background of the given size. col1 and col2 indicate the two colors. kind is a number between 0 and 5 indicating the kind of gradient: 0=horizontal 1=vertical, 2= rectangle, 3=ellipse, 4=double horizontal, 5=double vertical. It returns the index of the new background. When an error occurs -1 is returned.
background_create_from_screen(x,y,w,h,transparent,smooth,preload) Creates a background by copying the given area from the screen. This makes it possible to create any background you want. Draw the image on the screen using the drawing functions and next create a background from it. (If you don't do this in the drawing event you can even do it in such a way that it is not visible on the screen by not refreshing the screen.) The other parameters are as above. The function returns the index of the new background. A work of caution is required here. Even though we speak about the screen, it is actually the drawing region that matters. The fact that there is a window on the screen and that the image might be scaled in this window does not matter.
background_create_from_surface(id,x,y,w,h,transparent,smooth,preload) Creates a background by copying the given area from the surface with the given id. This makes it possible to create any background you want. Draw the image on the surface using the drawing functions and next create a background from it. Note that alpha values are maintained the background.
background_delete(ind) Deletes the background from memory, freeing the memory used.

The following routine exists to change the appearance of a background.

background_set_alpha_from_background(ind,back) Changes the alpha (transparancy) values in the background with index ind using the intensity values in the background back. This cannot be undone.
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)