2D Toolkit Forum

2D Toolkit => Support => Topic started by: Euthyphro on June 17, 2014, 10:48:26 pm

Title: Drawing sprites and merging together
Post by: Euthyphro on June 17, 2014, 10:48:26 pm
For my project I need to merge two transparent sprites onto one sprite by sampling data from one and merging certain pixels of that sprite onto another. Is there a way with tk2d to do this? Looking through the support docs I don't see any functionality that allows a dev to even sample what colour is at a pixel coordinate of a sprite image. Any suggestions? Coming from Systems.Drawing (which isn't supported in Unity, I'm kind of looking fo something along the lines of Bitmap.GetPixel(x,y) to sample and then redrawing the image from there.

Thanks.
Title: Re: Drawing sprites and merging together
Post by: unikronsoftware on June 18, 2014, 10:42:11 am
Well you can use Texture2D.GetPixel and SetPixel to do what you like, but be warned its really really slow and uses a ton of memory.
You cant do this in tk2d directly, and for good reason - performance takes a dive as soon as you do this.