home *** CD-ROM | disk | FTP | other *** search
- /*
- ptdpixch.c
-
- % Pixel oriented window painting code for character line drawing
-
- By Ted. 3/13/88
-
- OWL 1.2
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 3/28/90 jmd ansi-fied
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- /* -------------------------------------------------------------------------- */
-
- void ptd_DrawPixCharBox(
- ptd_struct *ptd,
- opbox *boxp,
- char *boxchar,
- ofont_type font,
- byte attr)
- {
- char linechar[3];
- opcoord fw, fh;
- unsigned wid, hgt;
-
- if (font == NULL) {
- return;
- }
- fw = ofont_GetWidth(font);
- fh = ofont_GetHeight(font);
-
- wid = opbox_GetWidth(boxp) / fw;
- hgt = opbox_GetHeight(boxp) / fh;
-
- /* Top line */
- ptd_DrawPixCharLine(ptd, boxp->xmin, boxp->ymin + fh, FALSE, boxchar, font, attr, wid);
-
- /* Bottom line */
- linechar[0] = boxchar[6];
- linechar[1] = boxchar[5];
- linechar[2] = boxchar[4];
- ptd_DrawPixCharLine(ptd, boxp->xmin, boxp->ymax, FALSE, linechar, font, attr, wid);
-
- if (hgt > 2) {
- /* Left line */
- linechar[0] = linechar[1] = linechar[2] = boxchar[7];
- ptd_DrawPixCharLine(ptd, boxp->xmin, boxp->ymin + 2*fh, TRUE, linechar, font, attr, hgt-2);
-
- /* Right line */
- linechar[0] = linechar[1] = linechar[2] = boxchar[3];
- ptd_DrawPixCharLine(ptd, boxp->xmax - fw, boxp->ymin + 2*fh, TRUE, linechar, font, attr, hgt-2);
- }
- }
- /* -------------------------------------------------------------------------- */
-
- void ptd_DrawPixCharLine(
- ptd_struct *ptd,
- opcoord x,
- opcoord y,
- boolean down,
- char *linechar,
- ofont_type font,
- byte attr,
- unsigned len)
- {
- opcoord fw, fh;
- ofont_type tfont;
-
- if (font == NULL) {
- return;
- }
- fw = ofont_GetWidth(font);
- fh = ofont_GetHeight(font);
-
- /* Save and poke ptd win font */
- tfont = win_GetFont(ptd->win);
- win_setfontptr(ptd->win, font);
-
- if (!down) { /* Horizontal line */
- if (len > 0) {
- ptd_PlotChar(ptd, x, y, linechar[0], attr, 1);
- }
- if (len > 1) {
- ptd_PlotChar(ptd, x+fw*(len-1), y, linechar[2], attr, 1);
- }
- if (len > 2) {
- ptd_PlotChar(ptd, x+fw, y, linechar[1], attr, len-2);
- }
- }
- else { /* Vertical line */
- if (len > 0) {
- ptd_PlotChar(ptd, x, y, linechar[0], attr, 1);
- }
- if (len > 1) {
- ptd_PlotChar(ptd, x, y+fh*(len-1), linechar[2], attr, 1);
- }
- if (len > 2) {
- for (len -= 2; len != 0; len--) {
- y += fh;
- ptd_PlotChar(ptd, x, y, linechar[1], attr, 1);
- }
- }
- }
- /* Restore win font */
- win_setfontptr(ptd->win, tfont);
- }
- /* -------------------------------------------------------------------------- */
-
-