- This wiki is out of date, use the continuation of this wiki instead
Map xput
From FenixWiki
Revision as of 18:29, 30 April 2007 (edit) Woody (Talk | contribs) ← Previous diff |
Current revision (20:30, 30 November 2007) (edit) (undo) Sandman (Talk | contribs) m |
||
(3 intermediate revisions not shown.) | |||
Line 3: | Line 3: | ||
==Definition== | ==Definition== | ||
- | '''INT''' map_xput ( <'''INT''' fileID> , <'''INT''' destinationGraphID> , <'''INT''' originGraphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' angle> , <'''INT''' size> , <'''INT''' | + | '''INT''' map_xput ( <'''INT''' fileID> , <'''INT''' destinationGraphID> , <'''INT''' originGraphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' angle> , <'''INT''' size> , <'''INT''' blitflags> ) |
- | Draws a [[ | + | Draws ([[blit]]s) a [[graphic]] onto another graphic. |
+ | |||
+ | If the advanced parameters aren't needed, [[map_put]]() can be used. If a graphic from one [[file]] needs to be drawn onto another graphic in a different file, or a separate width and height scaling is needed, [[map_xputnp]]() can be used. | ||
== Parameters == | == Parameters == | ||
{| | {| | ||
- | | '''INT''' fileID || - The [[file]] that holds the | + | | '''INT''' fileID || - The [[fileID]] of the [[file]] that holds the graphics. |
|- | |- | ||
- | | '''INT''' destinationGraphID || - The [[ | + | | '''INT''' destinationGraphID || - The [[graphID]] of the [[graphic]] to draw on. |
|- | |- | ||
- | | '''INT''' originGraphID || - The [[ | + | | '''INT''' originGraphID || - The [[graphID]] of the [[graphic]] to draw with. |
|- | |- | ||
- | | '''INT''' x || - Where on the destination | + | | '''INT''' x || - Where on the destination graphic's x-axis to put the graphic. |
|- | |- | ||
- | | '''INT''' y || - Where on the destination | + | | '''INT''' y || - Where on the destination graphic's y-axis to put the graphic. |
|- | |- | ||
- | | '''INT''' angle || - What [[angle]] to draw the | + | | '''INT''' angle || - What [[angle]] to draw the graphic at. |
|- | |- | ||
- | | '''INT''' size || - What [[size]] to draw the | + | | '''INT''' size || - What [[size]] to draw the graphic at. |
|- | |- | ||
- | | '''INT''' | + | | '''INT''' blitflags || - What [[blit flags]] to draw the graphic with. |
|} | |} | ||
Line 29: | Line 31: | ||
'''INT''' : [[true]] | '''INT''' : [[true]] | ||
- | == | + | == 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 graph doesn't need rotating or scaling. | |
+ | |||
+ | == Errors == | ||
+ | {| | ||
+ | | Unsupported color depth || - The origin graphic's color depth is greater than the destination graphic's. | ||
+ | |} | ||
== Example == | == Example == | ||
Line 37: | Line 45: | ||
Program watskeburt; | Program watskeburt; | ||
Global | Global | ||
- | destgraph; | + | int destgraph; |
- | origgraph; | + | int origgraph; |
- | + | ||
Begin | Begin | ||
- | set_mode( | + | // 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); | destgraph=new_map(100,100,16); | ||
- | map_clear(0,destgraph,rgb(255,0,0)); | + | map_clear(0,destgraph,rgb(255,0,0)); |
- | origgraph=new_map( | + | // Makes the origin graphic a blue square |
- | map_clear(0,origgraph,rgb(0,0,255)); | + | origgraph=new_map(100,100,16); |
+ | map_clear(0,origgraph,rgb(0,0,255)); | ||
- | map_xput(0,destgraph,origgraph,50,50,rand(-180000,180000),rand(50,150),4); | + | // Draws the blue square on the center of the red square transparently, |
+ | // at a random angle and a random size | ||
+ | map_xput(0,destgraph,origgraph,50,50,rand(-180000,180000),rand(50,150),4); | ||
+ | map_xput(0,destgraph,origgraph,50,50,rand(-180000,180000),rand(50,150),4); | ||
- | | + | // Shows the final graph |
+ | put(0,destgraph,160,100); | ||
- | + | Repeat | |
- | + | ||
frame; | frame; | ||
- | | + | Until(key(_esc)) |
- | + | ||
+ | End | ||
</pre> | </pre> | ||
- | Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[put]]() | + | Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[put]](), [[key]]() |
+ | |||
+ | This will result in something like:<br /> | ||
+ | http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/map_xput.PNG | ||
+ | |||
+ | {{Funcbox | ||
+ | | category = Maps | ||
+ | }} |
Current revision
Contents |
[edit] Definition
INT map_xput ( <INT fileID> , <INT destinationGraphID> , <INT originGraphID> , <INT x> , <INT y> , <INT angle> , <INT size> , <INT blitflags> )
Draws (blits) a graphic onto another graphic.
If the advanced parameters aren't needed, map_put() can be used. If a graphic from one file needs to be drawn onto another graphic in a different file, or a separate width and height scaling is needed, map_xputnp() can be used.
[edit] Parameters
INT fileID | - The fileID of the file that holds the graphics. |
INT destinationGraphID | - The graphID of the graphic to draw on. |
INT originGraphID | - The graphID of the graphic to draw with. |
INT x | - Where on the destination graphic's x-axis to put the graphic. |
INT y | - Where on the destination graphic's y-axis to put the graphic. |
INT angle | - What angle to draw the graphic at. |
INT size | - What size to draw the graphic at. |
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 graph doesn't need rotating or scaling.
[edit] Errors
Unsupported color depth | - The origin graphic's color depth is greater than the destination graphic'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_xput(0,destgraph,origgraph,50,50,rand(-180000,180000),rand(50,150),4); map_xput(0,destgraph,origgraph,50,50,rand(-180000,180000),rand(50,150),4); // Shows the final graph put(0,destgraph,160,100); Repeat frame; Until(key(_esc)) End
Used in example: set_mode(), new_map(), map_clear(), put(), key()
This will result in something like:
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() • |