コード例 #1
0
void setTNGfont(HPS hps)
{
    LONG         cFonts;
    LONG         lTemp = 0L;
    CHAR         fontName[25];
    FATTRS       fattrs;
    SIZEF        sizfCharBox;

    fattrs.usRecordLength  = sizeof(FATTRS);
    fattrs.fsSelection     = 0;
    fattrs.lMatch          = 0L;
    fattrs.idRegistry      = 0;
    fattrs.usCodePage      = 850;
    fattrs.lMaxBaselineExt = 0L;
    fattrs.lAveCharWidth   = 0L;
    fattrs.fsType          = 0;
    fattrs.fsFontUse       = FATTR_FONTUSE_OUTLINE;
    strcpy(fattrs.szFacename,TNG_FONT);

    cFonts = GpiQueryFonts(hps, QF_PUBLIC,fattrs.szFacename, &lTemp,
             (LONG) sizeof(FONTMETRICS), (PFONTMETRICS)NULL);
    if (cFonts==0)
    {
        strcpy(fattrs.szFacename,"Helvetica");
    }

    GpiCreateLogFont(hps, (PSTR8)NULL, fontId, &fattrs);
    GpiSetCharSet(hps,fontId);

    sizfCharBox.cx=MAKEFIXED(14,0);
    sizfCharBox.cy=MAKEFIXED(20,0); 
    GpiSetCharBox(hps,&sizfCharBox);
    GpiSetTextAlignment(hps,TA_CENTER,TA_TOP);
}
コード例 #2
0
void XMarker::SetupDevice( XGraphicDevice * dev)
{
   XGraphicObject::SetupDevice(dev);
   if (dev->markerType != type)
   {
      dev->markerType = type;
      GpiSetMarker(dev->hps, type);
   }
   SIZEF s;

   s.cx = MAKEFIXED(size.GetWidth(), 0);
   s.cy = MAKEFIXED(size.GetHeight(), 0);
   GpiSetMarkerBox(dev->hps, &s);
}
コード例 #3
0
ファイル: PRNAPI.C プロジェクト: OS2World/DEV-SAMPLES-DBCS
LONG ScaleFont(HPS hPS,	CHAR *pszFacename, LONG	lSize)

{
FATTRS fat;			   /* Font Attributes			*/
SIZEF  sizfxBox;		   /* Character	Size Holder		*/

		       /* Complete the font attributes structure to	*/
		       /* allow	the selection of the font requested	*/
		       /* within the print file	dialogue box		*/

memset(&fat, 0,	sizeof(FATTRS));
fat.usRecordLength  = (USHORT)sizeof(FATTRS);
fat.lMatch	    = SelectScalableFont(hPS, strcpy(fat.szFacename, pszFacename));
fat.usCodePage	    = (USHORT)850;

		       /* Create the required font and set the		*/
		       /* character size by changing the character box	*/
		       /* size.	 The sizing in TWIPS for a 12 pt font	*/
		       /* is 240, therefore a 10 pt font would be 200.	*/

GpiCreateLogFont(hPS, (PSTR8)NULL, 2L, &fat);
GpiSetCharSet(hPS, 2L);

sizfxBox.cx = sizfxBox.cy = MAKEFIXED(lSize * 2, 0);

GpiSetCharBox(hPS, &sizfxBox);

return(2L);
}
/****************************************************************
 DefaultOutlineFont: Set an outline font which is sizeable.
****************************************************************/
void SetOutlineFont(HPS   hps,
                    short height)

{FONTMETRICS    fm[80];
 static FATTRS  fat;
 static LONG    cFonts=0;
 LONG           ltemp=0;
 SIZEF          size;
 int            i;
 
 if (height<=2)
   return;

 if (cFonts==0) {
    GpiLoadFonts(WinQueryAnchorBlock(HWND_DESKTOP),"helv");
    cFonts= GpiQueryFonts(hps,QF_PUBLIC|QF_PRIVATE,"Helv",&ltemp,
                  sizeof(FONTMETRICS),(PFONTMETRICS)0);
    if (cFonts>sizeof(fm)/sizeof(FONTMETRICS))
      cFonts=sizeof(fm)/sizeof(FONTMETRICS);
    GpiQueryFonts(hps,QF_PUBLIC|QF_PRIVATE,"Helv",&cFonts,
                  sizeof(FONTMETRICS),fm);
    for (i=0; (!(fm[i].fsDefn&FM_DEFN_OUTLINE)) &&     //find outline and
              (!(fm[i].fsType&FM_TYPE_KERNING))  &&    //kerned if can
              (i<cFonts); i++);
    if (i==cFonts)
      for (i=0; (!(fm[i].fsDefn&FM_DEFN_OUTLINE))&&  // Find outline atleast
                (i<cFonts); i++);
    if (i==cFonts)
      i=0;

    fat.usRecordLength =sizeof(FATTRS);
    fat.lMatch         =fm[i].lMatch;
    fat.lMatch         =0;
    fat.fsFontUse      = FATTR_FONTUSE_OUTLINE;
    strcpy(fat.szFacename,fm[i].szFacename);
   }

 GpiCreateLogFont(hps,(PSTR8)0,1,&fat);
 GpiSetBackMix(hps,(LONG)BM_LEAVEALONE);
 GpiSetCharSet(hps,1);
 size.cx = MAKEFIXED(height,0);
 size.cy = MAKEFIXED(height,0);
 GpiSetCharBox(hps,&size);
 GpiSetTextAlignment(hps,TA_NORMAL_HORIZ,TA_BOTTOM);
}
コード例 #5
0
void XArc::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
      SetupDevice(dev);

      POINTL po;
      po.x = p.x;
      po.y = p.y;
      GpiMove(dev->hps, &po);
      ARCPARAMS a;

      a.lQ = w;
      a.lP = h;
      a.lR = x;
      a.lS = y;

      GpiSetArcParams(dev->hps, &a);

      if (vis)
      {
         GpiBeginPath(dev->hps, 1);
         GpiPartialArc(dev->hps, &po, MAKEFIXED(1, 0), MAKEFIXED(st, 0), MAKEFIXED(en, 0));
         GpiLine(dev->hps, &po);
         GpiEndPath(dev->hps);
         if (filled)
            GpiFillPath(dev->hps, 1, FPATH_WINDING);
         else
            GpiOutlinePath(dev->hps, 1, 0);
      }
      else
      {
         POINTL pt[3];

//berechnen!
         pt[0].x = pt[0].y = 0;
         GpiMove(dev->hps, &pt[0]);
         pt[1].x = pt[1].y = 100;
         pt[2].x = 200;
         pt[2].y = 0;
         GpiPointArc(dev->hps, &pt[1]);
      }
   }
}
//--------------------------------------------------------------------------
//
// DrawTransformedBox
//
// --------------------------------------------------------------------------
void DrawTransformedBox( HWND hwnd )
{
  HPS hps;
  POINTL pointl;
  MATRIXLF m;

  // Get a cached PS for the window

  hps = WinGetPS( hwnd );

  // Query the current contents of the model transform

  GpiQueryModelTransformMatrix( hps, 9L, &m );

  m.lM31  = 100;                 // Translate the x coordinates
  m.lM32  = 100;                 // Translate the y coordinates
  m.fxM11 = MAKEFIXED(10,0);     // Scale up the x coordinates
  m.fxM22 = MAKEFIXED(10,0);     // Scale up the y coordinates

  // Replace the model transform with our modified one

  GpiSetModelTransformMatrix( hps, 9L, &m, TRANSFORM_REPLACE );


  // Set the current position to (0,0)

  pointl.x = pointl.y = 0;

  GpiSetCurrentPosition( hps, &pointl );

  // Draw a 10 by 10 box from the current position in the
  // current color.

  pointl.x = pointl.y = 10;

  GpiBox( hps, DRO_OUTLINE, &pointl,0,0 );

  // Free the cached PS

  WinReleasePS( hps );
}
コード例 #7
0
/**************************************************************************
 *
 *  Name       : DglKpyr(HPS* phps,int i, int j, long lColor)
 *
 *  Description: рисует кружок в любом месте
 *
 *  Concepts:  Получает указатель на пространство отображения
 *	       и рисует круг размером BmpSize с координатами
 *        i и j цвета  lColor
 *
 *  Parameters :  phps - указатель на hps
 *                i,j - координаты кружка
 *                lColor - цвет кружка
 *************************************************************************/
