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

Map put pixel

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:10, 22 April 2007 (edit)
Woody (Talk | contribs)

← Previous diff
Current revision (20:30, 30 November 2007) (edit) (undo)
Sandman (Talk | contribs)
m
 
(5 intermediate revisions not shown.)
Line 3: Line 3:
==Definition== ==Definition==
 +'''INT''' map_put_pixel ( <'''INT''' fileID> , <'''INT''' graphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' color> )
-'''INT''' map_put_pixel ( <'''INT''' file> , <'''INT''' graph> , <'''INT''' x> , <'''INT''' y> , <'''INT''' color> )+Draws a single colored [[pixel]] on a [[graph]].
- +
-Draws a single colored pixel on a [[graph]].+
- +
== Parameters == == Parameters ==
- 
{| {|
-| '''INT''' file || - The FPG that holds the graph, or 0 for no FPG.+| '''INT''' fileID || - The [[file]] that holds the graph.
|- |-
-| '''INT''' graph || - The graph to draw on.+| '''INT''' graphID || - The [[graph]] to draw on.
|- |-
| '''INT''' x || - Where on the graph's x-axis to put the pixel. | '''INT''' x || - Where on the graph's x-axis to put the pixel.
Line 20: Line 17:
| '''INT''' y || - Where on the graph's y-axis to put the pixel. | '''INT''' y || - Where on the graph's y-axis to put the pixel.
|- |-
-| '''INT''' color || - What color to draw.+| '''INT''' color || - What [[color]] to draw.
|} |}
- 
== Returns == == Returns ==
 +'''INT''' : [[true]]
-'''INT''' : Returns [[true|1]] if successful and [[false|0]] if failed.+== Errors ==
- +{|
 +| Invalid map || - Map doesn't exist.
 +|-
 +| Unsupported color depth || - Destination graph is of an unsupported colordepth.
 +|}
== Example == == Example ==
- 
<pre> <pre>
Program awesome; Program awesome;
 +Private
 + int map;
 + int i;
Begin Begin
- set_mode(640,480,16);+ // Set the mode to 16bit and some res
- + set_mode(320,200,16);
- graph=new_map(100,100,16);+
- map_clear(0,graph,rgb(255,0,0)); //makes the graphic a red square+
- x=320;+
- y=240;+
- map_put_pixel(0,graph,50,50,rgb(255,255,255)); //puts a single white pixel in the center of the graphic+ // Create a blue-ish square map
 + map = new_map(100,100,16);
 + map_clear(0,map,rgb(50,100,150));
 + 
 + // Puts 100 yellow-ish pixels in random places in the graphic
 + for(i=0; i<100; i++)
 + map_put_pixel(0,map,rand(0,100),rand(0,100),rgb(255,255,55));
 + end
 + 
 + // Puts the map in the center of the screen
 + put(0,map,160,100);
Loop Loop
-  
frame; frame;
End End
 +
End End
- 
</pre> </pre>
 +Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[rand]](), [[put]]()
 +
 +{{Funcbox
 + | category = Maps
 +}}

Current revision


Contents

[edit] Definition

INT map_put_pixel ( <INT fileID> , <INT graphID> , <INT x> , <INT y> , <INT color> )

Draws a single colored pixel on a graph.

[edit] Parameters

INT fileID - The file that holds the graph.
INT graphID - The graph to draw on.
INT x - Where on the graph's x-axis to put the pixel.
INT y - Where on the graph's y-axis to put the pixel.
INT color - What color to draw.

[edit] Returns

INT : true

[edit] Errors

Invalid map - Map doesn't exist.
Unsupported color depth - Destination graph is of an unsupported colordepth.

[edit] Example

Program awesome;
Private
    int map;
    int i;
Begin

    // Set the mode to 16bit and some res
    set_mode(320,200,16);

    // Create a blue-ish square map
    map = new_map(100,100,16);
    map_clear(0,map,rgb(50,100,150));

    // Puts 100 yellow-ish pixels in random places in the graphic
    for(i=0; i<100; i++)
        map_put_pixel(0,map,rand(0,100),rand(0,100),rgb(255,255,55));
    end

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

    Loop
        frame;
    End

End

Used in example: set_mode(), new_map(), map_clear(), rand(), put()


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