Eyeon:Script/Reference/Applications/Fuse/Classes/Image/SetPixel

From VFXPedia

< Eyeon:Script | Reference | Applications | Fuse | Classes | Image
Revision as of 00:08, 19 March 2008 by Daniel (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


Summary

The SetPixel function is used to set the value of a specific pixel in an Image. This uses actual pixel coordinates, and must always be within image bounds.


Usage

Image:SetPixel(integer x_position, integer y_position, object pixel)

x_position
The position of the pixel to set on the x axis
y_position
The position of the pixel to set on the y axis
pixel
The pixel object to be assigned to the image.


Example

The following example is taken from the SourceTest.Fuse example found at Example_Fuses

	local img = Image(imgattrs)
	
	local random = math.random -- faster in a local
	
	local p = Pixel({A=1})
	
	for y=0,Height-1 do
		if self.Status ~= "OK" then break end
		
		for x=0,Width-1 do
			p.R = random()
			p.G = random()
			p.B = random()
			img:SetPixel(x,y, p)
		end
	end
	
	OutImage:Set(req, img)


Tips for SetPixel (edit)

EyeonTips:Script/Reference/Applications/Fuse/Classes/Image/SetPixel