Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8594913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:18:32+00:00 2026-06-12T00:18:32+00:00

This is the full error message: C:\Project Files\Good\src\views\RasterView.as(26): col: 39 Error: Type was not

  • 0

This is the full error message:

C:\Project Files\Good\src\views\RasterView.as(26): col: 39 Error: Type was not found or was not a compile-time constant: Raster.
C:\Project Files\Good\src\views\RasterView.as(42): col: 45 Error: Type was not found or was not a compile-time constant: Raster.
C:\Project Files\Good\src\views\RasterView.as(47): col: 45 Error: Type was not found or was not a compile-time constant: Raster.
C:\Project Files\Good\src\views\RasterView.as(62): col: 32 Error: Type was not found or was not a compile-time constant: Raster.

This is the file(it is huge)

package views 
{
    import flash.display.Bitmap;
    import flash.geom.Point;
    import views.Canvas.Raster;
    /**
     * ...
     * @author Arthur Wulf White
     */
    public class RasterView extends Bitmap
    {   
        import views.Canvas.Raster

        public static const SCHEMATIC   : int = 1;
        public static const SMOOTH      : int = 2;
        public static const RENDER_ONCE : int = 4;
        public static const BOTH        : int = SCHEMATIC + SMOOTH;

//      protected var bitmapData : Raster;
        protected var viewMode : int = 0;

        protected var lineColor : int = 0xff000000;
        protected var fillColor : int = 0xff808080;
        protected var bgColor   : int = 0xffffffff;

        public function RasterView(raster : Raster) 
        {
            this.bitmapData = raster;
        }

        public function getStyle():Vector.<int>
        {
            return new <int> [lineColor, fillColor, bgColor];
        }
        public function setStyle(lineColor : int, fillColor : int, bgColor : int):void
        {
            this.lineColor  = lineColor;
            this.fillColor  = fillColor;
            this.bgColor    = bgColor;
        }

        public function backupView(backupRaster : Raster):void
        {
            backupRaster.copyPixels(bitmapData, bitmapData.rect, new Point());
        }

        public function loadBackup(backupRaster : Raster):void
        {
            bitmapData.copyPixels(backupRaster, backupRaster.rect, new Point());
        }

        public function getViewMode():int
        {
            return viewMode;
        }

        public function setViewMode(mode : int):void
        {
            viewMode = mode;
        }

        public function get Raster():Raster
        {
            return Raster(bitmapData);
        }

        public function refreshView():void
        {
            bitmapData.lock()
            render();
            bitmapData.unlock();
            if ((getViewMode() & RENDER_ONCE) != 0)
            {
                setViewMode( getViewMode() ^ RENDER_ONCE);
            }
        }

        public function render():void
        {

        }

        protected function clear():void
        {
            bitmapData.fillRect(bitmapData.rect, bgColor);
        }

    }

}

This is the file for the Raster class(I don’t think it is important for this issue)

