Commit 44071acf authored by dickelbeck's avatar dickelbeck
Browse files

Lorenzo's postscript fill patch for bugs 2003834 and 1956732

parent 0cdcd78b
Loading
Loading
Loading
Loading
+18 −2
Original line number Original line Diff line number Diff line
@@ -68,9 +68,25 @@ bool CloseFileHPGL( FILE* plot_file )
    return TRUE;
    return TRUE;
}
}


/************************************************************/
void PlotRectHPGL( wxPoint p1, wxPoint p2, int fill, int width )
/************************************************************/
{
    char Line[256];

    UserToDeviceCoordinate( p1 );
    UserToDeviceCoordinate( p2 );

    Plume_HPGL( 'U' );
    sprintf( Line, "PA %d,%d;EA %d,%d;\n", p1.x, p1.y, p2.x, p2.y );
    fputs( Line, PlotOutputFile );

    Plume_HPGL( 'U' ); return;
}



/************************************************************/
/************************************************************/
void PlotCircle_HPGL( wxPoint centre, int diameter, int width )
void PlotCircleHPGL( wxPoint centre, int diameter, int fill, int width )
/************************************************************/
/************************************************************/
{
{
    int  rayon;
    int  rayon;
@@ -91,7 +107,7 @@ void PlotCircle_HPGL( wxPoint centre, int diameter, int width )




/********************************************************************/
/********************************************************************/
void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, int fill, int width )
/********************************************************************/
/********************************************************************/


/* trace d'un arc de cercle:
/* trace d'un arc de cercle:
+34 −13
Original line number Original line Diff line number Diff line
@@ -113,9 +113,20 @@ void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width )
    fprintf( PlotOutputFile, "%d %d %d %d line\n", start.x, start.y, end.x, end.y );
    fprintf( PlotOutputFile, "%d %d %d %d line\n", start.x, start.y, end.x, end.y );
}
}


/***************************************************************/
void PlotRectPS( wxPoint p1, wxPoint p2, int fill, int width )
/***************************************************************/
{
    UserToDeviceCoordinate( p1 );
    UserToDeviceCoordinate( p2 );

    SetCurrentLineWidthPS( width );
    fprintf( PlotOutputFile, "%d %d %d %d rect%d\n", p1.x, p1.y, 
	p2.x-p1.x, p2.y-p1.y, fill );
}


/******************************************************/
/******************************************************/
void PlotCircle_PS( wxPoint pos, int diametre, int width )
void PlotCirclePS( wxPoint pos, int diametre, int fill, int width )
/******************************************************/
/******************************************************/
{
{
    int  rayon;
    int  rayon;
@@ -128,13 +139,13 @@ void PlotCircle_PS( wxPoint pos, int diametre, int width )
        rayon = 0;
        rayon = 0;


    SetCurrentLineWidthPS( width );
    SetCurrentLineWidthPS( width );
    sprintf( Line, "newpath %d %d %d 0 360 arc stroke\n", pos.x, pos.y, rayon );
    sprintf(Line, "%d %d %d cir%d\n", pos.x, pos.y, rayon, fill);
    fputs( Line, PlotOutputFile );
    fputs( Line, PlotOutputFile );
}
}




/**************************************************************************************/
/**************************************************************************************/
void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int fill, int width )
/**************************************************************************************/
/**************************************************************************************/


/* Plot an arc:
/* Plot an arc:
@@ -152,11 +163,13 @@ void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width
    UserToDeviceCoordinate( centre );
    UserToDeviceCoordinate( centre );


    if( PlotOrientOptions == PLOT_MIROIR )
    if( PlotOrientOptions == PLOT_MIROIR )
        sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
        sprintf( Line, "%d %d %d %f %f arc%d\n", centre.x, centre.y,
            (int) (rayon * XScale), (float) StAngle / 10, (float) EndAngle / 10 );
            (int) (rayon * XScale), (float) StAngle / 10, (float) EndAngle / 10,
	    fill);
    else
    else
        sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
        sprintf( Line, "%d %d %d %f %f arc%d\n", centre.x, centre.y,
            (int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10 );
            (int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10,
	    fill);


    // Undo internationalization printf (float x.y printed x,y)
    // Undo internationalization printf (float x.y printed x,y)
    to_point( Line );
    to_point( Line );
@@ -197,11 +210,7 @@ void PlotPolyPS( int nb_segm, int* coord, int fill, int width )
    }
    }


    // Fermeture du polygone
    // Fermeture du polygone
    if( fill )
    fprintf(PlotOutputFile, "poly%d\n", fill);
        fprintf( PlotOutputFile, "closepath " );
    if( fill == 1 )
        fprintf( PlotOutputFile, "fill " );
    fprintf( PlotOutputFile, "stroke\n" );
}
}




@@ -260,7 +269,19 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
        "    moveto\n",
        "    moveto\n",
        "    lineto\n",
        "    lineto\n",
        "    stroke\n",
        "    stroke\n",
        "} def\n",
        "} bind def\n",
	"/cir0 { newpath 0 360 arc stroke } bind def\n",
	"/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
	"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
	"/arc0 { newpath arc stroke } bind def\n",
	"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill grestore stroke } bind def\n",
	"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill grestore stroke } bind def\n",
	"/poly0 { stroke } bind def\n",
	"/poly1 { closepath gsave fill grestore stroke } bind def\n",
	"/poly2 { closepath gsave fill grestore stroke } bind def\n",
	"/rect0 { rectstroke } bind def\n",
	"/rect1 { rectfill } bind def\n",
	"/rect2 { rectfill } bind def\n",
        "gsave\n",
        "gsave\n",
        "72 72 scale\t\t\t% Talk inches\n",
        "72 72 scale\t\t\t% Talk inches\n",
        "1 setlinecap\n",
        "1 setlinecap\n",
+26 −16
Original line number Original line Diff line number Diff line
@@ -73,9 +73,24 @@ void SetCurrentLineWidth( int width )
    }
    }
}
}


/*******************************************************************************/
void PlotRect( wxPoint p1, wxPoint p2, int fill, int width )
/*******************************************************************************/
{
    switch( g_PlotFormat )
    {
    case PLOT_FORMAT_HPGL:
        PlotRectHPGL( p1, p2, fill, width );
        break;

    case PLOT_FORMAT_POST:
        PlotRectPS( p1, p2, fill, width );
        break;
    }
}


