Skip to main content

OH_Drawing_ShaderEffectCreateSweepGradient

Function OH_Drawing_ShaderEffectCreateSweepGradient 

Source
pub unsafe extern "C" fn OH_Drawing_ShaderEffectCreateSweepGradient(
    centerPt: *const OH_Drawing_Point,
    colors: *const u32,
    pos: *const f32,
    size: u32,
    tileMode: OH_Drawing_TileMode,
) -> *mut OH_Drawing_ShaderEffect
Expand description

@brief Creates an OH_Drawing_ShaderEffect object that generates a sweep gradient based on the center. A sweep gradient paints a gradient in a sweeping arc ranging from 0° to 360°. This API may return an error code. For details, call {@link OH_Drawing_ErrorCodeGet}. If either centerPt or colors is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If tileMode is not set to one of the enumerated values, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.

@param centerPt Center of the circle. @param colors Colors to distribute between the two points. @param pos Relative position of each color in the color array. The array length must be the same as that of *colors *. If pos is NULL, colors are evenly distributed between the start angle (0°) and end angle (360°). @param size Number of colors and positions (if pos is not NULL). @param tileMode Tile mode of the shader effect. For details about the available options, see {@link OH_Drawing_TileMode} . @return Returns the pointer to the {@link OH_Drawing_ShaderEffect} object created. A null pointer is returned if any of the following conditions is met:

  • The available memory is empty.
  • centerPt or colors is NULL.
  • The value of tileMode is out of the enumerated value range. @since 11 @version 1.0