BOOL MovePen( PPDEV pPDev, PPOINTFIX pPtNewPos, PPOINTL pPtDevPos ) /*++ Routine Description: This function sends the HPGL code for the requested pen. Arguments: pPDev - Pointer to the PDEV data structure pPtNewPos - The location pen will move to, this is in 28.4 fix notation pPtDevPos - The new device coordinate device position Return Value: TRUE if sucessful FALSE otherwise Author: 1:04 on Tue 7 Nov 1989 Added this commentary, and area fill optimization code. 30-Nov-1993 Tue 22:05:32 updated Update, commented and clean up style 16-Feb-1994 Wed 17:10:54 updated Re-write to get rid of the physical position Revision History: --*/ { POINTL ptDevPos; ptDevPos.x = FXTODEVL(pPDev, pPtNewPos->x); ptDevPos.y = FXTODEVL(pPDev, pPtNewPos->y); if (pPtDevPos) { *pPtDevPos = ptDevPos; } PLOTDBG( DBG_MOVEPEN, ("MovePen: Moving Absolute to FIX = [X=%d,%d] Device = [X=%d, Y=%d]", pPtNewPos->x, pPtNewPos->y, ptDevPos.x, ptDevPos.y )); return(OutputFormatStr(pPDev, "PE<=#D#D;", ptDevPos.x, ptDevPos.y)); }
VOID SelectColor( PPDEV pPDev, DWORD Color, INTDECIW PenWidth ) /*++ Routine Description: This function is responsible for handling the mechanism of supporting RGB colors on plotters that support this. This is done by using a preset pallete position that the engine does not know about, and constantly update it with the correct color. Arguments: pPDev - Pointer to the PDEV data structure Color - Color to be selected PenWidth - INTDECIW data structrue to specified the pen width Return Value: VOID Author: 30-Nov-1993 Tue 22:15:12 created 12-Apr-1994 Tue 14:35:44 updated Update to take pen plotter into account and take care the error cases Revision History: --*/ { PLOTASSERT(1, "SelectColor: Invalid RGB Color [%08lx] for Raster DEVICE", Color != CLR_INVALID, Color); if (Color == CLR_INVALID) { // // Make it white // Color = (DWORD)(IS_RASTER(pPDev) ? 0x00FFFFFF : WHITE_INDEX); } if (IS_RASTER(pPDev)) { Color = (DWORD)FindCachedPen(pPDev, (PPALENTRY)&Color); } else { if (Color > (DWORD)pPDev->pPlotGPC->Pens.Count) { Color = (DWORD)pPDev->BrightestPen; PLOTDBG(DBG_SELECTCOLOR, ("SelectColor: !!! Match to Closest WHITE PEN=%ld", Color)); PLOTASSERT(1, "SelectColor: Invalid Pen Index [%08ld] for PEN DEVICE", (Color <= (DWORD)pPDev->pPlotGPC->Pens.Count), Color); if (Color > (DWORD)pPDev->pPlotGPC->Pens.Count) { Color = WHITE_INDEX; } } } // // Verify were not selecting the current pen // if (Color != (DWORD)pPDev->CurPenSelected) { PLOTDBG(DBG_SELECTCOLOR, ("SelectColor: Current Pen [%ld] != new PEN [%ld]", pPDev->CurPenSelected, Color)); OutputFormatStr(pPDev,"SP#d", (LONG)Color); pPDev->CurPenSelected = (LONG)Color; } else { PLOTDBG(DBG_SELECTCOLOR, ("SelectColor: Current Pen == new PEN [%ld]", Color)); } // // Set the correct pen width in the target device. This will change // the pen width for all pens. // if ((PenWidth.Integer != pPDev->PenWidth.Integer) || (PenWidth.Decimal != pPDev->PenWidth.Decimal)) { // // Now send the optimal pen width number command to the target device. // OutputString(pPDev, "PW"); if ((PenWidth.Integer) || (PenWidth.Decimal == 0)) { // // This will make the following cases // // 1. 0.0 ---> 0 // 2. 3.2 ---> 3 // 3. 3.0 ---> 3 OutputFormatStr(pPDev, "#d", PenWidth.Integer); } if (PenWidth.Decimal) { // // Do all DECI part as .xx // OutputFormatStr(pPDev, ".#d", PenWidth.Decimal); } PLOTDBG(DBG_SELECTCOLOR, ("SelectColor: PEN WIDTH Change from %ld.%ldmm to %ld.%ldmm", (DWORD)pPDev->PenWidth.Integer, (DWORD)pPDev->PenWidth.Decimal, (DWORD)PenWidth.Integer, (DWORD)PenWidth.Decimal)); // // Update the pen width cache // pPDev->PenWidth = PenWidth; } else { PLOTDBG(DBG_SELECTCOLOR, ("SelectColor: PEN WIDTH is SAME = %ld.%ld", PenWidth.Integer, PenWidth.Decimal)); } }