Beispiel #1
0
 public int PutImage(LTexture tex2d)
 {
     if (tex2d != null)
     {
         return(PutImage(tex2d.GetImage()));
     }
     return(count);
 }
Beispiel #2
0
 public int PutImage(string name, LTexture tex2d)
 {
     if (tex2d != null)
     {
         return(PutImage(name, tex2d.GetImage()));
     }
     return(count);
 }
Beispiel #3
0
		public int PutImage(LTexture tex2d) {
			if (tex2d != null) {
				return PutImage(tex2d.GetImage());
			}
			return count;
		}
Beispiel #4
0
		public int PutImage(string name, LTexture tex2d) {
			if (tex2d != null) {
				return PutImage(name, tex2d.GetImage());
			}
			return count;
		}
Beispiel #5
0
	private void Init(LTexture tex2d, float limit, bool remove, float scale) {
		this.isVisible = true;
		this.expandLimit = limit;
		this.width = tex2d.GetWidth();
		this.height = tex2d.GetHeight();
		this.scaleWidth = (int) (width * scale);
		this.scaleHeight = (int) (height * scale);
		this.loopMaxCount = (MathUtils.Max(scaleWidth, scaleHeight) / 2) + 1;
		this.fractions = new float[(scaleWidth * scaleHeight) * maxElements];
		this.exWidth = (int) (scaleWidth * expandLimit);
		this.exHeigth = (int) (scaleHeight * expandLimit);
		LImage image = tex2d.GetImage().ScaledInstance(scaleWidth, scaleHeight);
		Color[] pixels = image.GetPixels();
		if (image != null) {
			image.Dispose();
			image = null;
		}
		this.size = pixels.Length;
		this.pixmap = new LPixmapData(exWidth, exHeigth, true);
		int no = 0, idx = 0;
        int length = fractions.Length;
		float angle = 0;
		float speed = 0;
		System.Random random = LSystem.random;
		for (int y = 0; y < scaleHeight; y++) {
			for (int x = 0; x < scaleWidth; x++) {
				if (idx + maxElements < length) {
					no = y * scaleWidth + x;
					angle = random.Next(360);
                    speed = 10f / random.Next(30);
					fractions[idx + 0] = x;
					fractions[idx + 1] = y;
					fractions[idx + 2] = (MathUtils.Cos(angle * MathUtils.PI
							/ 180) * speed);
					fractions[idx + 3] = (MathUtils.Sin(angle * MathUtils.PI
							/ 180) * speed);
					fractions[idx + 4] = (pixels[no].PackedValue == 0xff00 ? 0xffffff
							: pixels[no].PackedValue);
					fractions[idx + 5] = x / 6 + random.Next(10);
					idx += maxElements;
				}
			}
		}
		if (remove) {
			if (tex2d != null) {
				tex2d.Destroy();
				tex2d = null;
			}
		}
		this.tmp = tex2d;
		this.StartUsePixelThread();
	}