Exemple #1
0
        public virtual int CompareTo(object obj)
        {
            //Remember not to compare FunctionObjId
            TPdfFunction o2 = obj as TPdfFunction;

            if (o2 == null)
            {
                return(1);
            }
            int Result = FunctionType.CompareTo(o2.FunctionType);

            if (Result != 0)
            {
                return(Result);
            }

            Result = FlxUtils.CompareArray(Domain, o2.Domain);
            if (Result != 0)
            {
                return(Result);
            }

            Result = FlxUtils.CompareArray(Range, o2.Range);
            if (Result != 0)
            {
                return(Result);
            }

            return(0);
        }
Exemple #2
0
 public TPdfGradient(int aPatternId, TGradientType aGradientType, ColorBlend aBlendColors, RectangleF aCoords, PointF aCenterPoint, RectangleF aRotatedCoords, string aDrawingMatrix, List <TPdfFunction> FunctionList) : base(aPatternId, TPdfToken.GradientPrefix)
 {
     GradientType  = aGradientType;
     BlendFunction = GetBlendFunction(aBlendColors, FunctionList);
     CenterPoint   = aCenterPoint;
     Coords        = aCoords;
     RotatedCoords = aRotatedCoords;
     DrawingMatrix = aDrawingMatrix;
 }
Exemple #3
0
        private TPdfFunction GetBlendFunction(ColorBlend BlendColors, List <TPdfFunction> FunctionList)
        {
            TPdfFunction SearchFunction = CreateBlendFunction(BlendColors, FunctionList);
            int          Index          = FunctionList.BinarySearch(0, FunctionList.Count, SearchFunction, null);

            if (Index < 0)
            {
                FunctionList.Insert(~Index, SearchFunction);
            }
            else
            {
                SearchFunction = FunctionList[Index];
            }
            return(SearchFunction);
        }
Exemple #4
0
        private TPdfFunction[] GetFunctions(ColorBlend BlendColors, List <TPdfFunction> FunctionList)
        {
            int functionCount = BlendCount(BlendColors) - 1;

            TPdfFunction[] Result = new TPdfFunction[functionCount];
            for (int i = 1; i <= functionCount; i++)
            {
                TPdfFunction SearchFunction = new TPdfType2Function(new Double[] { 0, 1 }, null, BlendColorArray(BlendColors, i), BlendColorArray(BlendColors, i - 1), 1);
                int          Index          = FunctionList.BinarySearch(0, FunctionList.Count, SearchFunction, null);

                if (Index < 0)
                {
                    FunctionList.Insert(~Index, SearchFunction);
                }
                else
                {
                    SearchFunction = FunctionList[Index];
                }
                Result[functionCount - i] = SearchFunction;
            }
            return(Result);
        }