⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qblackraster.c

📁 奇趣公司比较新的qt/emd版本
💻 C
📖 第 1 页 / 共 5 页
字号:
                *top++     = arc[0].x;                QT_FT_TRACE6("  x=%f y=%f\n", FIXED_TO_FLOAT(arc[0].x), FIXED_TO_FLOAT(e));                e += precision;            }            arc -= degree;        }    }Fin:    ras.top  = top;    ras.arc -= degree;    QT_FT_TRACE6("    currently %d points in profile, start=%ld top=%p\n", (int)(ras.top - ras.cProfile->offset), ras.cProfile->start, ras.top);    return SUCCESS;}/*************************************************************************//*                                                                       *//* <Function>                                                            *//*    Bezier_Down                                                        *//*                                                                       *//* <Description>                                                         *//*    Computes the x-coordinates of an descending Bezier arc and stores  *//*    them in the render pool.                                           *//*                                                                       *//* <Input>                                                               *//*    degree   :: The degree of the Bezier arc (either 2 or 3).          *//*                                                                       *//*    splitter :: The function to split Bezier arcs.                     *//*                                                                       *//*    miny     :: A lower vertical clipping bound value.                 *//*                                                                       *//*    maxy     :: An upper vertical clipping bound value.                *//*                                                                       *//* <Return>                                                              *//*    SUCCESS on success, FAILURE on render pool overflow.               *//*                                                                       */static BoolBezier_Down( TRaster_Instance*  raster, Int        degree,             TSplitter  splitter,             Long       miny,             Long       maxy ){    TPoint*  arc = ras.arc;    Bool     result, fresh;    arc[0].y = -arc[0].y;    arc[1].y = -arc[1].y;    arc[2].y = -arc[2].y;    if ( degree > 2 )        arc[3].y = -arc[3].y;    fresh = ras.fresh;    result = Bezier_Up( raster, degree, splitter, -maxy, -miny );    if ( fresh && !ras.fresh )        ras.cProfile->start = -ras.cProfile->start;    arc[0].y = -arc[0].y;    return result;}/*************************************************************************//*                                                                       *//* <Function>                                                            *//*    Line_To                                                            *//*                                                                       *//* <Description>                                                         *//*    Injects a new line segment and adjusts Profiles list.              *//*                                                                       *//* <Input>                                                               *//*   x :: The x-coordinate of the segment's end point (its start point   *//*        is stored in `LastX').                                         *//*                                                                       *//*   y :: The y-coordinate of the segment's end point (its start point   *//*        is stored in `LastY').                                         *//*                                                                       *//* <Return>                                                              *//*   SUCCESS on success, FAILURE on render pool overflow or incorrect    *//*   profile.                                                            *//*                                                                       */static BoolLine_To( TRaster_Instance*  raster, Long  x,         Long  y ){    /* First, detect a change of direction */    QT_FT_TRACE6( "Line_To (%f/%f)->(%f/%f)\n", FIXED_TO_FLOAT(ras.lastX), FIXED_TO_FLOAT(ras.lastY), FIXED_TO_FLOAT(x), FIXED_TO_FLOAT(y) );    switch ( ras.state )    {    case Unknown_State:        if ( y > ras.lastY )        {            if ( New_Profile( raster, Ascending_State ) )                return FAILURE;        }        else        {            if ( y < ras.lastY )                if ( New_Profile( raster, Descending_State ) )                    return FAILURE;        }        break;    case Ascending_State:        if ( y < ras.lastY )        {            if ( End_Profile( raster )                   ||                 New_Profile( raster, Descending_State ) )                return FAILURE;        }        break;    case Descending_State:        if ( y > ras.lastY )        {            if ( End_Profile( raster )                  ||                 New_Profile( raster, Ascending_State ) )                return FAILURE;        }        break;    default:        ;    }    /* Then compute the lines */    switch ( ras.state )    {    case Ascending_State:        if ( Line_Up( raster, ras.lastX, ras.lastY,                      x, y, ras.minY, ras.maxY ) )            return FAILURE;        break;    case Descending_State:        if ( Line_Down( raster, ras.lastX, ras.lastY,                        x, y, ras.minY, ras.maxY ) )            return FAILURE;        break;    default:        ;    }    ras.lastX = x;    ras.lastY = y;    return SUCCESS;}/*************************************************************************//*                                                                       *//* <Function>                                                            *//*    Conic_To                                                           *//*                                                                       *//* <Description>                                                         *//*    Injects a new conic arc and adjusts the profile list.              *//*                                                                       *//* <Input>                                                               *//*   cx :: The x-coordinate of the arc's new control point.              *//*                                                                       *//*   cy :: The y-coordinate of the arc's new control point.              *//*                                                                       *//*   x  :: The x-coordinate of the arc's end point (its start point is   *//*         stored in `LastX').                                           *//*                                                                       *//*   y  :: The y-coordinate of the arc's end point (its start point is   *//*         stored in `LastY').                                           *//*                                                                       *//* <Return>                                                              *//*   SUCCESS on success, FAILURE on render pool overflow or incorrect    *//*   profile.                                                            *//*                                                                       */static BoolConic_To( TRaster_Instance*  raster, Long  cx,          Long  cy,          Long  x,          Long  y ){    Long     y1, y2, y3, x3, ymin, ymax;    TStates  state_bez;    QT_FT_TRACE6( "Conic_To (%f/%f)-(%f/%f)\n", FIXED_TO_FLOAT(cx), FIXED_TO_FLOAT(cy), FIXED_TO_FLOAT(x), FIXED_TO_FLOAT(y) );    ras.arc      = ras.arcs;    ras.arc[2].x = ras.lastX;    ras.arc[2].y = ras.lastY;    ras.arc[1].x = cx; ras.arc[1].y = cy;    ras.arc[0].x = x;  ras.arc[0].y = y;    do    {        y1 = ras.arc[2].y;        y2 = ras.arc[1].y;        y3 = ras.arc[0].y;        x3 = ras.arc[0].x;        /* first, categorize the Bezier arc */        if ( y1 <= y3 )        {            ymin = y1;            ymax = y3;        }        else        {            ymin = y3;            ymax = y1;        }        if ( y2 < ymin || y2 > ymax )        {            /* this arc has no given direction, split it! */            Split_Conic( ras.arc );            ras.arc += 2;        }        else if ( y1 == y3 )        {            /* this arc is flat, ignore it and pop it from the Bezier stack */            ras.arc -= 2;        }        else        {            /* the arc is y-monotonous, either ascending or descending */            /* detect a change of direction                            */            state_bez = y1 < y3 ? Ascending_State : Descending_State;            if ( ras.state != state_bez )            {                /* finalize current profile if any */                if ( ras.state != Unknown_State   &&                     End_Profile( raster ) )                    goto Fail;                /* create a new profile */                if ( New_Profile( raster, state_bez ) )                    goto Fail;            }            /* now call the appropriate routine */            if ( state_bez == Ascending_State )            {                if ( Bezier_Up( raster, 2, Split_Conic, ras.minY, ras.maxY ) )                    goto Fail;            }            else                if ( Bezier_Down( raster, 2, Split_Conic, ras.minY, ras.maxY ) )                    goto Fail;        }    } while ( ras.arc >= ras.arcs );    ras.lastX = x3;    ras.lastY = y3;    return SUCCESS;Fail:    return FAILURE;}/*************************************************************************//*                                                                       *//* <Function>                                                            *//*    Cubic_To                                                           *//*                                                                       *//* <Description>                                                         *//*    Injects a new cubic arc and adjusts the profile list.              *//*                                                                       *//* <Input>                                                               *//*   cx1 :: The x-coordinate of the arc's first new control point.       *//*                                                                       *//*   cy1 :: The y-coordinate of the arc's first new control point.       *//*                                                                       *//*   cx2 :: The x-coordinate of the arc's second new control point.      *//*                                                                       *//*   cy2 :: The y-coordinate of the arc's second new control point.      *//*                                                                       *//*   x   :: The x-coordinate of the arc's end point (its start point is  *//*          stored in `LastX').                                          *//*                                                                       *//*   y   :: The y-coordinate of the arc's end point (its start point is  *//*          stored in `LastY').                                          *//*                                                                       *//* <Return>                                                              *//*   SUCCESS on success, FAILURE on render pool overflow or incorrect    *//*   profile.                                                            *//*                                                                       */static BoolCubic_To( TRaster_Instance*  raster, Long  cx1,          Long  cy1,          Long  cx2,          Long  cy2,          Long  x,          Long  y ){    Long     y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;    TStates  state_bez;    QT_FT_TRACE6( "Cubic_To (%f/%f)-(%f/%f)-(%f/%f)-(%f/%f)\n",                  FIXED_TO_FLOAT(ras.lastX), FIXED_TO_FLOAT(ras.lastY), FIXED_TO_FLOAT(cx1), FIXED_TO_FLOAT(cy1), FIXED_TO_FLOAT(cx2), FIXED_TO_FLOAT(cy2), FIXED_TO_FLOAT(x), FIXED_TO_FLOAT(y) );    ras.arc      = ras.arcs;    ras.arc[3].x = ras.lastX;    ras.arc[3].y = ras.lastY;    ras.arc[2].x = cx1; ras.arc[2].y = cy1;    ras.arc[1].x = cx2; ras.arc[1].y = cy2;    ras.arc[0].x = x;   ras.arc[0].y = y;    do    {        y1 = ras.arc[3].y;        y2 = ras.arc[2].y;        y3 = ras.arc[1].y;        y4 = ras.arc[0].y;        x4 = ras.arc[0].x;        /* first, categorize the Bezier arc */        if ( y1 <= y4 )        {            ymin1 = y1;            ymax1 = y4;        }        else        {            ymin1 = y4;            ymax1 = y1;        }        if ( y2 <= y3 )        {            ymin2 = y2;            ymax2 = y3;        }        else        {            ymin2 = y3;            ymax2 = y2;        }        if ( ymin2 < ymin1 || ymax2 > ymax1 )        {            /* this arc has no given direction, split it! */            Split_Cubic( ras.arc );            ras.arc += 3;        }        else if ( y1 == y4 )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -