public static void CalcColorTransform(LWF lwf, ColorTransform dst, ColorTransform src0, int src1Id) { ColorTransform src1 = null; if (src1Id == 0) { dst.Set(src0); } else if ((src1Id & (int)Constant.COLORTRANSFORM_FLAG) == 0) { AlphaTransform alphaTransform = lwf.data.alphaTransforms[src1Id]; dst.multi.red = src0.multi.red; dst.multi.green = src0.multi.green; dst.multi.blue = src0.multi.blue; dst.multi.alpha = src0.multi.alpha * alphaTransform.alpha; #if LWF_USE_ADDITIONALCOLOR dst.add.Set(src0.add); #endif } else { int colorTransformId = src1Id & ~(int)Constant.COLORTRANSFORM_FLAG; src1 = lwf.data.colorTransforms[colorTransformId]; CalcColorTransform(dst, src0, src1); } }
public static ColorTransform CalcColorTransform(LWF lwf, ColorTransform dst, ColorTransform src0, int src1Id) { if (src1Id == 0) { dst.Set(src0); } else if ((src1Id & (int)Constant.COLORTRANSFORM_FLAG) == 0) { AlphaTransform alphaTransform = lwf.data.alphaTransforms[src1Id]; dst.multi.red = src0.multi.red; dst.multi.green = src0.multi.green; dst.multi.blue = src0.multi.blue; dst.multi.alpha = src0.multi.alpha * alphaTransform.alpha; dst.add.Set(src0.add); } else { int colorTransformId = src1Id & ~(int)Constant.COLORTRANSFORM_FLAG; ColorTransform src1 = lwf.data.colorTransforms[colorTransformId]; CalcColorTransform(dst, src0, src1); } return(dst); }
public static void CopyColorTransform( ColorTransform dst, ColorTransform src) { if (src == null) { dst.Clear(); } else { dst.Set(src); } }
public static ColorTransform CopyColorTransform( ColorTransform dst, ColorTransform src) { if (src == null) { dst.Clear(); } else { dst.Set(src); } return(dst); }
public static ColorTransform CalcColorTransform(LWF lwf, ColorTransform dst, ColorTransform src0, int src1Id) { if (src1Id == 0) { dst.Set(src0); } else if ((src1Id & (int)Constant.COLORTRANSFORM_FLAG) == 0) { AlphaTransform alphaTransform = lwf.data.alphaTransforms[src1Id]; dst.multi.red = src0.multi.red; dst.multi.green = src0.multi.green; dst.multi.blue = src0.multi.blue; dst.multi.alpha = src0.multi.alpha * alphaTransform.alpha; #if LWF_USE_ADDITIONALCOLOR dst.add.Set(src0.add); #endif } else { int colorTransformId = src1Id & ~(int)Constant.COLORTRANSFORM_FLAG; ColorTransform src1 = lwf.data.colorTransforms[colorTransformId]; CalcColorTransform(dst, src0, src1); } return dst; }
public static void CopyColorTransform( ColorTransform dst, ColorTransform src) { if (src == null) dst.Clear(); else dst.Set(src); }
public static ColorTransform CopyColorTransform( ColorTransform dst, ColorTransform src) { if (src == null) dst.Clear(); else dst.Set(src); return dst; }
public override void Update(Matrix m, ColorTransform c) { if (!m_active) { return; } if (m_overriding) { Utility.CopyMatrix(m_matrix, m_lwf.rootMovie.matrix); Utility.CopyColorTransform( m_colorTransform, m_lwf.rootMovie.colorTransform); } else { Utility.CopyMatrix(m_matrix, m); Utility.CopyColorTransform(m_colorTransform, c); } if (m_handler != null) { m_handler.Call(EventType.UPDATE, this); } for (int dlDepth = 0; dlDepth < m_data.depths; ++dlDepth) { Object obj = m_displayList[dlDepth]; if (obj != null) { Matrix objm = m_matrix0; bool objHasOwnMatrix = obj.type == Type.MOVIE && ((Movie)obj).m_property.hasMatrix; if (m_property.hasMatrix) { if (objHasOwnMatrix) { Utility.CalcMatrix(objm, m_matrix, m_property.matrix); } else { Utility.CalcMatrix( m_matrix1, m_matrix, m_property.matrix); Utility.CalcMatrix( m_lwf, objm, m_matrix1, obj.matrixId); } } else { if (objHasOwnMatrix) { Utility.CopyMatrix(objm, m_matrix); } else { Utility.CalcMatrix(m_lwf, objm, m_matrix, obj.matrixId); } } ColorTransform objc = m_colorTransform0; bool objHasOwnColorTransform = obj.type == Type.MOVIE && ((Movie)obj).m_property.hasColorTransform; if (m_property.hasColorTransform) { if (objHasOwnColorTransform) { Utility.CalcColorTransform(objc, m_colorTransform, m_property.colorTransform); } else { Utility.CalcColorTransform(m_colorTransform1, m_colorTransform, m_property.colorTransform); Utility.CalcColorTransform(m_lwf, objc, m_colorTransform1, obj.colorTransformId); } } else { if (objHasOwnColorTransform) { Utility.CopyColorTransform(objc, m_colorTransform); } else { Utility.CalcColorTransform(m_lwf, objc, m_colorTransform, obj.colorTransformId); } } obj.Update(objm, objc); } } if (m_attachedMovies != null || m_attachedLWFs != null) { m = m_matrix; if (m_property.hasMatrix) { Matrix m1 = m_matrix1.Set(m); Utility.CalcMatrix(m, m1, m_property.matrix); } c = m_colorTransform; if (m_property.hasColorTransform) { ColorTransform c1 = m_colorTransform1.Set(c); Utility.CalcColorTransform(c, c1, m_property.colorTransform); } if (m_attachedMovies != null) { foreach (Movie movie in m_attachedMovieList) { if (movie != null) { movie.Update(m, c); } } } if (m_attachedLWFs != null) { foreach (KeyValuePair <string, bool> kvp in m_detachedLWFs) { string attachName = kvp.Key; LWFContainer lwfContainer; if (m_attachedLWFs.TryGetValue( attachName, out lwfContainer)) { DeleteAttachedLWF(this, lwfContainer, true, false); } } m_detachedLWFs.Clear(); foreach (LWFContainer lwfContainer in m_attachedLWFList) { m_lwf.RenderObject( lwfContainer.child.Exec(m_lwf.thisTick, m, c)); } } } }