Return to previous page | Return to menu | Go to next page


Color calculation

With SGL, it is possible to calculate the color data of the top image and second image obtained by comparing the priority of the sprite and each scroll screen at the specified ratio and display it on the screen.
By using this function, it is possible to draw other scroll surfaces and sprites that are hidden behind a certain scroll so that they gradually float.

To perform color calculation processing, the following steps must be taken.

1) Color calculation processing settings
Use the function “slColorCalc” to set the color calculation processing settings, and use the function “slColorCalcOn” to determine the scroll plane that will be affected by the color calculation.

[void slColorCalc (Uint16 flag);]
Set color calculation processing.

For the parameter, substitute the value shown in the figure below that corresponds to the color calculation processing control to be used.
For details on the parameters, refer to “HARDWARE MANUAL vol.2: VDP2 User's Manual Chapter 12 Color Calculation”.

Figure 8-27 “slColorCalc” parameter substitution value (flag)

Note) The above values ​​are defined in “sl_def.h” included with the system.

There are two main modes for color calculation.

Add by percentage: Color calculation (CC_RATE) by specifying the calculation ratio of TOP image and 2ND image
Add as it is: Color calculation (CC_ADD) with simple addition of TOP image and 2ND image
[void slColorCalcOn (Uint16 flag);]
Determines the scroll plane that is affected by color calculation processing.
For the parameter, substitute the value shown in the table below that corresponds to the scroll surface on which you want to perform color calculation.
Also, by connecting multiple parameters with the or operator "|", you can specify color calculation for multiple scroll planes at the same time.

Table 8-22 “slColorCalcOn” parameter substitution value (flag)

Note) The values ​​in the above table are defined in “sl_def.h” included with the system.

2) Color calculation value setting
Scroll planes that have been set and registered for color calculation are actually executed by using the functions “slColRateNbg0-3”, “slColRateRbg0”, “slColRateLNCL”, and “slColRateBACK” that correspond to each scroll plane. (Specified as a ratio).

However, the ratio specification has no meaning when the addition method is adopted for color calculation.

[void slColRateNbg0 ~ 3 (Uint16 rate);]
[void slColRateRbg0 (Uint16 rate);]
[void slColRateLNCL (Uint16 rate);]
[void slColRateBACK (Uint16 rate);] Set the color calculation ratio for each scroll plane specified by the
function.
Assign the color calculation ratio (range 0 to 31) used in color calculation to the parameter.
The function “slColRateNbg0 ~ 3” is used to set each normal scroll screen, the function “slColRateRbg0” is the rotary scroll screen, the function “slColRateLNCL” is the line color screen, and the function “slColRateBACK” is used to set the color calculation ratio of the back screen.

The flow of color calculation processing can be roughly summarized as follows.

Flow 8-11 Flow of color calculation processing


Return to previous page | Return to menu | Go to next page