summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-07-01 19:32:24 (GMT)
committerjoye <joye>2014-07-01 19:32:24 (GMT)
commit0d6cd6fdebc6968adfd583d22eda8c90c23ae936 (patch)
treea6dd9577c5835ec1c24fb79f467e5cb81742b54f /src
parent1e97fc5fed22f9bb8d304729ba8de70defc6f51c (diff)
downloadblt-0d6cd6fdebc6968adfd583d22eda8c90c23ae936.zip
blt-0d6cd6fdebc6968adfd583d22eda8c90c23ae936.tar.gz
blt-0d6cd6fdebc6968adfd583d22eda8c90c23ae936.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElemBar.C8
-rw-r--r--src/bltGrMarkerText.C6
-rw-r--r--src/bltGrPSOutput.C69
-rw-r--r--src/bltGrPSOutput.h4
4 files changed, 12 insertions, 75 deletions
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 10b9e65..577ea4c 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -1260,22 +1260,18 @@ void BarElement::printSegments(PSOutput* psPtr, BarPen* penPtr,
{
BarPenOptions* pops = (BarPenOptions*)penPtr->ops();
XRectangle *rp, *rend;
-
- if (!pops->fill && !pops->outlineColor)
- return;
-
for (rp = bars, rend = rp + nBars; rp < rend; rp++) {
if ((rp->width < 1) || (rp->height < 1))
continue;
if (pops->fill)
- psPtr->print3DRectangle(pops->fill, (double)rp->x, (double)rp->y,
+ psPtr->fill3DRectangle(pops->fill, (double)rp->x, (double)rp->y,
(int)rp->width, (int)rp->height,
pops->borderWidth, pops->relief);
if (pops->outlineColor) {
psPtr->setForeground(pops->outlineColor);
- psPtr->fillRectangle((double)rp->x, (double)rp->y,
+ psPtr->printRectangle((double)rp->x, (double)rp->y,
(int)rp->width - 1, (int)rp->height - 1);
}
}
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index a753c86..62223b1 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -141,8 +141,6 @@ void TextMarker::draw(Drawable drawable)
return;
if (fillGC_) {
- // Simulate the rotated background of the bitmap by filling a bounding
- // polygon with the background color.
XPoint points[4];
for (int ii=0; ii<4; ii++) {
points[ii].x = (short int)(outline_[ii].x + anchorPt_.x);
@@ -231,8 +229,6 @@ int TextMarker::regionIn(Region2d *extsPtr, int enclosed)
TextMarkerOptions* ops = (TextMarkerOptions*)ops_;
if (ops->style.angle != 0.0f) {
- // Generate the bounding polygon (isolateral) for the bitmap and see
- // if the point is inside of it.
Point2d points[5];
for (int ii=0; ii<4; ii++) {
points[ii].x = outline_[ii].x + anchorPt_.x;
@@ -261,8 +257,6 @@ void TextMarker::print(PSOutput* psPtr)
return;
if (fillGC_) {
- // Simulate the rotated background of the bitmap by filling a bounding
- // polygon with the background color.
Point2d points[4];
for (int ii=0; ii<4; ii++) {
points[ii].x = outline_[ii].x + anchorPt_.x;
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C
index aea111b..6e62147 100644
--- a/src/bltGrPSOutput.C
+++ b/src/bltGrPSOutput.C
@@ -187,19 +187,25 @@ void PSOutput::setLineWidth(int lineWidth)
format("%d setlinewidth\n", lineWidth);
}
-void PSOutput::printRectangle(int x, int y, int width, int height)
+void PSOutput::printRectangle(double x, double y, int width, int height)
{
append("newpath\n");
- format(" %d %d moveto\n", x, y);
+ format(" %g %g moveto\n", x, y);
format(" %d %d rlineto\n", width, 0);
format(" %d %d rlineto\n", 0, height);
format(" %d %d rlineto\n", -width, 0);
append("closepath\n");
+ append("stroke\n");
}
void PSOutput::fillRectangle(double x, double y, int width, int height)
{
- printRectangle((int)x, (int)y, width, height);
+ append("newpath\n");
+ format(" %g %g moveto\n", x, y);
+ format(" %d %d rlineto\n", width, 0);
+ format(" %d %d rlineto\n", 0, height);
+ format(" %d %d rlineto\n", -width, 0);
+ append("closepath\n");
append("fill\n");
}
@@ -288,23 +294,6 @@ void PSOutput::fillPolygon(Point2d *screenPts, int nScreenPts)
append("fill\n");
}
-void PSOutput::printBitmap(Display *display, Pixmap bitmap,
- double xScale, double yScale)
-{
- int width, height;
- Tk_SizeOfBitmap(display, bitmap, &width, &height);
-
- double sw = (double)width * xScale;
- double sh = (double)height * yScale;
- append(" gsave\n");
- format(" %g %g translate\n", sw * -0.5, sh * 0.5);
- format(" %g %g scale\n", sw, -sh);
- format(" %d %d true [%d 0 0 %d 0 %d] {",
- width, height, width, -height, height);
- setBitmap(display, bitmap, width, height);
- append(" } imagemask\n grestore\n");
-}
-
void PSOutput::setJoinStyle(int joinStyle)
{
// miter = 0, round = 1, bevel = 2
@@ -414,46 +403,6 @@ void PSOutput::print3DRectangle(Tk_3DBorder border, double x, double y,
fillPolygon(points, 7);
}
-void PSOutput::setBitmap(Display *display, Pixmap bitmap, int w, int h)
-{
- XImage* imagePtr = XGetImage(display, bitmap, 0, 0, w, h, 1, ZPixmap);
- append("\t<");
- int byteCount =0;
- int bitPos =0;
- for (int y=0; y<h; y++) {
- char string[10];
- unsigned char byte = 0;
- for (int x=0; x<w; x++) {
- unsigned long pixel = XGetPixel(imagePtr, x, y);
- bitPos = x % 8;
- byte |= (unsigned char)(pixel << bitPos);
- if (bitPos == 7) {
- byte = reverseBits(byte);
- byteToHex(byte, string);
- string[2] = '\0';
- byteCount++;
- byte = 0;
- if (byteCount >= 30) {
- string[2] = '\n';
- string[3] = '\t';
- string[4] = '\0';
- byteCount = 0;
- }
- append(string);
- }
- } /* x */
- if (bitPos != 7) {
- byte = reverseBits(byte);
- byteToHex(byte, string);
- string[2] = '\0';
- append(string);
- byteCount++;
- }
- } /* y */
- append(">\n");
- XDestroyImage(imagePtr);
-}
-
void PSOutput::printXColor(XColor* colorPtr)
{
format("%g %g %g",
diff --git a/src/bltGrPSOutput.h b/src/bltGrPSOutput.h
index f3e0eaa..186b04e 100644
--- a/src/bltGrPSOutput.h
+++ b/src/bltGrPSOutput.h
@@ -60,8 +60,7 @@ namespace Blt {
void printPolyline(Point2d*, int);
void printMaxPolyline(Point2d*, int);
void printSegments(Segment2d*, int);
- void printBitmap(Display*, Pixmap, double, double);
- void printRectangle(int, int, int, int);
+ void printRectangle(double, double, int, int);
void printPolygon(Point2d*, int);
void print3DRectangle(Tk_3DBorder, double, double, int, int, int, int);
@@ -78,7 +77,6 @@ namespace Blt {
void setLineAttributes(XColor*,int, Dashes*, int, int);
void setClearBackground();
void setDashes(Dashes*);
- void setBitmap(Display*, Pixmap, int, int);
int preamble(const char*);
int computeBBox(int, int);