About bitmap graphics functions



ListReference

function

slInitBitMap



ListReference

macro

slInitBitMapNbg0



ListReference

macro

slInitBitMapNbg1



ListReference

macro

slInitBitMapRbg0


Declaration and initialization of bitmap graphics usage

Form

    #include "sgl.h"

    Uint16 mode;
    Uint16 size;
    void * addr_A;

    Bool slInitBitMap (mode, size, addr_A);
    Bool slInitBitMapNbg0 (size, addr_A);
    Bool slInitBitMapNbg1 (size, addr_A);
    Bool slInitBitMapRbg0 (size, addr_A);

argument

    Uint16 mode --Screen to draw (described later).
Uint16 size-Screen size (see below).
void * addr_A --The start (absolute) address of VRAM to use as a bitmap (see below).

Number of returns

    Bool --Error code (see below).

function

    Set the bitmap screen in 256-color mode.
The screen is not cleared.
In mode, bmNBG0 , bmNBG1 , bmRBG0 For any size, BM_512x256 , BM_512x512 , BM_1024x256 , BM_1024x512 Specify one of.
addr_A must be 20000H boundary.
In this function, slBitMapNbg0 , slBitMapNbg1 , slBitMapRbg0 is executed.
The center position of the screen is set to the origin.

Example

    slInitSystem ( TV_320x224 , NULL , 1);
    slInitBitMap ( bmNBG1 , BM_512x256 , (void *) 0x25e00000);

    slScrAutoDisp ( NBG0ON | NBG1ON | NBG2OFF | NBG3OFF );

reference

 slBitMapNbg0
 slBitMapNbg1
 slBitMapRbg0 



ListReference

function

slBitMapBase


Setting the center point of bitmap graphics

Form

    #include "sgl.h"

    Sint16 pos_x;
    Sint16 pos_y;

    void slBitMapBase (pos_x, pos_y);

argument

    Sint16 pos_x --X coordinate of the origin of the bitmap screen.
Sint16 pos_y --Y coordinate of the origin of the bitmap screen.

Number of returns

    void --Nothing is returned.

function

    Set the origin position of the bitmap screen.
Specify the upper left corner of the screen as (0,0).

Example

    Set the center coordinates to the bottom center of the screen.
slInitSystem ( TV_320x224 , NULL , 1); slInitBitMap ( bmNBG1 , BM_512x256 , (void *) 0x25e00000); slBitMapBase (160, 224);

reference

 slInitBitMap 



ListReference

function

slLocateBitMap


Coordinate address translation

Form

    #include "sgl.h"

    Sint16 pos_x;
    Sint16 pos_y;

    Sint8 * slLocateBitMap (pos_x, pos_y);

argument

    Sint16 pos_x --X coordinate of the position where you want to find the address.
Sint16 pos_y --Y coordinate of the position where you want to find the address.

Number of returns

    Sint8 * --VRAM (absolute) address at the specified location.

function

    Returns the address in VRAM at the specified location.
Returns NULL if it was off the screen.

Example

    Block transfer data to the address acquired by slLocateBitMap.
addr = slLocateBitMap (10, 10); slDMACopy (addr, dest, size);

reference



ListReference

function

slClearBitMap


Clear bitmap graphics surface

Form

    #include "sgl.h"

    Sint8 col;

    void slClearBitMap (col);

argument

    Sint8 col --Palette number.

Number of returns

    void --Nothing is returned.

function

    Clears the bitmap screen with the specified color.

Example

    slClearBitMap (6);

reference



ListReference

function

slBMPset


Dot the bitmap graphics surface

Form

    #include "sgl.h"

    Sint16 pos_x;
    Sint16 pos_y;
    Sint8 col;

    Bool slBMPset (pos_x, pos_y, col);

argument

    Sint16 pos_x --X coordinate of the position you want to draw.
Sint16 pos_y --Y coordinate of the position you want to draw.
Sint8 col;

Number of returns

    Bool --Error code (see below).

function

    Draws a point at the specified position.
Returns FALSE if off-screen.

Example

    Dot (10,10).
if ( slBMPset (10, 10, 3) == FALSE ) { slPrint ("Error occurred.", SlLocate (9, 2)); }

