public AdjustSaturation ( float saturation ) : void | ||
saturation | float | |
리턴 | void |
public void AdjustSaturation(float saturation)
{
saturation += 1.0f;
float invSat = 1.0f - saturation;
float invLumR = invSat * LUMA_R;
float invLumG = invSat * LUMA_G;
float invLumB = invSat * LUMA_B;
float[] mtx =
{
(invLumR + saturation), invLumG, invLumB, 0, 0,
invLumR, (invLumG + saturation), invLumB, 0, 0,
invLumR, invLumG, (invLumB + saturation), 0, 0,
0, 0, 0, 1, 0
};
ConcatMatrix(this, mtx);
}
private void AddTestObjects(int numObjects) { int border = 15; Random r = new Random(); for (int i = 0; i < numObjects; ++i) { Image egg = new Image(textures[0]); if (i < 5) { ColorMatrix cm = new ColorMatrix(); cm.AdjustSaturation(-0.8f); ColorMatrixFilter fi = new ColorMatrixFilter (cm); //EmptyFilter fi = new EmptyFilter(); //BlurFilter fi = new BlurFilter(4, 1.1f); egg.Filter = fi; //egg.Filter.Cache(); } //MovieClip egg = new MovieClip (textures, 3); //SP.DefaultJuggler.Add (egg); egg.X = r.Next(border, (int)Stage.Width - border); egg.Y = r.Next(border, (int)Stage.Height - border); egg.Rotation = (float)(r.Next(0, 100) / 100.0f * Math.PI); _container.AddChild(egg); } Sprite sp = new Sprite(); sp.X = sp.Y = 250; _container.AddChild(sp); Image test = new Image(textures[1]); test.PivotX = test.PivotY = test.Width / 2; sp.AddChild(test); Image test1 = new Image(textures[1]); sp.AddChild(test1); test1.X = test1.Y = 60; }