Ejemplo n.º 1
0
 public RGradient(ref Pixel32Struct pxUpper, ref Pixel32Struct pxLower)
 {
     try {
         Init(256);
         bool bTest = From(ref pxUpper, ref pxLower);
     }
     catch (Exception exn) {
         RReporting.ShowExn(exn, "creating gradient values", "RImage(Pixel32Struct) constructor");
     }
 }
Ejemplo n.º 2
0
        public Pixel32Struct PixelFromTop()
        {
            Pixel32Struct pxReturn = new Pixel32Struct();

            try {
                pxReturn.B = by2dGrad[iGrad - 1][0];
                pxReturn.G = by2dGrad[iGrad - 1][1];
                pxReturn.R = by2dGrad[iGrad - 1][2];
                pxReturn.A = by2dGrad[iGrad - 1][3];
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "getting top gradient pixel", "RImage PixelFromTop");
            }
            return(pxReturn);
        }
Ejemplo n.º 3
0
 public RGradient()
 {
     try {
         Init(256);
         Pixel32Struct pxUpper = new Pixel32Struct();
         Pixel32Struct pxLower = new Pixel32Struct();
         pxUpper.A = 255;
         pxLower.B = 255;
         pxLower.G = 255;
         pxLower.R = 255;
         bool bTest = From(ref pxUpper, ref pxLower);
     }
     catch (Exception exn) {
         RReporting.ShowExn(exn, "creating gradient values", "RImage(void) constructor");
     }
 }
Ejemplo n.º 4
0
 public RGradient(int iShades)
 {
     try {
         Init(iShades);
         Pixel32Struct pxUpper = new Pixel32Struct();
         Pixel32Struct pxLower = new Pixel32Struct();
         pxUpper.A = 255;
         pxLower.B = 255;
         pxLower.G = 255;
         pxLower.R = 255;
         if (!From(ref pxUpper, ref pxLower))
         {
             RReporting.ShowErr("Error calculating gradient values", "", "RImage(int) constructor");
         }
     }
     catch (Exception exn) {
         RReporting.ShowExn(exn, "creating gradient values", "RImage(int) constructor");
     }
 }
Ejemplo n.º 5
0
        public bool From(ref Pixel32Struct pxUpper, ref Pixel32Struct pxLower)
        {
            bool bGood = false;

            try {
                FPx fpxUpper = new FPx();
                FPx fpxLower = new FPx();
                fpxUpper.B = (float)pxUpper.B;
                fpxUpper.G = (float)pxUpper.G;
                fpxUpper.R = (float)pxUpper.R;
                fpxUpper.A = (float)pxUpper.A;
                fpxLower.B = (float)pxLower.B;
                fpxLower.G = (float)pxLower.G;
                fpxLower.R = (float)pxLower.R;
                fpxLower.A = (float)pxLower.A;
                float fGrad = (int)iGrad;
                int   iVal  = 0;
                float fVal;
                float fOpacity;
                //needs to be float in case gradient is longer than 256!!!
                for (fVal = 0; fVal < fGrad; fVal += 1.0f, iVal++)
                {
                    fOpacity          = fVal / 255.0f;
                    by2dGrad[iVal][0] = (byte)(((fpxUpper.B - fpxLower.B) * fOpacity + fpxLower.B) + .5f);
                    by2dGrad[iVal][1] = (byte)(((fpxUpper.G - fpxLower.G) * fOpacity + fpxLower.G) + .5f);
                    by2dGrad[iVal][2] = (byte)(((fpxUpper.R - fpxLower.R) * fOpacity + fpxLower.R) + .5f);
                    by2dGrad[iVal][3] = (byte)(((fpxUpper.A - fpxLower.A) * fOpacity + fpxLower.A) + .5f);
                }
                //bGood=ByteArrayFromPixArray();
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "changing gradient values", "RImage From(Pixel32Struct)");
                bGood = false;
            }
            return(bGood);
        }        //end From(Pixel32Struct,Pixel32Struct)