CRdraw_texture: Copies texture.

View source: R/CRdraw_texture.R

CRdraw_textureR Documentation

Copies texture.

Description

Copies a texture to rendering target. See CRcreate_texture for more info on textures. CRdraw_texture can copy the entire texture or parts of it (specified in argument texture_rect), can fill the entire rendering target or parts of it (argument target_rect), can rotate the texture before copying (argument angle). Rotation happens around the point specified in center_point.

Usage

CRdraw_texture(graphics_list, texture_list, index, texture_rect = list(), target_rect = list(), angle = 0, center_point = list(), status = NULL)

Arguments

graphics_list

List containing pointers to window, renderer etc. created with CRopen.

texture_list

List containing texture to be rendered. Texture first created with CRcreate_texture.

index

Index of texture to be rendered in texture_list.

texture_rect

List defining rectangle of texture to be drawn (contains elements x, y, w, h; default: whole texture).

target_rect

List defining where on renderer to draw texture (contains elements x, y, w, h; default: whole renderer).

angle

Specifies rotation of drawn image, in degrees.

center_point

Defines point around which to rotate (contains elements x, y).

status

Optional list status with elements value and message to retrieve warnings and error messages.

Examples

    txl <- CRcreate_texture(gs, list(), 100, 100)
    
    CRset_render_target(gs, txl, 1)
    
    CRset_render_color(gs, list(r = 100, g = 0, b = 0))
    
    CRfill_rect(gs, list(x = 25, y = 25, w = 50, h = 50))
    
    CRreset_render_target(gs)
    
    CRset_render_color(gs, list(r = 0, g = 0, b = 0))
    
    CRrender_clear(gs)
    
    CRdraw_texture(gs, txl, 1)

    CRrender_present(gs)

lorweiuk/CREx documentation built on March 16, 2024, 3:04 a.m.