draw_surface_general

Draws part of a surface at a given position with scaling, rotating, four-corner blending and alpha options.

Syntax:

GML Code Example

draw_surface_general(id, left, top, width, height, x, y, xscale, yscale, rot, c1, c2, c3, c4, alpha);


Argument Description
index The index of the surface to draw.
left The left position in the surface of the part to be drawn.
top The top position in the surface of the part to be drawn.
width The width of the part to be draw, from left.
height The height of the part to be draw, from top.
x The x position of where to draw the surface.
y The y position of where to draw the surface.
xscale The horizontal scaling to draw the surface with.
yscale The vertical scaling to draw the surface with.
rot The rotation or angle to draw the surface with.
c1 The colour of the top left corner of the surface.
c2 The colour of the top right corner of the surface.
c3 The colour of the bottom right corner of the surface.
c4 The colour of the bottom left corner of the surface.
alpha The alpha transparency to draw the surface with..


Returns: N/A


Description

This function combines the function draw_surface_ext with the function draw_surface_part, adding in some additional blending options so that each corner of the final surface part can be blended with an individual colour.

NOTE: Gradient blending is not available for the HTML5 target unless WebGL is enabled.

NOTE: When working with surfaces there is the possibility that they can cease to exist at any time due to them being stored in texture memory. You should ALWAYS check that a surface exists using surface_exists before referencing them directly. For further information see Surfaces.


Example:

GML Code Example

draw_surface_general(surf, 8, 8, 32, 32, x, y, 2, 0.5, 180, c_white, c_white, c_black, c_black, 1);

This will draw a 32x32 pixel area from 8x8 pixels into the surface. It will be stretched to double its usual width but half its usual height. It will be opaque, and upside down. The top area of the surface will be blended white and hence normal, but the bottom area will be black, meaning the surface will go from normal to silhouette downwards in a smooth gradient.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here