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

Map xputnp

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:21, 1 May 2007 (edit)
Sandman (Talk | contribs)

← Previous diff
Current revision (20:30, 30 November 2007) (edit) (undo)
Sandman (Talk | contribs)
m
 
(4 intermediate revisions not shown.)
Line 5: Line 5:
'''INT''' map_xputnp ( <'''INT''' destinationFileID> , <'''INT''' destinationGraphID> , <'''INT''' originFileID> , <'''INT''' originGraphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' angle> , <'''INT''' scale_x> , <'''INT''' scale_y> , <'''INT''' blitflags> ) '''INT''' map_xputnp ( <'''INT''' destinationFileID> , <'''INT''' destinationGraphID> , <'''INT''' originFileID> , <'''INT''' originGraphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' angle> , <'''INT''' scale_x> , <'''INT''' scale_y> , <'''INT''' blitflags> )
-Draws ([[blit]]s) a [[graph]] onto another graph.+Draws ([[blit]]s) a [[graphic]] onto another graphic.
If the advanced parameters aren't needed, [[map_put]]() or [[map_xput]]() can be used. If the advanced parameters aren't needed, [[map_put]]() or [[map_xput]]() can be used.
Line 11: Line 11:
== Parameters == == Parameters ==
{| {|
-| '''INT''' destinationFileID || - The [[file]] that holds the destination graph.+| '''INT''' destinationFileID || - The [[fileID]] of the [[file]] that holds the destination graphic.
|- |-
-| '''INT''' destinationGraphID || - The [[graph]] to draw on.+| '''INT''' destinationGraphID || - The [[graphID]] of the [[graphic]] to draw on.
|- |-
-| '''INT''' originFileID || - The [[file]] that holds the origin graph.+| '''INT''' originFileID || - The [[fileID]] of the [[file]] that holds the origin graphic.
|- |-
-| '''INT''' originGraphID || - The [[graph]] to draw with.+| '''INT''' originGraphID || - The [[graphID]] of the [[graphic]] to draw with.
|- |-
-| '''INT''' x || - Where on the destination graph's x-axis to put the graph.+| '''INT''' x || - Where on the destination graph's x-axis to put the graphic.
|- |-
-| '''INT''' y || - Where on the destination graph's y-axis to put the graph.+| '''INT''' y || - Where on the destination graph's y-axis to put the graphic.
|- |-
-| '''INT''' angle || - What [[angle]] to draw the graph at.+| '''INT''' angle || - What [[angle]] to draw the graphic at.
|- |-
-| '''INT''' scale_x|| - What [[size]] to draw the origin graph's x-axis at (also see [[size_x]])+| '''INT''' scale_x|| - What [[size]] to draw the origin graphic's x-axis at (also see [[size_x]])
|- |-
-| '''INT''' scale_y || - What [[size]] to draw the origin graph's y-axis at (also see [[size_y]]).+| '''INT''' scale_y || - What [[size]] to draw the origin graphic's y-axis at (also see [[size_y]]).
|- |-
-| '''INT''' blitflags || - What [[blit flags]] to draw the graph with.+| '''INT''' blitflags || - What [[blit flags]] to draw the graphic with.
|} |}
Line 36: Line 36:
== Notes == == Notes ==
-The x and y parameters denote where to draw the graph, that is, where the center of the to be drawn graph will be. Blit flags can be used to give the drawing (blitting) a special effect.+The x and y parameters denote where to draw the graphic, that is, where the center of the to be drawn [[graphic]] will be. [[Blit flags]] can be used to give the drawing (blitting) a special effect.
-When angle is 0 and size is 100, the speed is greater, because the graph doesn't need rotating or scaling.+When angle is 0 and size is 100, the speed is greater, because the graphic doesn't need rotating or scaling.
== Errors == == Errors ==
{| {|
-| Unsupported color depth || - The origin graph's color depth is greater than the destination graph's.+| Unsupported color depth || - The origin graphic's color depth is greater than the destination graph's.
|} |}
Line 49: Line 49:
Program watskeburt; Program watskeburt;
Global Global
- destgraph;+ int destgraph;
- origgraph;+ int origgraph;
- +
Begin Begin
Line 65: Line 64:
map_clear(0,origgraph,rgb(0,0,255)); map_clear(0,origgraph,rgb(0,0,255));
- // Draws the blue square on the center of the red square transparently, at a random angle and a random size+ // Draws the blue square on the center of the red square transparently,
 + // at a random angle and a random size
map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4); map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4);
map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4); map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4);
Line 75: Line 75:
frame; frame;
End End
 +
End End
</pre> </pre>
-Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[put]]()+Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[put]](), [[blit flags]]
This will result in something like:<br /> This will result in something like:<br />
http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/map_xputnp.PNG http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/map_xputnp.PNG
 +
 +{{Funcbox
 + | category = Maps
 +}}

Current revision


Contents

[edit] Definition

INT map_xputnp ( <INT destinationFileID> , <INT destinationGraphID> , <INT originFileID> , <INT originGraphID> , <INT x> , <INT y> , <INT angle> , <INT scale_x> , <INT scale_y> , <INT blitflags> )

Draws (blits) a graphic onto another graphic.

If the advanced parameters aren't needed, map_put() or map_xput() can be used.

[edit] Parameters

INT destinationFileID - The fileID of the file that holds the destination graphic.
INT destinationGraphID - The graphID of the graphic to draw on.
INT originFileID - The fileID of the file that holds the origin graphic.
INT originGraphID - The graphID of the graphic to draw with.
INT x - Where on the destination graph's x-axis to put the graphic.
INT y - Where on the destination graph's y-axis to put the graphic.
INT angle - What angle to draw the graphic at.
INT scale_x - What size to draw the origin graphic's x-axis at (also see size_x)
INT scale_y - What size to draw the origin graphic's y-axis at (also see size_y).
INT blitflags - What blit flags to draw the graphic with.

[edit] Returns

INT : true

[edit] Notes

The x and y parameters denote where to draw the graphic, that is, where the center of the to be drawn graphic will be. Blit flags can be used to give the drawing (blitting) a special effect.

When angle is 0 and size is 100, the speed is greater, because the graphic doesn't need rotating or scaling.

[edit] Errors

Unsupported color depth - The origin graphic's color depth is greater than the destination graph's.

[edit] Example

Program watskeburt;
Global
    int destgraph;
    int origgraph;
Begin

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

    // Makes the destination graphic a red square
    destgraph=new_map(100,100,16);
    map_clear(0,destgraph,rgb(255,0,0));

    // Makes the origin graphic a blue square
    origgraph=new_map(100,100,16);
    map_clear(0,origgraph,rgb(0,0,255));

    // Draws the blue square on the center of the red square transparently,
    // at a random angle and a random size
    map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4);
    map_xputnp(0,destgraph,0,origgraph,50,50,rand(-180000,180000),rand(50,150),rand(50,150),4);

    // Shows the final graph
    put(0,destgraph,160,100);

    Loop
         frame;
    End

End

Used in example: set_mode(), new_map(), map_clear(), put(), blit flags

This will result in something like:
map_xputnp.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