diff options
author | joye <joye> | 2014-06-17 16:20:04 (GMT) |
---|---|---|
committer | joye <joye> | 2014-06-17 16:20:04 (GMT) |
commit | 11610728b6abe8825b9099b1d05ab426f10c8405 (patch) | |
tree | 56a39518e8804a425995d77f47672eee354a7f09 /src | |
parent | c7cfd8f0b50f8f7378a6761a155dd8a4534e8b3d (diff) | |
download | blt-11610728b6abe8825b9099b1d05ab426f10c8405.zip blt-11610728b6abe8825b9099b1d05ab426f10c8405.tar.gz blt-11610728b6abe8825b9099b1d05ab426f10c8405.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrElemLine.C | 72 | ||||
-rw-r--r-- | src/bltGrPenLine.C | 98 | ||||
-rw-r--r-- | src/bltGrPenLine.h | 7 |
3 files changed, 9 insertions, 168 deletions
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index cd8dc68..a4796d9 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -2356,50 +2356,6 @@ void LineElement::drawSymbols(Drawable drawable, LinePen* penPtr, delete [] polygon; } break; - - case SYMBOL_BITMAP: - { - int w, h; - Tk_SizeOfBitmap(graphPtr_->display_, penOps->symbol.bitmap, &w, &h); - - // Compute the size of the scaled bitmap. Stretch the bitmap to fit - // a nxn bounding box. - double sx = (double)size / (double)w; - double sy = (double)size / (double)h; - double scale = MIN(sx, sy); - int bw = (int)(w * scale); - int bh = (int)(h * scale); - - XSetClipMask(graphPtr_->display_, penOps->symbol.outlineGC, None); - if (penOps->symbol.mask != None) - XSetClipMask(graphPtr_->display_, penOps->symbol.outlineGC, - penOps->symbol.mask); - - if (penOps->symbol.fillGC == NULL) - XSetClipMask(graphPtr_->display_, penOps->symbol.outlineGC, - penOps->symbol.bitmap); - - int dx = bw / 2; - int dy = bh / 2; - - if (symbolInterval_ > 0) { - Point2d *pp, *endp; - for (pp = symbolPts, endp = pp + nSymbolPts; pp < endp; pp++) { - if (DRAW_SYMBOL()) { - int x = pp->x - dx; - int y = pp->y - dy; - if ((penOps->symbol.fillGC == NULL) || - (penOps->symbol.mask != None)) - XSetClipOrigin(graphPtr_->display_, - penOps->symbol.outlineGC, x, y); - XCopyPlane(graphPtr_->display_, penOps->symbol.bitmap, drawable, - penOps->symbol.outlineGC, 0, 0, bw, bh, x, y, 1); - } - symbolCounter_++; - } - } - } - break; } } @@ -2534,34 +2490,6 @@ void LineElement::getSymbolPostScriptInfo(PostScript* psPtr, LinePen* penPtr, in switch (pops->symbol.type) { case SYMBOL_NONE: break; /* Do nothing */ - case SYMBOL_BITMAP: - { - int w, h; - double sx, sy, scale; - - /* - * Compute how much to scale the bitmap. Don't let the scaled - * bitmap exceed the bounding square for the symbol. - */ - Tk_SizeOfBitmap(graphPtr_->display_, pops->symbol.bitmap, &w, &h); - sx = (double)size / (double)w; - sy = (double)size / (double)h; - scale = MIN(sx, sy); - - if (pops->symbol.mask != None) { - psPtr->format("%%Bitmap mask is \"%s\"\n", - Tk_NameOfBitmap(graphPtr_->display_,pops->symbol.mask)); - psPtr->setBackground(fillColor); - psPtr->printBitmap(graphPtr_->display_, pops->symbol.mask, scale, - scale); - } - psPtr->format("%%Bitmap symbol is \"%s\"\n", - Tk_NameOfBitmap(graphPtr_->display_,pops->symbol.bitmap)); - psPtr->setForeground(outlineColor); - psPtr->printBitmap(graphPtr_->display_, pops->symbol.bitmap, scale, - scale); - } - break; default: psPtr->append(" "); psPtr->setBackground(fillColor); diff --git a/src/bltGrPenLine.C b/src/bltGrPenLine.C index 8c0e622..0f593f1 100644 --- a/src/bltGrPenLine.C +++ b/src/bltGrPenLine.C @@ -97,39 +97,9 @@ static int SymbolSetProc(ClientData clientData, Tcl_Interp* interp, } } - // bitmap - Pixmap bitmap = None; - Pixmap mask = None; - Tcl_Obj** objv; - int objc; - if ((Tcl_ListObjGetElements(NULL, *objPtr, &objc, &objv) != TCL_OK) || - (objc > 2)) - goto error; - - if (objc > 0) { - bitmap = Tk_AllocBitmapFromObj((Tcl_Interp*)NULL, tkwin, objv[0]); - if (!bitmap) - goto error; - } - - if (objc > 1) { - mask = Tk_AllocBitmapFromObj((Tcl_Interp*)NULL, tkwin, objv[1]); - if (!mask) - goto error; - } - - DestroySymbol(Tk_Display(tkwin), symbolPtr); - symbolPtr->bitmap = bitmap; - symbolPtr->mask = mask; - symbolPtr->type = SYMBOL_BITMAP; - - return TCL_OK; - - error: - Tcl_AppendResult(interp, "bad symbol \"", string, - "\": should be \"none\", \"circle\", \"square\", \"diamond\", " - "\"plus\", \"cross\", \"splus\", \"scross\", \"triangle\", " - "\"arrow\" or the name of a bitmap", NULL); + Tcl_AppendResult(interp, "bad symbol ", string, + ": should be none, circle, square, diamond, plus, cross,", + " splus, scross, triangle, arrow", NULL); return TCL_ERROR; } @@ -138,35 +108,15 @@ static Tcl_Obj* SymbolGetProc(ClientData clientData, Tk_Window tkwin, { Symbol* symbolPtr = (Symbol*)(widgRec + offset); - Tcl_Obj* ll[2]; - if (symbolPtr->type == SYMBOL_BITMAP) { - ll[0] = - Tcl_NewStringObj(Tk_NameOfBitmap(Tk_Display(tkwin),symbolPtr->bitmap),-1); - ll[1] = symbolPtr->mask ? - Tcl_NewStringObj(Tk_NameOfBitmap(Tk_Display(tkwin),symbolPtr->mask),-1) : - Tcl_NewStringObj("", -1); - return Tcl_NewListObj(2, ll); - } - else { - for (GraphSymbolType* p = graphSymbols; p->name; p++) { - if (p->type == symbolPtr->type) - return Tcl_NewStringObj(p->name, -1); - } - return Tcl_NewStringObj("?unknown symbol type?", -1); - } + for (GraphSymbolType* p = graphSymbols; p->name; p++) + if (p->type == symbolPtr->type) + return Tcl_NewStringObj(p->name, -1); + + return Tcl_NewStringObj("?unknown symbol type?", -1); } static void DestroySymbol(Display* display, Symbol* symbolPtr) { - if (symbolPtr->bitmap != None) { - Tk_FreeBitmap(display, symbolPtr->bitmap); - symbolPtr->bitmap = None; - } - if (symbolPtr->mask != None) { - Tk_FreeBitmap(display, symbolPtr->mask); - symbolPtr->mask = None; - } - symbolPtr->type = SYMBOL_NONE; } @@ -232,8 +182,6 @@ LinePen::LinePen(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr) traceGC_ =NULL; errorBarGC_ =NULL; - ops->symbol.bitmap = None; - ops->symbol.mask = None; ops->symbol.type = SYMBOL_NONE; ops->valueStyle.anchor =TK_ANCHOR_NW; @@ -255,8 +203,6 @@ LinePen::LinePen(Graph* graphPtr, const char* name, void* options) traceGC_ =NULL; errorBarGC_ =NULL; - ops->symbol.bitmap = None; - ops->symbol.mask = None; ops->symbol.type = SYMBOL_NONE; ops->valueStyle.anchor =TK_ANCHOR_NW; @@ -283,16 +229,6 @@ LinePen::~LinePen() if (ops->symbol.fillGC) Tk_FreeGC(graphPtr_->display_, ops->symbol.fillGC); - - if (ops->symbol.bitmap != None) { - Tk_FreeBitmap(graphPtr_->display_, ops->symbol.bitmap); - ops->symbol.bitmap = None; - } - - if (ops->symbol.mask != None) { - Tk_FreeBitmap(graphPtr_->display_, ops->symbol.mask); - ops->symbol.mask = None; - } } int LinePen::configure() @@ -307,24 +243,6 @@ int LinePen::configure() colorPtr = ops->traceColor; XGCValues gcValues; gcValues.foreground = colorPtr->pixel; - if (ops->symbol.type == SYMBOL_BITMAP) { - colorPtr = ops->symbol.fillColor; - if (!colorPtr) - colorPtr = ops->traceColor; - - if (colorPtr) { - gcValues.background = colorPtr->pixel; - gcMask |= GCBackground; - if (ops->symbol.mask != None) { - gcValues.clip_mask = ops->symbol.mask; - gcMask |= GCClipMask; - } - } - else { - gcValues.clip_mask = ops->symbol.bitmap; - gcMask |= GCClipMask; - } - } gcValues.line_width = ops->symbol.outlineWidth; GC newGC = Tk_GetGC(graphPtr_->tkwin_, gcMask, &gcValues); if (ops->symbol.outlineGC) diff --git a/src/bltGrPenLine.h b/src/bltGrPenLine.h index 6d1738e..8377e8f 100644 --- a/src/bltGrPenLine.h +++ b/src/bltGrPenLine.h @@ -34,8 +34,7 @@ typedef enum { SYMBOL_NONE, SYMBOL_SQUARE, SYMBOL_CIRCLE, SYMBOL_DIAMOND, SYMBOL_PLUS, - SYMBOL_CROSS, SYMBOL_SPLUS, SYMBOL_SCROSS, SYMBOL_TRIANGLE, SYMBOL_ARROW, - SYMBOL_BITMAP + SYMBOL_CROSS, SYMBOL_SPLUS, SYMBOL_SCROSS, SYMBOL_TRIANGLE, SYMBOL_ARROW } SymbolType; typedef struct { @@ -46,10 +45,6 @@ typedef struct { GC outlineGC; XColor* fillColor; GC fillGC; - - // The last two fields are used only for bitmap symbols - Pixmap bitmap; - Pixmap mask; } Symbol; typedef struct { |