reference

 slBMPoint
 slBM Circle
 slBMLine
 slBMBox
 slBMBoxFill 



ListReference

function

slBMPoint


Get palette values for bitmap coordinates

Form

    #include "sgl.h"

    Sint16 pos_x;
    Sint16 pos_y;

    Sint8 slBMPoint (pos_x, pos_y);

argument

    Sint16 pos_x --X coordinate of the position where you want to know the palette code.
Sint16 pos_y --Y coordinate of the position where you want to know the palette code.

Number of returns

    Sint8 palette code

function

    Reads the point at the specified position and returns the palette code.
If it is off the screen, 0 is returned.

Example

    Know the RGB code of the dot (10,5).
rgb = * ( Uint16 *) (0x25f00000 + slBMPoint (10, 5));

reference

 slBMPoint
 slBM Circle
 slBMBox
 slBMBoxFill
 slBMPset 



ListReference

function

slBM Circle


Draw a circle on the bitmap graphic surface

Form

    #include "sgl.h"

    Sint16 pos_x;
    Sint16 pos_y;
    Sint16 size;
    Sint8 col;

    void slBMCircle (pos_x, pos_y, size, col);

argument

    Sint16 pos_x --X coordinate of the position you want to display.
Sint16 pos_y --Y coordinate of the position you want to display.
Sint16 size-The radius of the circle.
Sint8 col --Palette code for the color you want to display.

Number of returns

    void --Nothing is returned.

function

    Draws a circle centered on the specified position.

Example

    Draw a circle with a radius of 20 centered on the origin.
slBMCircle (0, 0, 20, 120);

reference

 slBMPoint
 slBMPset
 slBMLine
 slBMBox
 slBMBoxFill 



ListReference

function

slBMLine


Draw a line on the bitmap graphic surface

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 col;

    Bool slBMLine (pos_s_x, pos_s_y, pos_e_x, pos_e_y, col);

argument

    Sint16 pos_s_x --X-coordinate of the starting point of the line.
Sint16 pos_s_y --Y coordinate of the starting point of the line.
Sint16 pos_e_x-X-coordinate of the end point of the line.
Sint16 pos_e_y --Y coordinate of the end point of the line Sint8 col --Palette code.

Number of returns

    Bool --Error code (see below).

function

    Draws a straight line connecting the two specified points.
Returns FALSE if off-screen.

Example

    Draw a line starting at (10,54) and ending at (-3,35).
slBMLine (10, 54, -3, 35);

reference

 slBMPoint
 slBM Circle
 slBMPset
 slBMBox
 slBMBoxFill 



ListReference

function

slBMBox


Draw a rectangle on the bitmap graphic surface

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 col;

    Bool slBMBox (pos_s_x, pos_s_y, pos_e_x, pos_e_y, col);

argument

    Sint16 pos_s_x --X coordinate of the upper left point of the rectangle to draw.
Sint16 pos_s_y --Y coordinate of the upper left point of the rectangle to draw.
Sint16 pos_e_x --X coordinate of the lower right point of the rectangle to draw.
Sint16 pos_e_y --Y coordinate of the lower right point of the rectangle to draw.
Sint8 col --Palette code for the colors to draw.

Number of returns

    Bool --Error code (see below).

function

    Draws a rectangle with the specified points as two vertices.
Returns FALSE if off-screen.

Example

    Draw a rectangle with the upper left (120,35) and the lower right (47,100).
slBMBox (120, 35, 47, 100, 1);

reference

 slBMPoint
 slBM Circle
 slBMLine
 slBMPset
 slBMBox 



ListReference

function

slBMBoxFill


Draw a rectangle on the bitmap graphic surface and fill the inside

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 col;

    Bool slBMBoxFill (pos_s_x, pos_s_y, pos_e_x, pos_e_y, col);

argument

    Sint16 pos_s_x --X coordinate of the upper left point of the rectangle to draw.
Sint16 pos_s_y --Y coordinate of the upper left point of the rectangle to draw.
Sint16 pos_e_x --X coordinate of the lower right point of the rectangle to draw.
Sint16 pos_e_y --Y coordinate of the lower right point of the rectangle to draw.
Sint8 col --Palette code for the colors to draw.

