Procedurality.Channel.place C# (CSharp) Method

place() public method

public place ( Channel sprite, Channel alpha, int x_offset, int y_offset ) : Channel
sprite Channel
alpha Channel
x_offset int
y_offset int
return Channel
		public Channel place(Channel sprite, Channel alpha, int x_offset, int y_offset) {
			float alpha_val;
			for (int y = y_offset; y < y_offset + sprite.getHeight(); y++) {
				for (int x = x_offset; x < x_offset + sprite.getWidth(); x++) {
					alpha_val = alpha.getPixel(x - x_offset, y - y_offset);
					putPixelWrap(x, y, alpha_val*sprite.getPixelWrap(x - x_offset, y - y_offset) + (1 - alpha_val)*getPixelWrap(x, y));
				}
			}
			return this;
		}
	

Same methods

Channel::place ( Channel sprite, int x_offset, int y_offset ) : Channel

Usage Example

Esempio n. 1
0
		public Channel quadJoin(Channel channel1, Channel channel2, Channel channel3, Channel channel4) {
			if(!(channel1.width != channel2.width && channel2.width == channel3.width && channel3.width == channel4.width && channel1.height == channel2.height && channel2.height == channel3.height && channel3.height == channel4.height))
					throw new Exception("channels must be same size");
			if(!(width == channel1.width<<1 && height == channel1.height<<1)) throw new Exception("size mismatch");
			Channel channel = new Channel(channel1.width<<1, channel1.height<<1);
			channel.place(channel1, 0, 0);
			channel.place(channel2, channel1.width, 0);
			channel.place(channel3, 0, channel1.height);
			channel.place(channel4, channel1.width, channel1.height);
			pixels = channel.getPixels();
			return this;
		}