Unit alBlend

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Truecolor transparency.

In truecolor video modes, translucency and lighting are implemented by a blender function of the form:

       FUNCTION AL_BLENDER_FUNC (x, y, n: AL_ULONG): AL_ULONG; CDECL;
  

For each pixel to be drawn, this routine is passed two color parameters x and y, decomposes them into their red, green and blue components, combines them according to some mathematical transformation involving the interpolation factor n, and then merges the result back into a single return color value, which will be used to draw the pixel onto the destination bitmap.

The parameter x represents the blending modifier color and the parameter y represents the base color to be modified. The interpolation factor n is in the range [0..255] and controls the solidity of the blending.

When a translucent drawing function is used, x is the color of the source, y is the color of the bitmap being drawn onto and n is the alpha level that was passed to the function that sets the blending mode (the RGB triplet that was passed to this function is not taken into account).

When a lit sprite drawing function is used, x is the color represented by the RGB triplet that was passed to the function that sets the blending mode (the alpha level that was passed to this function is not taken into account), y is the color of the sprite and n is the alpha level that was passed to the drawing function itself.

Since these routines may be used from various different color depths, there are three such callbacks, one for use with 15-bit 5.5.5 pixels, one for 16 bit 5.6.5 pixels, and one for 24-bit 8.8.8 pixels (this can be shared between the 24 and 32-bit code since the bit packing is the same).

Overview

Functions and Procedures

