An array of calls?

Started by
2 comments, last by Shakedown 15 years, 10 months ago
Is it possible to create an array of say, SetPixel() each one containging its own coords (X, Y), and possibly an RGB value? Say you wanted to make an arrow of pixels that would be red, could you use an array to create the arrow, then just make calls to it to render it to the screen? Thanks, Matt
Advertisement
That is pretty much how images are drawn, but on the hardware level and without deterministic logic like yours. On the hardware, all you have is a sprite (2D array) and the hardware just takes the block and BitBlts it onto something. what your asking is to just put one pixel down into a specific place. This forces the software to move pointers instead of just incrementing their position by 1.

Why not try making a mask?
------------Anything prior to 9am should be illegal.
Quote:Original post by Code Is Your Friend
Is it possible to create an array of say, SetPixel() each one containging its own coords (X, Y), and possibly an RGB value? Say you wanted to make an arrow of pixels that would be red, could you use an array to create the arrow, then just make calls to it to render it to the screen?

Thanks,
Matt


What language are you using?

You can, typically, make a structure that represents the arguments (parameters) to the function (one structure instance contains all the data needed to call), make an array of these structures, and then iterate over the array to make the call with each structure. You can, in many cases, make an array where each element is some kind of kind of representation of a function: a "function pointer", a name that is looked up in a table, a name that is looked up automatically by the language, etc.

But a "call" of a function is a transient thing, even if your language represents the functions themselves as objects. You can no more have an array of calls to a function than you can have a bucket of smiles.
Quote:
You can no more have an array of calls to a function than you can have a bucket of smiles.


Haha nice.

This topic is closed to new replies.

Advertisement