コード例 #1
0
ファイル: PdfRenderer.cs プロジェクト: nholik/Fo.Net
        private void DoFrame(Area area) {
            int w, h;
            int rx = this.currentAreaContainerXPosition;
            w = area.getContentWidth();
            if (area is BlockArea) {
                rx += ((BlockArea) area).getStartIndent();
            }
            h = area.getContentHeight();
            int ry = this.currentYPosition;

            rx = rx - area.getPaddingLeft();
            ry = ry + area.getPaddingTop();
            w = w + area.getPaddingLeft() + area.getPaddingRight();
            h = h + area.getPaddingTop() + area.getPaddingBottom();

            DoBackground(area, rx, ry, w, h);

            BorderAndPadding bp = area.GetBorderAndPadding();

            int left = area.getBorderLeftWidth();
            int right = area.getBorderRightWidth();
            int top = area.getBorderTopWidth();
            int bottom = area.getBorderBottomWidth();

            // If style is solid, use filled rectangles
            if (top != 0) {
                AddFilledRect(rx, ry, w, top,
                              new PdfColor(bp.getBorderColor(BorderAndPadding.TOP)));
            }
            if (left != 0) {
                AddFilledRect(rx - left, ry - h - bottom, left, h + top + bottom,
                              new PdfColor(bp.getBorderColor(BorderAndPadding.LEFT)));
            }
            if (right != 0) {
                AddFilledRect(rx + w, ry - h - bottom, right, h + top + bottom,
                              new PdfColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
            }
            if (bottom != 0) {
                AddFilledRect(rx, ry - h - bottom, w, bottom,
                              new PdfColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
            }
        }