Number of returns

    Bool --Error code (see below).

function

    Draws a rectangle with the specified points as two vertices.
It also draws the inside of the rectangle.
Returns FALSE if off-screen.

Example

    Fill the inside by drawing a rectangle with the upper left (120,35) and the lower right (47,100).
slBMBoxFill (120, 35, 47, 100, 1);

reference

 slBMPoint
 slBM Circle
 slBMLine
 slBMPset
 slBMBox 



ListReference

function

slBMGet


Obtaining bitmap data for a rectangular area

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 addr_A;

    Bool slBMGet (pos_s_x, pos_s_y, pos_e_x, pos_e_y, addr_A);

argument

    Sint16 pos_s_x --X coordinate of the upper left point of the rectangle to get.
Sint16 pos_s_y --Y coordinate of the upper left point of the rectangle to get.
Sint16 pos_e_x --X coordinate of the lower right point of the rectangle to get.
Sint16 pos_e_y --Y coordinate of the lower right point of the rectangle to get.
Sint8 addr_A --The address of the buffer that holds the data in the area.

Number of returns

    Bool --Error code (see below).

function

    Copies the bitmap data in the rectangle with the specified points as two vertices to the buffer. If part of the rectangle is off-screen, that part of the data will not be copied.
Returns FALSE if the entire rectangle is off screen.

Example

    Uint8 buffer [10 * 30];
    slBMGet (20, 20, 30, 50, buffer);

reference

 slBMPut
 slBMSprPut 



ListReference

function

slBMPut


Data transfer to a rectangular area in a bitmap graphic plane

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 * addr_A;

    Bool slBMPut (pos_s_x, pos_s_y, pos_e_x, pos_e_y, addr_A);

argument

    Sint16 pos_s_x --X coordinate of the upper left point of the rectangle to draw.
Sint16 pos_s_y --Y coordinate of the upper left point of the rectangle to draw.
Sint16 pos_e_x --X coordinate of the lower right point of the rectangle to draw.
Sint16 pos_e_y --Y coordinate of the lower right point of the rectangle to draw.
Sint8 * addr_A-Address with the original data.

Number of returns

    Bool --Error code (see below).

function

    Copies the bitmap data in the buffer inside a rectangle with the specified points as two vertices. If part of the rectangle is off-screen, that part of the data will not be copied.
Returns FALSE if the entire rectangle is off screen.

Example

    Uint8 buffer [50 * 50];

    slDMACopy (buffer, dest, 50 * 50);
    slBMPut (34, 56, 84, 106, buffer);

reference

 slBMGet
 slBMSprPut 



ListReference

function

slBMSprPut


Data transfer to a rectangular area in a bitmap graphic plane

Form

    #include "sgl.h"

    Sint16 pos_s_x;
    Sint16 pos_s_y;
    Sint16 pos_e_x;
    Sint16 pos_e_y;
    Sint8 * addr_A;

    Bool slBMSprPut (pos_s_x, pos_s_y, pos_e_x, pos_e_y, addr_A);

argument

    Sint16 pos_s_x --X coordinate of the upper left point of the rectangle to draw.
Sint16 pos_s_y --Y coordinate of the upper left point of the rectangle to draw.
Sint16 pos_e_x --X coordinate of the lower right point of the rectangle to draw.
Sint16 pos_e_y --Y coordinate of the lower right point of the rectangle to draw.
Sint8 * addr_A-Address with the original data.

Number of returns

    Bool --Error code (see below).

function

    Copies the bitmap data in the buffer inside a rectangle with the specified points as two vertices. However, the space part (pallet code 0) is not copied,
    If a part of the rectangle is off the screen, the data in that part will not be copied.
Returns FALSE if the entire rectangle is off screen.

Example

    Uint8 buffer [50 * 50];

    slDMACopy (buffer, dest, 50 * 50);
    slBMPut (34, 56, 84, 106, buffer);

reference

 slBMGet
 slBMPut

return
Copyright SEGA ENTERPRISES, LTD., 1997