VOID DglKpyr(PHPS phps,int i, int j, long lColor)
{  ARCPARAMS ap = {1,1,0,0};//ровный круг
   POINTL ptl;//куда и откуда рисовать

   GpiSetArcParams(*phps,&ap);//ровный круг
   GpiSetColor(*phps,CLR_WHITE);//белый ободок
   ptl.x = j+bs/2;//центр круга
   ptl.y = i+bs/2-1;
   GpiMove(*phps,&ptl);//в центр круга
   GpiFullArc(*phps,DRO_OUTLINE,//рисуем ободок
      MAKEFIXED(bs/2,bs/2));
   GpiSetColor(*phps,lColor);//цвет внутренности
   GpiFullArc(*phps,DRO_FILL,//рисуем внутренность
      MAKEFIXED(bs/2-1,bs/2-1));
   if(st){//рисуем элемент 3D
      RECTL rec;//где рисовать
      rec.xLeft   = j+bs/2+1;
      rec.xRight  = j+bs/2+bs/4+1;
      rec.yBottom = i+bs/2;
      rec.yTop    = i+bs/2+bs/4;
      WinFillRect(*phps, &rec, CLR_WHITE);}
}   /* End of Kpyr */
コード例 #8
0
BOOL TapeLab::paintString(char* str,_fontinfo *font,int spc,PMPoint pos,PMPresSpace &ps)
{
	FONTMETRICS fm;
	PMLogFont f(ps,&font->fattrs);
	ps.setCharSet(f);

	SIZEF csize;
	csize.cy=MAKEFIXED(font->height*254L/72L,0);   // [punti] * [decimillimetri]/[pollice] * 1/[punti]/[pollice]
	csize.cx=(font->height << 16)*254L/72L;
	ps.setCharBox(&csize);
	ps.queryFontMetrics(&fm);	  // chiedi i fontmetrics

	pos.y += fm.lMaxDescender;    // e alza il font a causa del descender
	
	char* p=str,*start;
	int line=0,x=0,pageadj=0;
	while (*p) {		// finche' la str non finisce
		int len=0;
		start=p;
		while (*p!=0xd && *p!=0x9 && *p) { len++; p++; }  // cerca newline, tab, o fine str
		PMPoint off(x,-pageadj-( line*( ( font->height * spc / 1000L ) + font->extleading ) *254L /72L)  );	   // calcola posizione
		off=off+pos;

		if (off.y-fm.lMaxDescender<fixpoints[labelformat.size][6].y && pageadj==0) { // siamo passati sulla nuova pagina, aggiusta di conseguenza...
			pageadj=off.y-(pos.y-fixpoints[labelformat.size][4].y+fixpoints[labelformat.size][6].y);
			off.y-=pageadj;
		}		
		ps.charStringAt(&off,len,start);		   // stampa

		if (*p==0x9) { // tabba
			POINTL aptlPoints[TXTBOX_COUNT];
			p++;
			ps.queryTextBox (len,start, TXTBOX_COUNT, aptlPoints);
			x+=(aptlPoints[TXTBOX_TOPRIGHT].x/labelformat.form.tabsize + 1 )* labelformat.form.tabsize; 

		} else {
			line++;
			x=0;		// ritorno a capo significa eliminare offset x
			if (*p==0xd) p++;					   // skippa 0xd
			if (*p==0xa) p++;					   // skippa 0xa
		}
	}
	return TRUE;
}
//--------------------------------------------------------------------------
//
// DrawShearedBox
//
// --------------------------------------------------------------------------
void DrawShearedBox( HWND hwnd )
{
  HPS hps;
  POINTL pointl;
  MATRIXLF m;

  // Get a cached PS for the window

  hps = WinGetPS( hwnd );

  // Query the current contents of the model transform

  GpiQueryModelTransformMatrix( hps, 9L, &m );

  m.fxM21 = MAKEFIXED(1,0); // tan(45)
 // m.fxM22 = MAKEFIXED(1,0); // identity

  // Replace the model transform with our modified one

  GpiSetModelTransformMatrix( hps, 9L, &m, TRANSFORM_REPLACE );


  // Set the current position to (0,100)

  pointl.x = 400; pointl.y = 200;

  GpiSetCurrentPosition( hps, &pointl );

  // Draw a 100 by 100 box from the current position in the
  // current color.

  pointl.x = pointl.y = 100;

  GpiSetColor( hps, CLR_BLUE );
  GpiSetPattern( hps, PATSYM_HALFTONE );

  GpiBox( hps, DRO_OUTLINEFILL, &pointl,0,0 );

  // Free the cached PS

  WinReleasePS( hps );
}
コード例 #10
0
void XCircle::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
//       SHORT modify = ( w> 10 ? 10 : 1);

      SetupDevice(dev);
      POINTL po;
      po.x = p.x;
      po.y = p.y;
      GpiMove(dev->hps, &po);
      ARCPARAMS a;

      a.lQ = w / 10;
      a.lP = h / 10;
      a.lR = x / 10;
      a.lS = y / 10;
      GpiSetArcParams(dev->hps, &a);
      GpiFullArc(dev->hps, (filled == FALSE ? DRO_OUTLINE : DRO_FILL), MAKEFIXED(10, 0));
   }
}
コード例 #11
0
static LONG GetFontByDlg(HWND hwndOwner, PPRINTSETUP pPrintSetup, char *pchFont, ULONG idFontDisp)
{
   FONTDLG FontDlg;
   char pchFamily[FACESIZE+5]="";
   long lTemp;
   FONTMETRICS FontMetrics;
   HPS hps;

   hps = WinGetPS(WinWindowFromID(hwndOwner, idFontDisp));

   GpiQueryFontMetrics(hps, sizeof(FontMetrics), &FontMetrics);

   strcpy(pchFamily, FontMetrics.szFamilyname);

   WinReleasePS(hps);

   lTemp = strtol(pchFont, NULL, 10);

   memset(&FontDlg, 0, sizeof(FontDlg));

   FontDlg.cbSize = sizeof(FontDlg);
   FontDlg.hpsPrinter = pPrintSetup->hpsPrinterInfo;
   FontDlg.pszFamilyname = pchFamily;
   FontDlg.usFamilyBufLen = sizeof(pchFamily);
   FontDlg.fxPointSize = MAKEFIXED(lTemp, 0);
   FontDlg.fl = FNTS_CENTER | FNTS_VECTORONLY;
   FontDlg.flFlags = FNTF_NOVIEWSCREENFONTS;
   FontDlg.clrFore = CLR_BLACK;
   FontDlg.clrBack = CLR_WHITE;

   WinFontDlg(HWND_DESKTOP, hwndOwner, &FontDlg);

   if (FontDlg.lReturn == DID_OK)
   {
      sprintf(pchFont, "%d.%s", (int) FIXEDINT(FontDlg.fxPointSize), FontDlg.fAttrs.szFacename);
   }

   return FontDlg.lReturn;
}
コード例 #12
0
VOID DrawDigitalTime(HWND hwnd)
{
    RECTL rcl;
    RECTL rclChar;
    RECTL rclCharOld;
    RECTL rclTime;
    RECTL rclAmPm;
    RECTL rclDate;
    HPS hpsWnd;
    SIZEF sizef;
    USHORT usi;
    ULONG  ulCharWidth,ulCharModulu;
    char achTime[9];
    char achFinalDate[9];
    time_t     tTime;
    struct tm  *pLocalTime;

    WinQueryWindowRect (hwnd, &rcl);
    hpsWnd = WinGetPS (hwnd);

    memset(achTime,0,sizeof(achTime) );
    memset(achFinalDate,0,sizeof(achFinalDate) );

    GpiCreateLogColorTable (hpsWnd, LCOL_RESET, LCOLF_RGB, 0, 0,
                                 (PLONG) NULL);

    /*
     *if black hands and black background
     *selected force the background to
     *blue
     */

    if( !cp.clrMinuteHand && !cp.clrBackground )
    {
          cp.clrBackground = RGB_BLUE;
    }



    switch (cp.usDispMode & (DM_TIME | DM_DATE))
    {
    case DM_DATE:
        rclDate = rcl;
        break;

    case DM_TIME | DM_DATE:
        if (!fIconic)
        {
            rclTime = rclDate = rcl;
            rclTime.yBottom = rclDate.yTop = rcl.yTop / 2;
            break;
        } /*else fall through*/

    case DM_TIME:
        rclTime = rcl;
        break;
    }

    if (cp.usDispMode & DM_TIME)
    {

        rclAmPm = rclTime;
        time(&tTime);
        pLocalTime = localtime(&tTime);
        if (bTwelveHourFormat)
        {
           strftime(achTime, sizeof(achTime), "%I %M %S", pLocalTime);
        }
        else
        {
           strftime(achTime, sizeof(achTime), "%H %M %S", pLocalTime);
        }

        /*insert country time separator*/
        achTime[2] = achTime[5] = szTimeSep[0];
        achTime[8] = '\000';
        /*Process 12 hours mode*/
        if (bTwelveHourFormat)
        {

            if (fIconic)
            {
                rclTime.yBottom = rclAmPm.yTop = rclTime.yTop / 2;
            }
            else
            {
                rclTime.xRight = rcl.xRight * 8 / 11;
                rclAmPm.xLeft = rclTime.xRight;
            }

            strcpy(achAmPm,szAnteMeridian);

            if (pLocalTime->tm_hour >= 12)
            {
                strcpy(achAmPm,szPostMeridian);
            }

        }

        GpiSetCharMode(hpsWnd, CM_MODE3);

        if (fIconic)
        {
            sizef.cx = MAKEFIXED(LOUSHORT((rclTime.xRight - rclTime.xLeft)
                    / 3), 0);
            sizef.cy = MAKEFIXED(LOUSHORT((rclTime.yTop - rclTime.yBottom)
                    * 1400 / 1000), 0);
        }
        else
        {
            sizef.cx = MAKEFIXED(LOUSHORT((rclTime.xRight - rclTime.xLeft)
                    / 6), 8000);
            sizef.cy = MAKEFIXED(LOUSHORT((rclTime.yTop - rclTime.yBottom)
                    * 1000 / 1500), 0);
        }

        GpiSetCharBox(hpsWnd, &sizef);

        if (bTwelveHourFormat)
        {

            if( strcmp(achAmPm,achOldAmPm) )
            {
                WinFillRect(hpsWnd, &rclAmPm, cp.clrBackground);
                WinDrawText(hpsWnd, sizeof(achAmPm) - 1, (PSZ)achAmPm,
                        (PRECTL)&rclAmPm, cp.clrMinuteHand, cp.clrBackground,
                        DT_CENTER | DT_VCENTER );
            }
        }

        if (!fIconic)
        {

            WinDrawText(hpsWnd, sizeof(achTime) - 1 , (PSZ)achTime,
                    (PRECTL)&rclTime, cp.clrMinuteHand, cp.clrBackground,
                    DT_CENTER | DT_VCENTER | DT_QUERYEXTENT);

            ulCharWidth = (rclTime.xRight - rclTime.xLeft) / (sizeof(achTime) - 1 );
            ulCharModulu = (rclTime.xRight - rclTime.xLeft) % (sizeof(achTime) - 1 );
            rclCharOld.xRight = rclTime.xLeft;

            rclChar.yTop = rclTime.yTop;
            rclChar.yBottom = rclTime.yBottom;

            for (usi = 0; usi < (sizeof(achTime)); usi++)
            {
                rclChar.xLeft = rclCharOld.xRight + (ULONG)1;
                rclChar.xRight = rclChar.xLeft + ulCharWidth +
                        ((ulCharModulu > 0L) ? 1L : 0L);

                if (ulCharModulu)
                    ulCharModulu--;

                if (achTime[usi] == szTimeSep[0])
                {
                    rclChar.xRight -= 3;
                }
                else
                {
                    rclChar.xRight += 1;
                }

                rclCharOld = rclChar;

                if (achTime[usi] != achOldTime[usi])
                {
                    WinFillRect (hpsWnd, &rclChar, cp.clrBackground);
                    if (!((usi == 0) && (achTime[0] == '0') &&
                            (bTwelveHourFormat)))
                        WinDrawText (hpsWnd, 1, (PSZ)&achTime[usi], &rclChar,
                                cp.clrMinuteHand, cp.clrBackground,
                                DT_CENTER | DT_VCENTER);
                }
            }
        }
        else
        {   /*Iconic. just draw if minute changed*/

            if (strncmp(achTime,achOldTime,5))
            {
                WinFillRect(hpsWnd,&rclTime,cp.clrBackground);
                WinDrawText(hpsWnd, sizeof(achTime) - 4 , (PSZ)achTime,
                        (PRECTL)&rclTime, cp.clrMinuteHand, cp.clrBackground,
                        DT_CENTER | DT_VCENTER);
            }
        }
    }

    if ((!(cp.usDispMode & DM_TIME)) || ((cp.usDispMode & DM_DATE) &&
            (!fIconic)))
    {
        GetArrangedDate(achFinalDate);
        if (strncmp(achFinalDate, achOldDate,
                sizeof(achFinalDate) - fIconic ? 4 : 1))
        {

            WinFillRect (hpsWnd, &rclDate, cp.clrBackground);
            GpiSetCharMode (hpsWnd, CM_MODE3);

            sizef.cx = MAKEFIXED(LOUSHORT(
                            (rclDate.xRight - rclDate.xLeft) / 5), 0);
            sizef.cy = MAKEFIXED(LOUSHORT(
                            (rclDate.yTop - rclDate.yBottom) * 1000 / 1500), 0);

            GpiSetCharBox(hpsWnd, &sizef);
            WinDrawText(hpsWnd,
                        (sizeof(achFinalDate) - (fIconic ? 4 : 1) ),
                        (PSZ)achFinalDate,(PRECTL)&rclDate,
                        (LONG)cp.clrMinuteHand,
                        (LONG)cp.clrBackground,
                        (ULONG )(DT_CENTER | DT_VCENTER ) );
        }
    }

    WinReleasePS(hpsWnd);

    strncpy(achOldTime,achTime,sizeof(achOldTime));
    strncpy(achOldAmPm,achAmPm,sizeof(achOldAmPm));
    strncpy(achOldDate,achFinalDate,sizeof(achOldDate));
}
コード例 #13
0
/****************************************************************\
 *
 *--------------------------------------------------------------
 *
 *  Name: ClkSize()
 *
 *  Purpose:When the window has been sized, we calculate  a page
 *          rectangle which: (a) fills the window rectangle in either
 *          the x or y dimension, (b) appears square, and (c) is centered
 *          in the window rectangle
 *  Usage:
 *
 *  Method:
 *          -
 *
 *          -
 *          -
 *
 *          -
 *          -
 *
 *  Returns:
 *
 *
\****************************************************************/
VOID ClkSize (HWND hwnd)
{
    RECTL rclWindow;
    SIZEF sizef;
    LONG cxSquare, cySquare, cxEdge, cyEdge;
    LONG cyHeight;
    LONG cxWidth;
    HBITMAP hbm;
    BITMAPINFOHEADER bmp;

    /*
     * First get rid of any buffer bitmap already there.
     */
    hbm = GpiSetBitmap (hpsBuffer, NULLHANDLE);

    if (hbm != NULLHANDLE)
        GpiDeleteBitmap (hbm);

    /*
     * Get the width and height of the window rectangle.
     */
    WinQueryWindowRect (hwnd, &rclWindow);
    cxWidth = rclWindow.xRight - rclWindow.xLeft - 2;
    cyHeight = rclWindow.yTop - rclWindow.yBottom - 2;

    /*
     * Now create a bitmap the size of the window.
     */
    bmp.cbFix = sizeof(BITMAPINFOHEADER);
    bmp.cx = (SHORT)cxWidth;
    bmp.cy = (SHORT)cyHeight;
    bmp.cPlanes = (SHORT)cColorPlanes;
    bmp.cBitCount = (SHORT)cColorBitcount;
    hbm = GpiCreateBitmap(hpsBuffer, (PBITMAPINFOHEADER2)&bmp,
                          0x0000, (PBYTE)NULL, (PBITMAPINFO2)NULL);
    GpiSetBitmap (hpsBuffer, hbm);

    /*
     * Assume the size of the page rectangle is constrained in the y
     * dimension,compute the x size which would make the rectangle appear
     * square, then check the assumption and do the reverse calculation
     * if necessary.
     */
    cySquare = cyHeight - 2;
    cxSquare = ( cyHeight * cxRes ) / cyRes;

    if (cxWidth < cxSquare)
    {
        cxSquare = cxWidth - 2;
        cySquare = (cxWidth * cyRes) / cxRes;
    }

    /*
     * Fill in the page rectangle and set the page viewport.
     */
    cxEdge = (cxWidth - cxSquare ) / 2;
    cyEdge = (cyHeight - cySquare ) / 2;
    rclPage.xLeft = cxEdge;
    rclPage.xRight = cxWidth - cxEdge;
    rclPage.yBottom = cyEdge;
    rclPage.yTop = cyHeight - cyEdge;

    /*
     * Determine where to put the date. If we have room under the clock, we
     * put it there. If we have more room on the left we put it there. If we
     * have more room in the midlle, it goes there.
     */
    if (cp.usDispMode & DM_DATE)
    {
        vclrDate[SURFACE] = vclrBG[SHADE];
        vclrDate[LIGHT] = vclrBG[LIGHT];
        vclrDate[SHADE] = vclrBG[SHADE];
        vclrDate[BACKGROUND] = vclrBG[SURFACE];
        if (cyHeight > (cySquare*6/5)) { /*Goes under*/
            vmatlfDateTrans.lM31 = (LONG)15;            /*Horizontal*/
            vmatlfDateTrans.lM32 = -(LONG)17;    /*vertical*/
            vmatlfDateScale.fxM11 = MAKEFIXED(2,0x8000);
            vmatlfDateScale.fxM22 = MAKEFIXED(2,0x8000);
            rclPage. yTop += cyEdge;
            rclPage. yBottom += cyEdge;
            vusDatePos = DP_UNDER;
        }
        else
        {
            if (cxWidth > (cxSquare * 31/10 ))
            {
                vmatlfDateTrans.lM31 = -(LONG)53 ;            /*Horizontal*/
                vmatlfDateTrans.lM32 = (LONG)04;    /*vertical*/
                vmatlfDateScale.fxM11 = MAKEFIXED(7,0xe000);
                vmatlfDateScale.fxM22 = MAKEFIXED(7,0xe000);
                rclPage.xRight += cxEdge;
                rclPage.xLeft += cxEdge;
                vusDatePos = DP_LEFTMIDDLE;

            }
            else
            {
                if (cxWidth > (cxSquare * 2)) { /*Goes on the left*/
                    vmatlfDateTrans.lM31 = -(LONG)52 ;            /*Horizontal*/
                    vmatlfDateTrans.lM32 = (LONG)2;    /*vertical*/
                    vmatlfDateScale.fxM11 = MAKEFIXED(3,0xd000);
                    vmatlfDateScale.fxM22 = MAKEFIXED(3,0xd000);
                    rclPage.xRight += cxEdge;
                    rclPage.xLeft += cxEdge;
                    vusDatePos = DP_LEFTDOWN  ;

                }
                else
                {   /*Goes inside*/
                    vmatlfDateTrans.lM31 = (LONG)24 ;            /*Horizontal*/
                    vmatlfDateTrans.lM32 = (LONG)23;    /*vertical*/
                    vmatlfDateScale.fxM11 = MAKEFIXED(2,0);
                    vmatlfDateScale.fxM22 = MAKEFIXED(2,0);
                    vclrDate[SURFACE] = vclrFace[SHADE] ;
                    vclrDate[LIGHT] = vclrFace[LIGHT] ;
                    vclrDate[SHADE] = vclrFace[SHADE];
                    vclrDate[BACKGROUND] = vclrFace[SURFACE];
                    vusDatePos = DP_INSIDE;
                }
            }
        }
    }

    f = GpiSetPageViewport (hps, &rclPage);
    f = GpiSetPageViewport (hpsBuffer, &rclPage);

    /*
     * Are we iconic?
     */
    f = WinQueryWindowPos (hwndFrame, &swp);
    fIconic = (BOOL)(swp.fl & SWP_MINIMIZE );
    fShowSecondHand = (BOOL) !(fIconic);

    GpiQueryCharBox(hpsBuffer, &sizef);
    GpiSetCharBox(hpsBuffer, &sizef);

    fBufferDirty = TRUE;
}
コード例 #14
0
void TMove( LPTFORM lpTForm, int tx, int ty )
/***********************************************************************/
{
    lpTForm->cx += MAKEFIXED(tx);
    lpTForm->cy += MAKEFIXED(ty);
}
//--------------------------------------------------------------------------
//
// RotateBox
//
// --------------------------------------------------------------------------
void RotateBox( HWND hwnd )
{
  HPS hps;
  POINTL pointlBox, pointlStart;
  MATRIXLF m;
  LONG i;

  // Get a cached PS for the window

  hps = WinGetPS( hwnd );

  // This time let's draw the boxes in blue

  GpiSetColor( hps, CLR_BLUE );

  // For this simple example, we will choose an arbitary position
  // as the anchor point for each box of (400,400). This will be
  // the point about which each box is rotated. A nice
  // alternative, as a small enhancement, would be to make the
  // start position be wherever the mouse is clicked in the
  // window.

  pointlStart.x = 400;
  pointlStart.y = 400;

  // Query the current contents of the model transform

  GpiQueryModelTransformMatrix( hps, 9L, &m );

  // Setup our box coordinates to be 100 by 100 from wherever
  // the start position is.

  pointlBox.y = pointlStart.y + 100;
  pointlBox.x = pointlStart.x + 100;

  // Draw a series of boxes, each time around the loop we'll
  // rotate through an extra 10 degrees, replacing the transform
  // with our newly calculated one.

  for ( i=0; i<360; i+=10 )
  {
    GpiRotate( hps
             , &m
             , TRANSFORM_REPLACE
             , MAKEFIXED(i,0)
             , &pointlStart );

    GpiSetModelTransformMatrix( hps, 9L, &m, TRANSFORM_REPLACE );

    GpiSetCurrentPosition( hps, &pointlStart );

    // Draw a 100 by 100 box. Note that we issue a normal box
    // drawing request. Blissfully unaware that the transform
    // we setup will cause our box to be rotated.

    GpiBox( hps, DRO_OUTLINE, &pointlBox,0,0 );
  }

  // Free the cached PS

  WinReleasePS( hps );

}
コード例 #16
0
#define INCL_GPIPRIMITIVES      /* GPI primitive functions      */

