RIC elements

 

CopyBits

 

CopyBits copy a rectangle area from a bitmap which was defined in a RIC element Sprite to a given position on the NXT screen.

 

 

Parameter

Function

Range

Parameter

VarMap

Copy Opt

This parameter will be ignored by the current firmware – You don’t have to set this parameter

0 - 4095

X

X

Sprite ID

ID of sprite which should used as source

1 - 10

X

X

Pos X

Horizontal positioin of lower left edge of source rectangle

0 - 4095

X

X

Pos Y

Vertical position of lower left edge of source rectangle

0 - 4095

X

X

Width

Width of source rectangle

0 - 4095

X

X

Height

Height of source rectangle

0 - 4095

X

X

Rel X

Horizontal target positon on screen relative to the original position of the RIC file

0 - 4095

X

X

Rel Y

Vertical target position on screen relative to the original position of the RIC file

0 - 4095

X

X

 

 

Size of element:

20 Byte

   

Usage:

You have to define a RIC element sprite before you can use it as a source for your CopyBits element. If you have defined more than one Sprite element with the same ID, than the CopyBits element will use the Sprite element which was defined least in the list before.

 

For setting the attributes of the RIC element CopyBits you will find two areas. In the upper area (blue marked) you will find the image of the sprite which will be used as a source – and also the settings for the source rectangle (red marked). In the bottom area you will see on which position the copied rectangle will be placed on the screen (relative to the origin of the output of the RIC file).

:

 

The origin of the copy area (red marked) will be defined by the lower left edge and width and height of the rectangle. You also can define the copy area by using the mouse: With mouse button down and mouse button up you can define the opposite edges of the copy area.

 

On the destination area you can define the position of the copy area by clicking on it. Please keep in mind that the destination position will be relative to the output of the RIC file on the NXT screen!

 

When you use the command GraphicOut( 10,10,”test.ric” ) than the RIC file will be displayed on position [10,10]. If the CopyBits destination is [20,5] than the finally output of the image will be done on position [35,15]. The relative output of the CopyBits will be done as a addon to the output of the RIC file.

 

If you would like to display the complete image of the RIC element Sprite than you can adapt the attributes to the given sprite by pressing the button . Therefore the width and height of the copy area will be the width and height of the sprite and the source and the destination position is [0,0].

 

Naturally you can use more than one RIC element CopyBits which are referencing to same RIC element sprite. Therefore you can draw different parts of the same RIC element Sprite on different positions of the NXT screen (see example “Game Pong”).

 

It’s also possible to use parameters or VarMaps for most of the attributes for having a dynamic image on the NXT screen.