PROCEDURE al_set_blender_mode (b15, b16, b24: AL_BLENDER_FUNC; r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_blender_mode';
PROCEDURE al_set_blender_mode_ex (b15, b16, b24, b32, b15x, b16x, b24x: AL_BLENDER_FUNC; r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_blender_mode_ex';
PROCEDURE al_set_alpha_blender; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_alpha_blender';
PROCEDURE al_set_write_alpha_blender; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_write_alpha_blender';
PROCEDURE al_set_trans_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_trans_blender';
PROCEDURE al_set_add_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_add_blender';
PROCEDURE al_set_burn_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_burn_blender';
PROCEDURE al_set_color_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_color_blender';
PROCEDURE al_set_difference_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_difference_blender';
PROCEDURE al_set_dissolve_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_dissolve_blender';
PROCEDURE al_set_dodge_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_dodge_blender';
PROCEDURE al_set_hue_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_hue_blender';
PROCEDURE al_set_invert_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_invert_blender';
PROCEDURE al_set_luminance_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_luminance_blender';
PROCEDURE al_set_multiply_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_multiply_blender';
PROCEDURE al_set_saturation_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_saturation_blender';
PROCEDURE al_set_screen_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_screen_blender';

Types

AL_BLENDER_FUNC = FUNCTION (x, y, n: AL_ULONG): AL_ULONG; CDECL;

Description

Functions and Procedures

PROCEDURE al_set_blender_mode (b15, b16, b24: AL_BLENDER_FUNC; r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_blender_mode';

Specifies a custom set of truecolor blender routines, which can be used to implement whatever special interpolation modes you need. This function shares a single blender between the 24 and 32-bit modes.

See also
al_set_blender_mode_ex
Like al_set_blender_mode, but allows you to specify a more complete set of blender routines.
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_color_map
Clolor map.
al_draw_trans_sprite
Uses the global al_color_table table or truecolor blender functions to overlay the sprite on top of the existing image.
al_draw_lit_sprite
In 256-color modes, uses the global al_color_table table to tint the sprite image to the specified color or to light it to the level specified by 'color', depending on the function which was used to build the table (al_create_trans_table or al_create_light_table), and draws the resulting image to the destination bitmap.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_blender_mode_ex (b15, b16, b24, b32, b15x, b16x, b24x: AL_BLENDER_FUNC; r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_blender_mode_ex';

Like al_set_blender_mode, but allows you to specify a more complete set of blender routines. The b15, b16, b24, and b32 routines are used when drawing pixels onto destinations of the same format, while b15x, b16x, and b24x are used by al_draw_trans_sprite and al_draw_trans_rle_sprite when drawing RGBA images onto destination bitmaps of another format. These blenders will be passed a 32-bit x parameter, along with a y value of a different color depth, and must try to do something sensible in response.

See also
al_set_alpha_blender
Enables the special alpha-channel blending mode, which is used for drawing 32-bit RGBA sprites.
PROCEDURE al_set_alpha_blender; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_alpha_blender';

Enables the special alpha-channel blending mode, which is used for drawing 32-bit RGBA sprites. After calling this function, you can use al_draw_trans_sprite or al_draw_trans_rle_sprite to draw a 32-bit source image onto any hicolor or truecolor destination. The alpha values will be taken directly from the source graphic, so you can vary the solidity of each part of the image. You can't use any of the normal translucency functions while this mode is active, though, so you should reset to one of the normal blender modes (eg. al_set_trans_blender) before drawing anything other than 32-bit RGBA sprites.

See also
al_set_write_alpha_blender
Enables the special alpha-channel editing mode, which is used for drawing alpha channels over the top of an existing 32-bit RGB sprite, to turn it into an RGBA format image.
PROCEDURE al_set_write_alpha_blender; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_write_alpha_blender';

Enables the special alpha-channel editing mode, which is used for drawing alpha channels over the top of an existing 32-bit RGB sprite, to turn it into an RGBA format image. After calling this function, you can set the drawing mode to AL_DRAW_MODE_TRANS and then write draw color values (0-255) onto a 32-bit image. This will leave the color values unchanged, but alter the alpha to whatever values you are writing. After enabling this mode you can also use al_draw_trans_sprite to superimpose an 8-bit alpha mask over the top of an existing 32-bit sprite.

See also
al_set_alpha_blender
Enables the special alpha-channel blending mode, which is used for drawing 32-bit RGBA sprites.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_trans_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_trans_blender';

Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.

See also
al_set_blender_mode
Specifies a custom set of truecolor blender routines, which can be used to implement whatever special interpolation modes you need.
al_set_alpha_blender
Enables the special alpha-channel blending mode, which is used for drawing 32-bit RGBA sprites.
al_set_write_alpha_blender
Enables the special alpha-channel editing mode, which is used for drawing alpha channels over the top of an existing 32-bit RGB sprite, to turn it into an RGBA format image.
al_color_map
Clolor map.
al_draw_trans_sprite
Uses the global al_color_table table or truecolor blender functions to overlay the sprite on top of the existing image.
al_draw_lit_sprite
In 256-color modes, uses the global al_color_table table to tint the sprite image to the specified color or to light it to the level specified by 'color', depending on the function which was used to build the table (al_create_trans_table or al_create_light_table), and draws the resulting image to the destination bitmap.
al_drawing_mode
Sets the graphics drawing mode.
al_set_add_blender
Enables an additive blender mode for combining translucent or lit truecolor pixels.
al_set_burn_blender
Enables a burn blender mode for combining translucent or lit truecolor pixels.
al_set_color_blender
Enables a color blender mode for combining translucent or lit truecolor pixels.
al_set_difference_blender
Enables a difference blender mode for combining translucent or lit truecolor pixels.
al_set_dissolve_blender
Enables a dissolve blender mode for combining translucent or lit truecolor pixels.
al_set_dodge_blender
Enables a dodge blender mode for combining translucent or lit truecolor pixels.
al_set_hue_blender
Enables a hue blender mode for combining translucent or lit truecolor pixels.
al_set_invert_blender
Enables an invert blender mode for combining translucent or lit truecolor pixels.
al_set_luminance_blender
Enables a luminance blender mode for combining translucent or lit truecolor pixels.
al_set_multiply_blender
Enables a multiply blender mode for combining translucent or lit truecolor pixels.
al_set_saturation_blender
Enables a saturation blender mode for combining translucent or lit truecolor pixels.
al_set_screen_blender
Enables a screen blender mode for combining translucent or lit truecolor pixels.
PROCEDURE al_set_add_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_add_blender';

Enables an additive blender mode for combining translucent or lit truecolor pixels.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_burn_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_burn_blender';

Enables a burn blender mode for combining translucent or lit truecolor pixels. Here the lightness values of the colours of the source image reduce the lightness of the destination image, darkening the image.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_color_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_color_blender';

Enables a color blender mode for combining translucent or lit truecolor pixels. Applies only the hue and saturation of the source image to the destination image. The luminance of the destination image is not affected.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_difference_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_difference_blender';

Enables a difference blender mode for combining translucent or lit truecolor pixels. This makes an image which has colours calculated by the difference between the source and destination colours.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_dissolve_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_dissolve_blender';

Enables a dissolve blender mode for combining translucent or lit truecolor pixels. Randomly replaces the colours of some pixels in the destination image with those of the source image. The number of pixels replaced depends on the alpha value (higher value, more pixels replaced; you get the idea :).

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_dodge_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_dodge_blender';

Enables a dodge blender mode for combining translucent or lit truecolor pixels. The lightness of colours in the source lighten the colours of the destination. White has the most effect; black has none.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_hue_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_hue_blender';

Enables a hue blender mode for combining translucent or lit truecolor pixels. This applies the hue of the source to the destination.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_invert_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_invert_blender';

Enables an invert blender mode for combining translucent or lit truecolor pixels. Blends the inverse (or negative) colour of the source with the destination.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_luminance_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_luminance_blender';

Enables a luminance blender mode for combining translucent or lit truecolor pixels. Applies the luminance of the source to the destination. The colour of the destination is not affected.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_multiply_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_multiply_blender';

Enables a multiply blender mode for combining translucent or lit truecolor pixels. Combines the source and destination images, multiplying the colours to produce a darker colour. If a colour is multiplied by white it remains unchanged; when multiplied by black it also becomes black.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_saturation_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_saturation_blender';

Enables a saturation blender mode for combining translucent or lit truecolor pixels. Applies the saturation of the source to the destination image.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.
PROCEDURE al_set_screen_blender (r, g, b, a: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_screen_blender';

Enables a screen blender mode for combining translucent or lit truecolor pixels. This blender mode lightens the colour of the destination image by multiplying the inverse of the source and destination colours. Sort of like the opposite of the multiply blender mode.

See also
al_set_trans_blender
Enables a linear interpolator blender mode for combining translucent or lit truecolor pixels.
al_drawing_mode
Sets the graphics drawing mode.

Types

AL_BLENDER_FUNC = FUNCTION (x, y, n: AL_ULONG): AL_ULONG; CDECL;

See also
alblend
Truecolor transparency.
al_set_blender_mode
Specifies a custom set of truecolor blender routines, which can be used to implement whatever special interpolation modes you need.
al_set_blender_mode_ex
Like al_set_blender_mode, but allows you to specify a more complete set of blender routines.

Generated by PasDoc 0.13.0 on 2016-07-20 12:01:35