#include <os2.h>



HPS    hps;

USHORT i;

POINTL ptlStart = { 0, 0 }; /* first vertex                     */

POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices  */

MATRIXLF matlfInstance = { MAKEFIXED(1, 0),  MAKEFIXED(0, 0), 0,

                           MAKEFIXED(0, 0),  MAKEFIXED(1, 0), 0,

                           0,                0,               1 };



GpiOpenSegment(hps, 1L);             /* opens segment               */

GpiMove(hps, &ptlStart);             /* moves to start point (0, 0) */

GpiPolyLine(hps, 3L, ptlTriangle);   /* draws triangle              */

GpiCloseSegment(hps);                /* closes segment              */
コード例 #17
0
SOM_Scope void  SOMLINK ShapePartAdjustViewTypeShapes(ShapePart *somSelf,
                                                       Environment *ev,
                                                       ODFrame* frame)
{
    ShapePartData *somThis = ShapePartGetData(somSelf);
    ShapePartMethodDebug("ShapePart","ShapePartAdjustViewTypeShapes");

    try
    {
      // Call parent
      ShapePart_parent_SimplePart_AdjustViewTypeShapes(somSelf, ev, frame);

      ODFrameFacetIterator* facets = frame->CreateFacetIterator(ev); // Get facets for frame
      ODFacet*    facet            = facets->First(ev);              // Assume 1 facet
      delete facets;

      ODRect rect;
      ODTypeToken viewType = frame->GetViewType(ev);

      // Override SimplePart's behavior only if this is an embedded part displaying as frame.
      if((viewType == somThis->fSession->Tokenize(ev,kODViewAsFrame)) &&
         (!frame->IsRoot(ev)))
      {

         // Set the used and active shape to a circle.
         int         width, height;
         ODRgnHandle hrgnUsedAndActive;
         ODRect      box;

         ODCanvas *canvas = facet->GetCanvas(ev);

#ifdef _PLATFORM_OS2_
         HPS       hps;
         hps = ((ODOS2WindowCanvas*) canvas->GetPlatformCanvas(ev, kODPM))->GetPS(ev); // Obtain a PS
#endif //_PLATFORM_OS2_

         TempODShape frameShape = frame->AcquireFrameShape(ev, canvas); // Get bounding box
         frameShape->GetBoundingBox(ev, &box);                          //  of frame
         width  = FixedToInt(box.right)-FixedToInt(box.left);           // circle to be
         height = abs(FixedToInt(box.top)-FixedToInt(box.bottom));      // constructed

#ifdef _PLATFORM_OS2_
         Point center;
         center.x = width/2;
         center.y = height/2;
         int rad  = (width < height) ? center.x : center.y;             // get radius
         GpiBeginPath(hps,1L);                                          // Define GPI path
         GpiSetCurrentPosition(hps , &center);                          // for circle
         GpiFullArc(hps,DRO_OUTLINE,MAKEFIXED(rad,0));
         GpiEndPath(hps);
         hrgnUsedAndActive = GpiPathToRegion(hps, 1, FPATH_ALTERNATE);  // Convert path to GPI region
         ((ODOS2WindowCanvas *)canvas->GetPlatformCanvas(ev, kODPM))->ReleasePS(ev); // Release the canvas
#elif defined(_PLATFORM_WIN32_)

         hrgnUsedAndActive = CreateEllipticRgn(0,0,width,height);       // region from Ellipse box
#endif //_PLATFORM_WIN32_

         if(hrgnUsedAndActive)
         {
            // Use TempODShape so this object won't have to be released.
            TempODShape usedAndActiveShape = frame->CreateShape(ev);       // create a shape
            usedAndActiveShape->SetRegion(ev, hrgnUsedAndActive);          // assign the region to the shape

            // Set used and active shapes to the newly defined shape
            frame->ChangeUsedShape(ev, usedAndActiveShape, kODNULL);
            if(facet)
            {
              facet->ChangeActiveShape(ev, usedAndActiveShape, kODNULL);
            }
         } // hrgnUsedAndActive
      } // viewtype is frame and frame isn't root
      else
      {
         // Reset used and active shapes to frame shape
         frame->ChangeUsedShape(ev, kODNULL, kODNULL);
         if(facet)
         {
           facet->ChangeActiveShape(ev, kODNULL, kODNULL);
         }

      }
    }
    catch(...)
    {
    }
}
コード例 #18
0
static MRESULT EXPENTRY CnrSubclassWndProc
(
    HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
)
{
    if (msg == CM_PAINTBACKGROUND)
    {
        POWNERBACKGROUND    pownbckg = (POWNERBACKGROUND) mp1;
        RECTL               rclCnr;
        PINST               pinstMain;

        pinstMain = (PINST) WinQueryWindowPtr
            (WinQueryWindow (hwnd, QW_OWNER), QWL_USER);

        if (pinstMain->CurrentView != IDMVIEW_RADAR)
            return FALSE;

        WinQueryWindowRect (hwnd, &rclCnr);

        /*
         *  The radar screen is drawn once into a bitmap and
         *  subsequently GpiBitBlt'd onto the screen
         */

        if (! pinstMain->hbmRadar)
        {
            RECTL               rclRunway;
            LONG                cxRunway;
            LONG                cyRunway;
            ARCPARAMS           arcp;           // arc parameters
            POINTL              ptlScreenMidpoint;
            POINTL              ptlMarkerMidpoint;
            INT                 RadiusMultiplier;

            CreateMemoryPS (pinstMain, pownbckg->hps, &rclCnr);
            pinstMain->hbmRadar =
                CreateBitmap (pinstMain->hpsMemRadar, &rclCnr);

            WinFillRect (pinstMain->hpsMemRadar, &rclCnr,
                CLR_DARKGREEN);

            ptlScreenMidpoint.x = rclCnr.xRight / 2;
            ptlScreenMidpoint.y = rclCnr.yTop / 2;


            /*
             * Draw runway
             */

            cxRunway          = rclCnr.xRight / 60;
            cyRunway          = rclCnr.yTop / 10;
            rclRunway.xLeft   = ptlScreenMidpoint.x - cxRunway / 2;
            rclRunway.xRight  = rclRunway.xLeft + cxRunway;
            rclRunway.yBottom = ptlScreenMidpoint.y - cyRunway / 2;
            rclRunway.yTop    = rclRunway.yBottom + cyRunway;
            WinFillRect (pinstMain->hpsMemRadar, &rclRunway, CLR_WHITE);


            /*
             * Draw approach outer marker (3 elipses)
             */

            ptlMarkerMidpoint.x = ptlScreenMidpoint.x;
            ptlMarkerMidpoint.y = ptlScreenMidpoint.y - rclCnr.yTop / 6;
            GpiMove (pinstMain->hpsMemRadar, &ptlMarkerMidpoint);

            arcp.lP = rclCnr.xRight / 20;
            arcp.lQ = rclCnr.yTop / 80;
            arcp.lR = arcp.lS = 0L;
            GpiSetArcParams(pinstMain->hpsMemRadar,&arcp);
            GpiSetColor (pinstMain->hpsMemRadar, CLR_WHITE);
            GpiFullArc (pinstMain->hpsMemRadar, DRO_OUTLINE, MAKEFIXED(1,0));

            arcp.lP =
            arcp.lQ = rclCnr.yTop / 60;
            arcp.lR = arcp.lS = 0L;
            GpiSetArcParams(pinstMain->hpsMemRadar,&arcp);
            GpiSetColor (pinstMain->hpsMemRadar, CLR_WHITE);
            GpiFullArc (pinstMain->hpsMemRadar, DRO_OUTLINE, MAKEFIXED(1,0));

            arcp.lP =
            arcp.lQ = 1;
            arcp.lR = arcp.lS = 0L;
            GpiSetArcParams(pinstMain->hpsMemRadar,&arcp);
            GpiSetColor (pinstMain->hpsMemRadar, CLR_WHITE);
            GpiFullArc (pinstMain->hpsMemRadar, DRO_OUTLINE, MAKEFIXED(1,0));


            /*
             * Draw distance rings concentric circles
             */

            GpiMove (pinstMain->hpsMemRadar, &ptlScreenMidpoint);
            arcp.lP = arcp.lQ = min (rclCnr.xRight, rclCnr.yTop) / 9;
            arcp.lR = arcp.lS = 0L;
            GpiSetArcParams(pinstMain->hpsMemRadar,&arcp);

            GpiSetColor (pinstMain->hpsMemRadar, CLR_BLACK);

            for (RadiusMultiplier = 1; RadiusMultiplier <= 4; ++RadiusMultiplier)
                GpiFullArc(pinstMain->hpsMemRadar,DRO_OUTLINE,
                    MAKEFIXED(RadiusMultiplier,0));
        }

        DrawBitmap (pinstMain, pownbckg->hps, &pownbckg->rclBackground);

        return (MRESULT) TRUE;
    }
    else
        return pfnwpCnr (hwnd, msg, mp1, mp2);
}
コード例 #19
0
//=======================================================================
// 	int CurveToPoints
//		lpPoints:  Bezier handle points.
//		type:  BEZIER_MARKER is the only type supported.
//		lpOutputPoints:  Result. - must be at least MAX_BEZIER_OUT or NULL
//		
//		returns the number of points written (or needed if !lpOutputPoints)
//=======================================================================
int CurveToPoints(LPPOINT lpPoints, int type, LPPOINT lpOutputPoints )
//=======================================================================
{
	int n, t, i, nOutPoints, lastx, lasty, x, y;
	int nMaxPoints;
	int nPoints;
	LFIXED tscale, fdx, fdy, tscalebase;
	FPOINT ptR[MAX_BEZIER_IN];
	LPFPOINT R;
	LPPOINT P;

	if (type != BEZIER_MARKER)
		return(0);
	nPoints = BEZIER_IN;
	
	// determine the maximum number of points we will want (may effect quality)
	x = y = INT_MAX; 
	lastx = lasty = INT_MIN;
	for (i=0;i<nPoints;i++)
	{
		x = min(x, lpPoints[i].x);
		y = min(y, lpPoints[i].y);
		lastx = max(lastx, lpPoints[i].x);
		lasty = max(lasty, lpPoints[i].y);
	}
	// get delta
	x = lastx-x;
	y = lasty-y;
	nMaxPoints = (x+y)/4;
	nMaxPoints = bound(nMaxPoints, 5, MAX_BEZIER_OUT);
	
//	Transformer(lpTForm, lpPoints, &lastx, &lasty);
	if (lpOutputPoints)
		*lpOutputPoints++ = *lpPoints; //lastx,lasty;
	nOutPoints = 1;
	
	tscalebase = FGET( 1, nMaxPoints );
	tscale = 0;
	
	for ( t=1; t<nMaxPoints; t++ )
	{
		R = ptR;
		P = lpPoints;
		n = nPoints;
		tscale += tscalebase;
		while (--n >= 0)
		{
//			FTransformer(lpTForm, P, &R->fx, &R->fy);
			R->fx = MAKEFIXED(P->x);
			R->fy = MAKEFIXED(P->y);
			R++;
			P++;
		}
		n = nPoints - 1;
		while ( --n >= 0 )
		{
			R = ptR;
			for ( i=0; i<=n; i++ )
			{
				fdx = (R+1)->fx - R->fx;
				fdy = (R+1)->fy - R->fy;
				R->fx += FIXMUL( fdx, tscale );
				R->fy += FIXMUL( fdy, tscale );
				R++;
			}
		}
		x = WHOLE(ptR[0].fx);
		y = WHOLE(ptR[0].fy);
		if (x != lastx || y != lasty)
		{
			lastx = x;
			lasty = y;
			if (lpOutputPoints)
			{
				lpOutputPoints->x = lastx;
				lpOutputPoints->y = lasty;
				lpOutputPoints++;
			}
			++nOutPoints;
		}
	}
	
	n = nPoints - 1;
	x = WHOLE(ptR[n].fx);
	y = WHOLE(ptR[n].fy);
	if (x != lastx || y != lasty)
	{
		if (lpOutputPoints)
		{
			lpOutputPoints->x = x;
			lpOutputPoints->y = y;
		}
		++nOutPoints;
	}
	return( nOutPoints );
}
コード例 #20
0
static MRESULT APIENTRY Create ( HWND Window, MESG, MPARAM1 mp1, MPARAM2 ) {

  /**************************************************************************
   * Allocate instance data.                                                *
   **************************************************************************/

   PDATA Data = PDATA ( malloc ( sizeof(DATA) ) ) ;

   if ( Data == NULL ) {
      Log ( "ERROR: Unable to allocate instance memory for horizontal ruler." ) ;
      return ( MRFROMSHORT ( 1 ) ) ;
   } /* endif */

   Sys_SetWindowData ( Window, Data ) ;

  /**************************************************************************
   * Grab any parameters from the WM_CREATE message.                        *
   **************************************************************************/

   PHORZRULER_PARMS Parms = PHORZRULER_PARMS ( PVOIDFROMMP ( mp1 ) ) ;

   Data->IniData = Parms->IniData ;
   Data->MainWindow = Parms->MainWindow ;

  /**************************************************************************
   * Create the device context object for the window.                       *
   **************************************************************************/

   WinOpenWindowDC ( Window ) ;
   Data->pDevice = new DeviceContext ( "HRuler", Window ) ;

  /**************************************************************************
   * Load the pointers.                                                     *
   **************************************************************************/

   Data->MarginPtr = WinLoadPointer ( HWND_DESKTOP, 0, ID_MARGIN ) ;
   Data->TabstopPtr = WinLoadPointer ( HWND_DESKTOP, 0, ID_TABSTOP ) ;

  /**************************************************************************
   * Perform all other instance initializations.                            *
   **************************************************************************/

   Data->Metric = FALSE ;
   Data->fxZoom = MAKEFIXED ( 1, 0 ) ;
   Data->PageWidth = 9000 ;
   Data->TopLeft = 9000 ;
   Data->LeftMargin = 0 ;
   Data->RightMargin = 9000 ;
   Data->TabCount = 0 ;
   memset ( Data->Tabs, 0, sizeof(Data->Tabs) ) ;
   Data->Tick = 0 ;
   Data->Capture = FALSE ;
   Data->Mode = NOTMOVING ;
   Data->SettingFont = FALSE ;

  /**************************************************************************
   * Success?  Return no error.                                             *
   **************************************************************************/

   return ( MRFROMSHORT ( 0 ) ) ;
}
コード例 #21
0
ファイル: fontdlg.cpp プロジェクト: esrrhs/fuck-music-player
int wxFontDialog::ShowModal()
{
    FONTDLG      vFontDlg;
    char         zCurrentFont[FACESIZE];
    HWND         hWndFontDlg;
    FACENAMEDESC vFn;

    memset(&vFontDlg, '\0', sizeof(FONTDLG));
    zCurrentFont[0] = '\0';

    //
    // Set the fontdlg fields
    //
    vFontDlg.cbSize         = sizeof(FONTDLG);
    vFontDlg.hpsScreen      = ::WinGetScreenPS(HWND_DESKTOP);
    vFontDlg.hpsPrinter     = NULL;
    vFontDlg.pszFamilyname  = zCurrentFont;
    vFontDlg.fxPointSize    = MAKEFIXED(12,0);
    vFontDlg.usFamilyBufLen = FACESIZE;
    vFontDlg.fl             = FNTS_CENTER;
    vFontDlg.clrFore        = CLR_BLACK;
    vFontDlg.clrBack        = CLR_WHITE;

    hWndFontDlg = WinFontDlg( HWND_DESKTOP
                             ,GetParent()->GetHWND()
                             ,&vFontDlg
                            );
    if (hWndFontDlg && vFontDlg.lReturn == DID_OK)
    {
        wxColour                    vColour((unsigned long)0x00000000);
        wxNativeFontInfo            vInfo;

        m_fontData.m_fontColour = vColour;

        memset(&vFn, '\0', sizeof(FACENAMEDESC));
        vFn.usSize        = sizeof(FACENAMEDESC);
        vFn.usWeightClass = vFontDlg.usWeight;
        vFn.usWidthClass  = vFontDlg.usWidth;

        memset(&vInfo.fa, '\0', sizeof(FATTRS));
        memcpy(&vInfo.fn, &vFn, sizeof(FACENAMEDESC));

        vInfo.fa.usRecordLength = vFontDlg.fAttrs.usRecordLength;
        strcpy(vInfo.fa.szFacename, vFontDlg.fAttrs.szFacename);
        vInfo.fa.lMatch = vFontDlg.fAttrs.lMatch;

        //
        // Debugging
        //
        wxFont                      vChosenFont(vInfo);

        int                         nPointSize = vFontDlg.fxPointSize >> 16;

        vChosenFont.SetPointSize(nPointSize);
        m_fontData.m_chosenFont = vChosenFont;

        m_fontData.EncodingInfo().facename = (wxChar*)vFontDlg.fAttrs.szFacename;
        m_fontData.EncodingInfo().charset = vFontDlg.fAttrs.usCodePage;

        return wxID_OK;
    }
コード例 #22
0
BOOL bTwelveHourFormat;            /* 12 hr. versus military */
WRECT rTimeSep[3];                 /* posn of time separator strings and AM/PM */
CHAR  szTimeSep[TIME_SEP_LEN+1];     /* time separator string */
CHAR  szAnteMeridian[STRING_AM_LEN+1]; /* AM/PM */
CHAR  szPostMeridian[STRING_PM_LEN+1];
CHAR  szTitle [81];
CHAR  szErrClocks[PATHMAX+1];

WRECT rDateSep[2];                 /* posn of date separator strings */
CHAR  szDateSep[DATE_SEP_LEN+1];   /* date separator string */
BOOL fTimeFreez = FALSE;
BOOL fDateFreez = FALSE;
USHORT vusDateFormat;
MATRIXLF vmatlfDateTrans = {
     MAKEFIXED ( 1 , 0 ) ,       MAKEFIXED ( 0 , 0 ) ,       0L ,
     MAKEFIXED ( 0 , 0 ) ,       MAKEFIXED ( 1 , 0 ) ,       0L ,
     0L ,                      0L ,                      1L } ;
MATRIXLF vmatlfDateScale  = {
     MAKEFIXED ( 1 , 0 ) ,       MAKEFIXED ( 0 , 0 ) ,       0L ,
     MAKEFIXED ( 0 , 0 ) ,       MAKEFIXED ( 1 , 0 ) ,       0L ,
     0L ,                      0L ,                      1L } ;

SWP swp;
HPS hps;
HDC hdc;
RECTL rclPage;
DATETIME dt;
BOOL f;
BOOL fIconic, fShowSecondHand;
SIZEL sizl = { 200 , 200 };
BOOL APIENTRY GpiRotate( HAB       hps
                       , PMATRIXLF pmatlfXform
                       , LONG      lOptions
                       , FIXED     fxAngle
                       , PPOINTL   pptlCentre
                       )
{

   FIXED    fxSin, fxCos;
   HDC      hdc;
   XFORM    xfrmSource;
   XFORM    xfrmTarget;
   FIXED    fxOriginalAngle;                                     /*@P2A*/

   //
   // Validate passed params & record errors
   // @TN

   if (pptlCentre == NULL)
   {
       LogError( PMERR_INVALID_PARM );
       return ( FALSE );
   }

   /*----------------------------------------------------------------*/
   /* This function is not valid with an Ink PS.                     */
   /*----------------------------------------------------------------*/

   if ( GpiQueryMicro( hps ) && GpiQueryInkPS( hps ) )
   {
       if (!ValidateDCHandle( hps ))
          LogError( PMERR_INV_HDC );
       else
          LogError( PMERR_INV_INKPS_FUNCTION );
       return ( FALSE );
   }

   if ((hdc = GpiValidate(hps,
                          pmatlfXform,
                          &xfrmTarget,
                          lOptions)) == (HDC)NULL){
       return(FALSE);
   }

   /*
    * map angle into 0 - 360 range, ie no -ve angles or angles > 360
    */
   if (fxAngle < 0){
       fxAngle = -fxAngle;
       fxAngle = MAKEFIXED(360, 0) - MAKEFIXED(FIXEDINT(fxAngle)%360,
                                                  FIXEDFRAC(fxAngle));
   } else {
       fxAngle = MAKEFIXED(FIXEDINT(fxAngle)%360, FIXEDFRAC(fxAngle));
   } /* endif */

                      /* convert angle to quadrant zero     @P2A*/

      fxOriginalAngle = fxAngle;                          /*@P2A*/
      if (fxAngle > FX_90_DEGREES)                        /*@P2A*/
      {                                                   /*@P2A*/
                                                          /*@P2A*/
         if (fxAngle > FX_270_DEGREES)                    /*@P2A*/
         {                                                /*@P2A*/
            fxAngle = FX_360_DEGREES - fxAngle;           /*@P2A*/
         }                                                /*@P2A*/
         else if (fxAngle > FX_180_DEGREES)               /*@P2A*/
         {                                                /*@P2A*/
            fxAngle = fxAngle - FX_180_DEGREES;           /*@P2A*/
         }                                                /*@P2A*/
         else                                             /*@P2A*/
         {                                                /*@P2A*/
            fxAngle = FX_180_DEGREES - fxAngle;           /*@P2A*/
         }                                                /*@P2A*/
      }                                                   /*@P2A*/

   /*
    * obtain sine and cosine
    */

   fxSin = calculate_sine(fxAngle);                       /*@P2A*/
   fxCos = calculate_cosine(fxAngle);                     /*@P2A*/

     /* determine quadrant based on the original angle      @P2A*/

   if ((fxOriginalAngle > FX_90_DEGREES)                  /*@P2A*/
           &&                                             /*@P2A*/
           (fxOriginalAngle < FX_270_DEGREES))            /*@P2A*/
       {                                                  /*@P2A*/
          fxCos = -fxCos;                                 /*@P2A*/
       }                                                  /*@P2A*/
       if (fxOriginalAngle > FX_180_DEGREES)              /*@P2A*/
       {                                                  /*@P2A*/
          fxSin = -fxSin;                                 /*@P2A*/
       }                                                  /*@P2A*/


   /*
    * translate centre to origin
    */
   xfrmTarget.lM41 -= pptlCentre->x;
   xfrmTarget.lM42 -= pptlCentre->y;
   /*
    * set up rotation matrix and multiply with
    * translated copy of passed matrix
    */
   xfrmSource.fxM11 = fxCos;
   xfrmSource.fxM12 = fxSin;
   xfrmSource.fxM21 = -fxSin;
   xfrmSource.fxM22 = fxCos;
   xfrmSource.lM41 = 0;
   xfrmSource.lM42 = 0;
   if (GreMultiplyXforms(hdc, &xfrmTarget, &xfrmSource, CONCAT_AFTER)){
      /*
       * if successful fill out the target matrix with the
       * result, translating it back in the process
       */
       pmatlfXform->fxM11 = xfrmTarget.fxM11;
       pmatlfXform->fxM12 = xfrmTarget.fxM12;
       pmatlfXform->fxM21 = xfrmTarget.fxM21;
       pmatlfXform->fxM22 = xfrmTarget.fxM22;
       pmatlfXform->lM31 = xfrmTarget.lM41 + pptlCentre->x;
       pmatlfXform->lM32 = xfrmTarget.lM42 + pptlCentre->y;
       return(TRUE);
   } else {
       return(FALSE);
   } /* endif */



}