This wiki is out of date, use the continuation of this wiki instead

New map

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:46, 13 November 2007 (edit)
Sandman (Talk | contribs)
m
← Previous diff
Current revision (20:30, 30 November 2007) (edit) (undo)
Sandman (Talk | contribs)
m
 
(2 intermediate revisions not shown.)
Line 5: Line 5:
'''INT''' new_map ( <'''INT''' width> , <'''INT''' height> , <'''INT''' depth> ) '''INT''' new_map ( <'''INT''' width> , <'''INT''' height> , <'''INT''' depth> )
-Creates a new [[graph]] and sets the color of all pixels to 0 (transparent).+Creates a new [[graphic]], sets the color of all pixels to 0 (transparent) and puts it in the [[system file]].
== Parameters == == Parameters ==
Line 17: Line 17:
== Returns == == Returns ==
-'''INT''' : The [[graphID]] of the newly created graph.+'''INT''' : [[GraphID]]
{| {|
| 0 || - There was an error. | 0 || - There was an error.
|- |-
-| >0 || - The graphID.+| >0 || - The graphID of the newly created graphic.
|} |}
== Errors == == Errors ==
{| {|
-| Unsupported color depth || - The specified color depth is not supported.+| Unsupported color depth || - The specified color depth is not supported. ''(Console)''
|- |-
-| Insufficient memory || - There is insufficient memory available. This error doesn't occur often.+| Insufficient memory || - There is insufficient memory available. This error doesn't occur often. ''(Console)''
|} |}
Line 57: Line 57:
This will result in something like:<br /> This will result in something like:<br />
http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/new_map.PNG http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/new_map.PNG
 +
 +{{Funcbox
 + | category = Maps
 +}}

Current revision


Contents

[edit] Definition

INT new_map ( <INT width> , <INT height> , <INT depth> )

Creates a new graphic, sets the color of all pixels to 0 (transparent) and puts it in the system file.

[edit] Parameters

INT width - The width of the to be created graph in pixels.
INT height - The height of the to be created graph in pixels.
INT depth - The color depth of the to be created graph in bits

[edit] Returns

INT : GraphID

0 - There was an error.
>0 - The graphID of the newly created graphic.

[edit] Errors

Unsupported color depth - The specified color depth is not supported. (Console)
Insufficient memory - There is insufficient memory available. This error doesn't occur often. (Console)

[edit] Example

Program a_map_is_born;
Private
    int map;
Begin

    // Create a new graph of size 100x100 and color depth of 8bit
    map = new_map(100,100,8);
    
    // Clear the map red
    map_clear(0,map,rgb(255,0,0));

    // Put it in the center of the screen
    put(0,map,160,100);

    Loop
        frame;
    End

End

Used in example: map_clear(), put()

This will result in something like:
new_map.PNG


Maps Functions
Graphic_info() • Map_block_copy() • Map_clear() • Map_clone() • Map_put() • Map_put_pixel() • Map_xput() • Map_xputnp() • New_map() • Save_png() • Unload_map() •
Personal tools