/**
*
*   Raster class
*   
*   @author     Didier Brun aka Foxy - www.foxaweb.com
*   @version        1.4
*   @date       2006-01-06
*   @link       http://www.foxaweb.com
* 
*   AUTHORS ******************************************************************************
* 
*   authorName :    Didier Brun - www.foxaweb.com
*   contribution :  the original class
*   date :          2007-01-07
* 
*   authorName :    Drew Cummins - http://blog.generalrelativity.org
*   contribution :  added bezier curves
*   date :          2007-02-13
* 
*   authorName :    Thibault Imbert - http://www.bytearray.org
*   contribution :  Raster now extends BitmapData, performance optimizations
*   date :          2009-10-16
* 
*   PLEASE CONTRIBUTE ? http://www.bytearray.org/?p=67
* 
*   DESCRIPTION **************************************************************************
* 
*   Raster is an AS3 Bitmap drawing library. It provide some functions to draw directly 
*   into BitmapData instance.
*
*   LICENSE ******************************************************************************
* 
*   This class is under RECIPROCAL PUBLIC LICENSE.
*   http://www.opensource.org/licenses/rpl.php
* 
*   Please, keep this header and the list of all authors
* 
*/
package views.Canvas
{
    import flash.display.BitmapData;
    import flash.display.Shape;
    import flash.geom.Point;
    import flash.geom.Rectangle;

    public class Raster extends BitmapData
    {
        private var shape : Shape = new Shape();
        private var buffer:Array = new Array();
        private var r:Rectangle = new Rectangle();

        public function Raster ( width:uint, height:uint, transparent:Boolean=false, color:uint=0)
        {       
            super ( width, height, transparent, color);
        }

        // ------------------------------------------------
        //
        // ---o public methods
        //
        // ------------------------------------------------

        public function setPoint( p : Point, color : int, size : int = 1):void
        {
            if(size == 1)
                setPixel(p.x, p.y, color);
            else if (size > 1)
                drawRect(new Rectangle(p.x - size / 2, p.y - size / 2, size, size), color);
        }

        public function lineAA( x0:int, y0:int, x1:int, y1:int, color:uint ):void
        {
            var i : int = 0;
            var cInt : int;
            var cNum : Number;
            var div  : Number;

            var dx : int = Math.abs(x1 - x0);
            var dy : int = Math.abs(y1 - y0);

            if(dx >= dy)
            {
                //do x
                if (x0 < x1)
                {
                    cInt = x0;
                    cNum = y0;
                }
                else
                {
                    cInt = x1;
                    cNum = y1;
                }

                div = Number(y1 - y0) / Number(x1 - x0);
                setPixel32(cInt, cNum, color);
                for (; i <= dx; i++)
                {
                    cInt++;
                    cNum += div;
                    setAAPixel(cInt, cNum, color, true, false);
                }
            }
            else
            {
                //do y
                if (y0 < y1)
                {
                    cInt = y0;
                    cNum = x0;
                }
                else
                {
                    cInt = y1;
                    cNum = x1;
                }

                div = Number(x1 - x0) / Number(y1 - y0);
                setPixel32(cNum, cInt, color);
                for (; i <= dy; i++)
                {
                    cInt++;
                    cNum += div;
                    setAAPixel(cNum, cInt, color, false, true);
                }
            }
        }

        public function quadLine(x0 : int, y0 : int, cx : int, cy : int, x1 : int, y1 : int, color : int = 0xff0000ff, detail : int = 20):void
        {
            var epsilon : Number = 1.0 / Number(detail);
            var total : Number = 0;
            var x : int = 0;
            var y : int = 0;
            for (; total <= 1.001; total+=epsilon)
            {
                x = (1 - total) * ((1 - total) * x0 + total * cx) + total * (total * x1 + (1 - total) * cx); 
                y = (1 - total) * ((1 - total) * y0 + total * cy) + total * (total * y1 + (1 - total) * cy);
                setPixel32(x, y, color);
            }
        }
         /**
         * Draws a antialias Quadratic Bezier Curve (equivalent to a DisplayObject's graphics#curveTo)
         * 
         * @param x0            x position of first anchor
         * @param y0            y position of first anchor
         * @param x1            x position of control point
         * @param y1            y position of control point
         * @param x2            x position of second anchor
         * @param y2            y position of second anchor
         * @param c             color
         * @param resolution    [optional] determines the accuracy of the curve's length (higher number = greater accuracy = longer process)
         * */

        public function aaQuadBezier ( anchorX0:int, anchorY0:int, controlX:int, controlY:int, anchorX1:int, anchorY1:int, c:Number, resolution:int = 3):void
        {   
            shape.graphics.clear();
            shape.graphics.lineStyle(1, c, 1);
            shape.graphics.moveTo(anchorX0, anchorY0);
            shape.graphics.curveTo(controlX, controlY, anchorX1, anchorY1);
            this.draw(shape);
        }

        /**
        * Draw an anti-aliased line
        * 
        * @param x0     first point x coord
        * @param y0     first point y coord 
        * @param x1     second point x coord
        * @param y1     second point y coord
        * @param c      color (0xaarrvvbb)
        */
        public function aaLine2( x1:int, y1:int, x2:int, y2:int, color:uint ):void
        {   
            shape.graphics.clear();
            shape.graphics.lineStyle(1, color, 1);
            shape.graphics.moveTo(x1, y1);
            shape.graphics.lineTo(x2, y2);
            this.draw(shape);
        }

        /**
        * Draw a line
        * 
        * @param x0     first point x coord
        * @param y0     first point y coord 
        * @param x1     second point x coord
        * @param y1     second point y coord
        * @param c      color (0xaarrvvbb)
        */
        public function line ( x0:int, y0:int, x1:int, y1:int, color:uint ):void
        {   
            var dx:int;
            var dy:int;
            var i:int;
            var xinc:int;
            var yinc:int;
            var cumul:int;
            var x:int;
            var y:int;
            x = x0;
            y = y0;
            dx = x1 - x0;
            dy = y1 - y0;
            xinc = ( dx > 0 ) ? 1 : -1;
            yinc = ( dy > 0 ) ? 1 : -1;
            dx = dx < 0 ? -dx : dx;
            dy = dy < 0 ? -dy : dy;
            setPixel32(x,y,color);

            if ( dx > dy )
            {
                cumul = dx >> 1;
                for ( i = 1 ; i <= dx ; ++i )
                {
                    x += xinc;
                    cumul += dy;
                    if (cumul >= dx)
                    {
                        cumul -= dx;
                        y += yinc;
                    }
                    setPixel32(x,y,color);
                }
            }else
            {
                cumul = dy >> 1;
                for ( i = 1 ; i <= dy ; ++i )
                {
                    y += yinc;
                    cumul += dx;
                    if ( cumul >= dy )
                    {
                        cumul -= dy;
                        x += xinc ;
                    }
                    setPixel32(x,y,color);
                }
            }
        }

        /**
        * Draw a triangle
        * 
        * @param x0     first point x coord
        * @param y0     first point y coord 
        * @param x1     second point x coord
        * @param y1     second point y coord
        * @param x2     third point x coord
        * @param y2     third point y coord
        * @param c      color (0xaarrvvbb)
        */

        public function triangle ( x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, color:uint ):void
        {
            line (x0,y0,x1,y1,color);
            line (x1,y1,x2,y2,color);
            line (x2,y2,x0,y0,color);
        }

        /**
        * Draw a filled triangle
        * 
        * @param x0     first point x coord
        * @param y0     first point y coord 
        * @param x1     second point x coord
        * @param y1     second point y coord
        * @param x2     third point x coord
        * @param y2     third point y coord
        * @param c      color (0xaarrvvbb)
        */
        public function filledTri ( x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, color:uint ):void
        {
            buffer.length = 0;
            lineTri (buffer,x0,y0,x1,y1,color);
            lineTri (buffer,x1,y1,x2,y2,color);
            lineTri (buffer,x2,y2,x0,y0,color);
        }

        /**
        * Draw a circle
        * 
        * @param px     first point x coord
        * @param py     first point y coord 
        * @param r      radius
        * @param c      color (0xaarrvvbb)
        */
        public function circle ( px:int, py:int, r:int, color:uint ):void
        {
            var x:int;
            var y:int;
            var d:int;
            x = 0;
            y = r;
            d = 1-r;
            setPixel32(px+x,py+y,color);
            setPixel32(px+x,py-y,color);
            setPixel32(px-y,py+x,color);
            setPixel32(px+y,py+x,color);

            while ( y > x )
            {
                if ( d < 0 )
                {
                    d += (x+3) << 1;
                }else
                {
                    d += ((x - y) << 1) + 5;
                    y--;
                }
                x++;
                setPixel32(px+x,py+y,color);
                setPixel32(px-x,py+y,color);
                setPixel32(px+x,py-y,color);
                setPixel32(px-x,py-y,color);
                setPixel32(px-y,py+x,color);
                setPixel32(px-y,py-x,color);
                setPixel32(px+y,py-x,color);
                setPixel32(px+y,py+x,color);
            }
        }

        /**
        * Draw an anti-aliased circle
        * 
        * @param px     first point x coord
        * @param py     first point y coord 
        * @param r      radius
        * @param c      color (0xaarrvvbb)
        */
        public function aaCircle ( px:int, py:int, r:int, color:uint ):void
        {
            var vx:int;
            var vy:int;
            var d:int;
            vx = r;
            vy = 0;

            var t:Number=0;
            var dry:Number;
            var buff:int;

            setPixel(px+vx,py+vy,color);
            setPixel(px-vx,py+vy,color);
            setPixel(px+vy,py+vx,color);
            setPixel(px+vy,py-vx,color);

            while ( vx > vy+1 )
            {
                vy++;
                buff = Math.sqrt(r*r-vy*vy)+1;
                dry = buff - Math.sqrt(r*r-vy*vy);
                if (dry<t) vx--;

                drawAlphaPixel(px+vx,py+vy,1-dry,color)
                drawAlphaPixel(px+vx-1,py+vy,dry,color)
                drawAlphaPixel(px-vx,py+vy,1-dry,color)
                drawAlphaPixel(px-vx+1,py+vy,dry,color)
                drawAlphaPixel(px+vx,py-vy,1-dry,color)
                drawAlphaPixel(px+vx-1,py-vy,dry,color)
                drawAlphaPixel(px-vx,py-vy,1-dry,color)
                drawAlphaPixel(px-vx+1,py-vy,dry,color)

                drawAlphaPixel(px+vy,py+vx,1-dry,color)
                drawAlphaPixel(px+vy,py+vx-1,dry,color)
                drawAlphaPixel(px-vy,py+vx,1-dry,color)
                drawAlphaPixel(px-vy,py+vx-1,dry,color)

                drawAlphaPixel(px+vy,py-vx,1-dry,color)
                drawAlphaPixel(px+vy,py-vx+1,dry,color)
                drawAlphaPixel(px-vy,py-vx,1-dry,color)
                drawAlphaPixel(px-vy,py-vx+1,dry,color)

                t=dry;
            }
        }

        /**
        * Draw an anti-aliased line
        * 
        * @param x0     first point x coord
        * @param y0     first point y coord 
        * @param x1     second point x coord
        * @param y1     second point y coord
        * @param c      color (0xaarrvvbb)
        */
        public function aaLine ( x1:int, y1:int, x2:int, y2:int, color:uint ):void
        {   
            var steep:Boolean = Math.abs(y2 - y1) > Math.abs(x2 - x1);
            var swap:int;

            if (steep)
            {
                swap=x1; x1=y1; y1=swap;
                swap=x2; x2=y2; y2=swap;
            }

            if (x1 > x2)
            {
                swap=x1; x1=x2; x2=swap;
                swap=y1; y1=y2; y2=swap;
            }

            var dx:int = x2 - x1;
            var dy:int = y2 - y1

            var gradient:Number = dy / dx;

            var xend:int = x1;
            var yend:Number = y1 + gradient * (xend - x1);
            var xgap:Number = 1-((x1 + 0.5)%1);
            var xpx1:int = xend;
            var ypx1:int = yend;
            var alpha:Number;

            alpha = ((yend)%1) * xgap;

            var intery:Number = yend + gradient;

            xend = x2;
            yend = y2 + gradient * (xend - x2)
            xgap = (x2 + 0.5)%1;

            var xpx2:int = xend; 
            var ypx2:int = yend;

            alpha = (1-((yend)%1)) * xgap;

            if (steep)
                drawAlphaPixel(ypx2,xpx2,alpha,color);
            else drawAlphaPixel(xpx2, ypx2,alpha,color);

            alpha = ((yend)%1) * xgap;

            if (steep)
                drawAlphaPixel(ypx2 + 1,xpx2,alpha,color);
            else drawAlphaPixel(xpx2, ypx2 + 1,alpha,color);

            var x:int=xpx1;

            while (x++<xpx2)
            {
                alpha = 1-((intery)%1);

                if (steep)
                    drawAlphaPixel(intery,x,alpha,color);
                else drawAlphaPixel(x,intery,alpha,color);

                alpha=intery%1;

                if (steep)
                    drawAlphaPixel(intery+1,x,alpha,color);
                else drawAlphaPixel(x,intery+1,alpha,color);

                intery = intery + gradient
            }
        }

        /**
         * Draws a Rectangle
         * 
         * @param rect          Rectangle dimensions
         * @param color         color
         * */
        public function drawRect ( rect:Rectangle, color:uint ):void
        {
            line ( rect.x, rect.y, rect.x+rect.width, rect.y, color );
            line ( rect.x+rect.width, rect.y, rect.x+rect.width, rect.y+rect.height, color );
            line ( rect.x+rect.width, rect.y+rect.height, rect.x, rect.y+rect.height, color );
            line ( rect.x, rect.y+rect.height, rect.x, rect.y, color );
        }

        /**
         * Draws a rounded Rectangle
         * 
         * @param rect          Rectangle dimensions
         * @param ellipseWidth  Rectangle corners width
         * @param color         color
         * */
        public function drawRoundRect ( rect:Rectangle, ellipseWidth:int, color:uint ):void
        {
            var arc:Number = 4/3 * (Math.sqrt(2) - 1);
            var xc:Number = rect.x+rect.width-ellipseWidth;
            var yc:Number = rect.y+ellipseWidth;
            line( rect.x+ellipseWidth, rect.y, xc, rect.y, color );
            cubicBezier(xc, rect.y, xc + ellipseWidth*arc, yc - ellipseWidth, xc + ellipseWidth, yc - ellipseWidth*arc, xc + ellipseWidth, yc, color);
            xc = rect.x+rect.width-ellipseWidth;
            yc = rect.y+rect.height-ellipseWidth;
            line( xc + ellipseWidth, rect.y+ellipseWidth, rect.x+rect.width, yc, color );
            cubicBezier(rect.x+rect.width, yc, xc + ellipseWidth, yc + ellipseWidth*arc, xc + ellipseWidth*arc, yc + ellipseWidth, xc, yc + ellipseWidth, color);
            xc = rect.x+ellipseWidth;
            yc = rect.y+rect.height-ellipseWidth;
            line( rect.x+rect.width-ellipseWidth, rect.y+rect.height, xc, yc + ellipseWidth, color );
            cubicBezier( xc, yc + ellipseWidth, xc - ellipseWidth*arc, yc + ellipseWidth, xc - ellipseWidth, yc + ellipseWidth*arc, xc - ellipseWidth, yc, color );
            xc = rect.x+ellipseWidth;
            yc = rect.y+ellipseWidth;
            line( xc - ellipseWidth, rect.y+rect.height-ellipseWidth, rect.x, yc, color );
            cubicBezier(rect.x, yc, xc - ellipseWidth, yc - ellipseWidth*arc, xc - ellipseWidth*arc, yc - ellipseWidth, xc, yc - ellipseWidth, color);
        }

        /**
         * Draws a Quadratic Bezier Curve (equivalent to a DisplayObject's graphics#curveTo)
         * 
         * @param x0            x position of first anchor
         * @param y0            y position of first anchor
         * @param x1            x position of control point
         * @param y1            y position of control point
         * @param x2            x position of second anchor
         * @param y2            y position of second anchor
         * @param c             color
         * @param resolution    [optional] determines the accuracy of the curve's length (higher number = greater accuracy = longer process)
         * */
        public function quadBezier ( anchorX0:int, anchorY0:int, controlX:int, controlY:int, anchorX1:int, anchorY1:int, c:Number, resolution:int = 3):void
        {   
            var ox:Number = anchorX0;
            var oy:Number = anchorY0;
            var px:int;
            var py:int;
            var dist:Number = 0;

            var inverse:Number = 1 / resolution;
            var interval:Number;
            var intervalSq:Number;
            var diff:Number;
            var diffSq:Number;

            var i:int = 0;

            while( ++i <= resolution )
            {
                interval = inverse * i;
                intervalSq = interval * interval;
                diff = 1 - interval;
                diffSq = diff * diff;

                px = diffSq * anchorX0 + 2 * interval * diff * controlX + intervalSq * anchorX1;
                py = diffSq * anchorY0 + 2 * interval * diff * controlY + intervalSq * anchorY1;

                dist += Math.sqrt( ( px - ox ) * ( px - ox ) + ( py - oy ) * ( py - oy ) );

                ox = px;
                oy = py;
            }

            //approximates the length of the curve
            var curveLength:int = dist;
            inverse = 1 / curveLength;

            var lastx:int=anchorX0;
            var lasty:int=anchorY0;

            i = -1;
            while( ++i <= curveLength )
            {
                interval = inverse * i;
                intervalSq = interval * interval;
                diff = 1 - interval;
                diffSq = diff * diff;

                px = diffSq * anchorX0 + 2 * interval * diff * controlX + intervalSq * anchorX1;
                py = diffSq * anchorY0 + 2 * interval * diff * controlY + intervalSq * anchorY1;

                line(lastx,lasty,px,py,c);
                //aaLine(lastx, lasty, px, py, c);
                lastx = px;
                lasty = py;
            }
        }

        /**
         * Draws a Cubic Bezier Curve
         * 
         * TODO: Determine whether x/y params would be better named as anchor/control
         * 
         * @param x0            x position of first anchor
         * @param y0            y position of first anchor
         * @param x1            x position of control point
         * @param y1            y position of control point
         * @param x2            x position of second control point
         * @param y2            y position of second control point
         * @param x3            x position of second anchor
         * @param y3            y position of second anchor
         * @param c             color
         * @param resolution    [optional] determines the accuracy of the curve's length (higher number = greater accuracy = longer process)
         * */
        public function cubicBezier ( x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, x3:int, y3:int, c:Number, resolution:int = 5 ):void
        {
            var ox:Number = x0;
            var oy:Number = y0;
            var px:int;
            var py:int;
            var dist:Number = 0;

            var inverse:Number = 1 / resolution;
            var interval:Number;
            var intervalSq:Number;
            var intervalCu:Number;
            var diff:Number;
            var diffSq:Number;
            var diffCu:Number;
            var i:int = 0;

            while( ++i <= resolution )
            {
                interval = inverse * i;
                intervalSq = interval * interval;
                intervalCu = intervalSq * interval;
                diff = 1 - interval;
                diffSq = diff * diff;
                diffCu = diffSq * diff;

                px = diffCu * x0 + 3 * interval * diffSq * x1 + 3 * x2 * intervalSq * diff + x3 * intervalCu;
                py = diffCu * y0 + 3 * interval * diffSq * y1 + 3 * y2 * intervalSq * diff + y3 * intervalCu;

                dist += Math.sqrt( ( px - ox ) * ( px - ox ) + ( py - oy ) * ( py - oy ) );

                ox = px;
                oy = py;
            }

            //approximates the length of the curve
            var curveLength:int = dist;
            inverse = 1 / curveLength;

            var lastx:int=x0;
            var lasty:int=y0;

            i = -1;

            while( ++i <= curveLength )
            {
                interval = inverse * i;
                intervalSq = interval * interval;
                intervalCu = intervalSq * interval;
                diff = 1 - interval;
                diffSq = diff * diff;
                diffCu = diffSq * diff;

                px = diffCu * x0 + 3 * interval * diffSq * x1 + 3 * x2 * intervalSq * diff + x3 * intervalCu;
                py = diffCu * y0 + 3 * interval * diffSq * y1 + 3 * y2 * intervalSq * diff + y3 * intervalCu;

                line(lastx,lasty,px,py,c);
                lastx = px;
                lasty = py;
            }
        }

        // ------------------------------------------------
        //
        // ---o private static methods
        //
        // ------------------------------------------------

        /**
        * Draw an AA pixel
        */
        private function setAAPixel (x:Number, y:Number, c:Number, roundX : Boolean = false, roundY : Boolean = false):void
        {   
            var xpos    : Number = Math.floor(x);
            var ypos    : Number = Math.floor(y);
            var xA      : Number = x - xpos;
            var yA      : Number = y - ypos;
            if (!roundX && !roundY)
            {
                drawAlphaPixel(xpos     , ypos      , (1 - xA) * (1 - yA)   , c);
                drawAlphaPixel(xpos + 1 , ypos      , xA * (1 - yA)         , c);
                drawAlphaPixel(xpos     , ypos + 1  , (1 - xA) * yA         , c);
                drawAlphaPixel(xpos + 1 , ypos + 1  , xA * yA               , c);
            }
            else if (roundX && !roundY)
            {
                drawAlphaPixel(xpos     , ypos      , (1 - yA)              , c);
                drawAlphaPixel(xpos     , ypos + 1  , yA                    , c);
            }
            else if (roundY && !roundX)
            {
                drawAlphaPixel(xpos     , ypos      , (1 - xA)              , c);
                drawAlphaPixel(xpos + 1 , ypos      , xA                    , c);
            }
            else if (roundX && roundY)
            {
                setPixel32(xpos , ypos  , c);
            }
        }

        /**
        * Draw an alpha32 pixel
        */
        private function drawAlphaPixel ( x:int, y:int, a:Number, c:Number, bg : int = -1 ):void
        {   
            //var g:uint = getPixel32(x,y);
            var g : int = 0xff000000;

            var r0:uint = ((g & 0x00FF0000) >> 16);
            var g0:uint = ((g & 0x0000FF00) >> 8);
            var b0:uint = ((g & 0x000000FF));

            var r1:uint = ((c & 0x00FF0000) >> 16);
            var g1:uint = ((c & 0x0000FF00) >> 8);
            var b1:uint = ((c & 0x000000FF));

            var ac:Number = 0xFF;
            var rc:Number = r1*a+r0*(1-a);
            var gc:Number = g1*a+g0*(1-a);
            var bc:Number = b1*a+b0*(1-a);

            var n:uint = (ac<<24)+(rc<<16)+(gc<<8)+bc;
            setPixel32(x,y,n);
        }

        /**
        * Check a triangle line
        */
        private function checkLine ( o:Array, x:int, y:int, c:int, r:Rectangle ):void
        {
            if (o[y])
            {
                if (o[y]>x)
                {
                    r.width=o[y]-x;
                    r.x=x;
                    r.y=y;
                    fillRect(r,c);
                }else
                {
                    r.width=x-o[y];
                    r.x=o[y];
                    r.y=y;
                    fillRect(r,c);
                }
            }else
            {
                o[y]=x;
            }
        }

        /**
        * Special line for filled triangle
        */
        private function lineTri ( o:Array, x0:int, y0:int, x1:int, y1:int, c:Number ):void
        {
            var steep:Boolean= (y1-y0)*(y1-y0) > (x1-x0)*(x1-x0);
            var swap:int;

            if (steep)
            {
                swap=x0; x0=y0; y0=swap;
                swap=x1; x1=y1; y1=swap;
            }

            if (x0>x1)
            {
                x0^=x1; x1^=x0; x0^=x1;
                y0^=y1; y1^=y0; y0^=y1;
            }

            var deltax:int = x1 - x0
            var deltay:int = (y1 - y0) < 0 ? -(y1 - y0) : (y1 - y0);
            var error:int = 0;
            var y:int = y0;         
            var ystep:int = y0<y1 ? 1 : -1;
            var x:int = x0;
            var xend:int = x1-(deltax>>1);
            var fx:int = x1;
            var fy:int = y1;
            var px:int = 0;
            r.x = 0;
            r.y = 0;
            r.width = 0;
            r.height = 1;

            while (x++<=xend)
            {
                if (steep)
                {
                    checkLine(o,y,x,c,r);
                    if (fx != x1 && fx != xend)
                        checkLine(o,fy,fx+1,c,r);
                }

                error += deltay;
                if ((error<<1) >= deltax)
                {
                    if (!steep)
                    {
                        checkLine(o,x-px+1,y,c,r);
                        if (fx!=xend) 
                            checkLine(o,fx+1,fy,c,r);
                    }
                    px = 0;
                    y += ystep;
                    fy -= ystep;
                    error -= deltax; 
                }
                px++;
                fx--;
            }

            if (!steep)
                checkLine(o,x-px+1,y,c,r);
        }
    }       
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:18:33+00:00Added an answer on June 12, 2026 at 12:18 am

    Looks like just a typo or copy/paste error. The import statement should not be repeated inside your class definition:

    package views 
    {
        import flash.display.Bitmap;
        import flash.geom.Point;
        import views.Canvas.Raster; // Yes
        /**
         * ...
         * @author Arthur Wulf White
         */
        public class RasterView extends Bitmap
        {   
            import views.Canvas.Raster // No
    

    Also, avoid having an accessor with the same name as a class:

        public function get Raster():Raster  // Call this function get MyRaster or similar
        {
            return Raster(bitmapData);
        }
    

    Code highlighting is your friend. Any time a property or function name other than your constructor lights up in Cyan, it means you’re using an existing class name, which may cause problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the full error report that is generated when tried to compile my
The full error message is: The Project 'my.project.name' is under source control. An error
The full error I'm getting is this: error: ambiguous overload for ‘operator[]’ in ‘a[boost::_bi::storage4<A1,
Can anyone help me with this error? alt text http://abbeylegal.com/downloads/parsererror.jpg full image here It
THIS IS THE FULL SCRIPT http://goo.gl/HoCxk I have a problem with this function: $('.message').click(function(){
When I try to export my android application, I get this error message.. [2012-05-02
Is there a way that this full-text searching query could be translated from MySQL
Full disclosure: this is for an assignment, so please don't post actual code solutions!
Full disclosure : This is for a homework assignment. This is driving me nuts.
So I've got this JavaScript array full of fifty YouTube video id's and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.