/*******************************************************************************/
/*******************************************************************************/
void PlotArc( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
void PlotArc( wxPoint centre, int StAngle, int EndAngle, int rayon, int fill, int width )
/*******************************************************************************/
/*******************************************************************************/


/* trace d'un arc de cercle:
/* trace d'un arc de cercle:
@@ -87,28 +102,28 @@ void PlotArc( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
    switch( g_PlotFormat )
    switch( g_PlotFormat )
    {
    {
    case PLOT_FORMAT_HPGL:
    case PLOT_FORMAT_HPGL:
        PlotArcHPGL( centre, StAngle, EndAngle, rayon, width );
        PlotArcHPGL( centre, StAngle, EndAngle, rayon, fill, width );
        break;
        break;


    case PLOT_FORMAT_POST:
    case PLOT_FORMAT_POST:
        PlotArcPS( centre, StAngle, EndAngle, rayon, width );
        PlotArcPS( centre, StAngle, EndAngle, rayon, fill, width );
        break;
        break;
    }
    }
}
}




/*******************************************************/
/*******************************************************/
void PlotCercle( wxPoint pos, int diametre, int width )
void PlotCercle( wxPoint pos, int diametre, int fill, int width )
/*******************************************************/
/*******************************************************/
{
{
    switch( g_PlotFormat )
    switch( g_PlotFormat )
    {
    {
    case PLOT_FORMAT_HPGL:
    case PLOT_FORMAT_HPGL:
        PlotCircle_HPGL( pos, diametre, width );
        PlotCircleHPGL( pos, diametre, fill, width );
        break;
        break;


    case PLOT_FORMAT_POST:
    case PLOT_FORMAT_POST:
        PlotCircle_PS( pos, diametre, width );
        PlotCirclePS( pos, diametre, fill, width );
        break;
        break;
    }
    }
}
}
@@ -204,7 +219,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
            pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
            pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
                    TransMat[1][1] * Arc->m_Pos.y;
                    TransMat[1][1] * Arc->m_Pos.y;
            MapAngles( &t1, &t2, TransMat );
            MapAngles( &t1, &t2, TransMat );
            PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Width );
            PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill, Arc->m_Width );
        }
        }
            break;
            break;


@@ -215,7 +230,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
                    TransMat[0][1] * Circle->m_Pos.y;
                    TransMat[0][1] * Circle->m_Pos.y;
            pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
            pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
                    TransMat[1][1] * Circle->m_Pos.y;
                    TransMat[1][1] * Circle->m_Pos.y;
            PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Width );
            PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill, Circle->m_Width );
        }
        }
            break;
            break;


@@ -251,12 +266,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
            y2 = PartY + TransMat[1][0] * Square->m_End.x
            y2 = PartY + TransMat[1][0] * Square->m_End.x
                 + TransMat[1][1] * Square->m_End.y;
                 + TransMat[1][1] * Square->m_End.y;


            SetCurrentLineWidth( Square->m_Width );
            PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), Square->m_Fill, Square->m_Width );
            Move_Plume( wxPoint( x1, y1 ), 'U' );
            Move_Plume( wxPoint( x1, y2 ), 'D' );
            Move_Plume( wxPoint( x2, y2 ), 'D' );
            Move_Plume( wxPoint( x2, y1 ), 'D' );
            Move_Plume( wxPoint( x1, y1 ), 'D' );
        }
        }
            break;
            break;


@@ -470,7 +480,7 @@ static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape )
    {
    {
        PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
        PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
                             MapY1 * INVERT_PIN_RADIUS + y1),
                             MapY1 * INVERT_PIN_RADIUS + y1),
                    INVERT_PIN_RADIUS * 2 );
                    INVERT_PIN_RADIUS * 2,0 );


        Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
        Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
                             MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
                             MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
+1 −1
Original line number Original line Diff line number Diff line
@@ -677,7 +677,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FullFileName,
                #undef STRUCT
                #undef STRUCT
                #define STRUCT ( (DrawJunctionStruct*) DrawList )
                #define STRUCT ( (DrawJunctionStruct*) DrawList )
            x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
            x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
            PlotCercle( wxPoint( x1, y1 ), DRAWJUNCTION_SIZE * 2 );
            PlotCercle( wxPoint( x1, y1 ), DRAWJUNCTION_SIZE * 2, 1 );
            break;
            break;


        case TYPE_SCH_TEXT:
        case TYPE_SCH_TEXT:
+1 −1
Original line number Original line Diff line number Diff line
@@ -559,7 +559,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
                #define STRUCT ( (DrawJunctionStruct*) DrawList )
                #define STRUCT ( (DrawJunctionStruct*) DrawList )
            if( g_PlotPSColorOpt )
            if( g_PlotPSColorOpt )
                SetColorMapPS( ReturnLayerColor( STRUCT->GetLayer() ) );
                SetColorMapPS( ReturnLayerColor( STRUCT->GetLayer() ) );
            PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE );
            PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE, 1 );
            break;
            break;


        case TYPE_SCH_TEXT:
        case TYPE_SCH_TEXT:
Loading