Beispiel #1
0
Arrow Style::arrowHead() const
{
    if (propertySet(s_arrowHead)) {
        return d->arrowHead;
    }

    auto style = parentStyle().entity<Style>();
    if (style) {
        return style->arrowHead();
    }

    return tikz::Arrow::NoArrow;
}
void SnowView::Draw(BRect ur)
{
	int i;
	if (!fCachedParent) {
		if (!fShowClickMe) { /* show "drag me" */
			SetLowColor(ViewColor());
			SetHighColor(0,0,0);
			SetFontSize(12);
			DrawString(B_TRANSLATE("Drag me on your desktop"B_UTF8_ELLIPSIS),
				BPoint(15,25));
			BPoint arrowHead(Bounds().RightBottom() + BPoint(-10,-10));
			StrokeLine(arrowHead, arrowHead - BPoint(7,0));
			StrokeLine(arrowHead, arrowHead - BPoint(0,7));
			StrokeLine(arrowHead, arrowHead - BPoint(12,12));
			return;
		} else {
			SetLowColor(ViewColor());
			SetHighColor(0,0,0);
			SetFontSize(12);
			DrawString(B_TRANSLATE("Click me to remove BSnow"B_UTF8_ELLIPSIS),
				BPoint(15,25));
			return;
		}
	}
	//printf("Draw()\n");
	uint32 cw = fCurrentWorkspace;
	if (fFlakes[cw] == NULL)
		return;
	/* draw the snow already fallen */
//	BRect fallenRect(Bounds());
//	fallenRect.top = fallenRect.bottom - FALLEN_HEIGHT;
//	if (ur.Intersects(fallenRect)) {
		//if (fFallenBmp->Lock()) {
		//	DrawBitmap(fFallenBmp, fallenRect);
		//	fFallenBmp->Unlock();
		//}
		int32 cnt = fFallenReg->CountRects();
//		drawing_mode oldmode = DrawingMode();
//		SetDrawingMode(B_OP_ADD);

		for (i=0; i<cnt; i++) {
			BRect r = fFallenReg->RectAt(i);
//			SetHighColor(245, 245, 245, 200);
//			FillRect(r);
//			SetHighColor(255, 255, 255, 255);
//			r.InsetBy(1,1);
			FillRect(r);
		}
//		SetDrawingMode(oldmode);
//	}
	/* draw our flakes */
	for (i=0; i<fNumFlakes; i++) {
		int pat;
		if (!ur.Contains(BRect(fFlakes[cw][i].pos-BPoint(4,4), fFlakes[cw][i].pos+BPoint(4,4))))
			continue;
		if (fFlakes[cw][i].weight == 0)
			continue;
		pat = (fFlakes[cw][i].weight>3)?1:0;
		//FillRect(BRect(fFlakes[cw][i].pos-BPoint(PAT_HOTSPOT),fFlakes[cw][i].pos-BPoint(PAT_HOTSPOT)+BPoint(7,7)), gFlakePatterns[pat]);
/*
		StrokeLine(fFlakes[cw][i].pos+BPoint(-1,-1), 
				fFlakes[cw][i].pos+BPoint(1,1));
		StrokeLine(fFlakes[cw][i].pos+BPoint(-1,1), 
				fFlakes[cw][i].pos+BPoint(1,-1));
*/
		DrawBitmap(fFlakeBitmaps[pat], fFlakes[cw][i].pos-BPoint(PAT_HOTSPOT));
	}
}
Beispiel #3
0
void Arc::render( wxDC& dc ) const
{
    dc.SetPen( wxPen( getColour(), Model::TWIPS ) );
    dc.DrawLine( src(), dst() );
    arrowHead( dc, src(), dst() );
}
Beispiel #4
0
QJsonObject Style::saveData() const
{
    QJsonObject json = Entity::saveData();

    json["parentStyle"] = parentStyle().isValid() ? parentStyle().entity<Style>()->uid().toString() : Uid().toString();

    if (penColorSet()) {
        json["penColor"] = penColor().name();
    }

    if (fillColorSet()) {
        json["fillColor"] = fillColor().name();
    }

    if (penOpacitySet()) {
        json["penOpacity"] = penOpacity();
    }

    if (fillOpacitySet()) {
        json["fillOpacity"] = fillOpacity();
    }

    if (penStyleSet()) {
        json["penStyle"] = toString(penStyle());
    }

    if (lineWidthSet()) {
        json["lineWidth"] = lineWidth().toString();
    }

    // FIXME line type

    if (doubleLineSet()) {
        json["doubleLine"] = doubleLine();
    }

    if (innerLineWidthSet()) {
        json["innerLineWidth"] = innerLineWidth().toString();
    }

    if (innerLineColorSet()) {
        json["innerLineColor"] = innerLineColor().name();
    }

    if (rotationSet()) {
        json["rotation"] = rotation();
    }

    if (radiusXSet()) {
        json["radiusX"] = radiusX().toString();
    }

    if (radiusYSet()) {
        json["radiusY"] = radiusY().toString();
    }

    if (bendAngleSet()) {
        json["bendAngle"] = bendAngle();
    }

    if (loosenessSet()) {
        json["looseness"] = looseness();
    }

    if (outAngleSet()) {
        json["outAngle"] = outAngle();
    }

    if (inAngleSet()) {
        json["inAngle"] = inAngle();
    }

    if (arrowTailSet()) {
        json["arrowTail"] = toString(arrowTail());
    }

    if (arrowHeadSet()) {
        json["arrowHead"] = toString(arrowHead());
    }

    if (shortenStartSet()) {
        json["shortenStart"] = shortenStart().toString();
    }

    if (shortenEndSet()) {
        json["shortenEnd"] = shortenEnd().toString();
    }

    if (textAlignSet()) {
        json["textAlign"] = toString(textAlign());
    }

    if (shapeSet()) {
        json["shape"] = toString(shape());
    }

    if (minimumWidthSet()) {
        json["minimumWidth"] = minimumWidth().toString();
    }

    if (minimumHeightSet()) {
        json["minimumHeight"] = minimumHeight().toString();
    }

    if (innerSepSet()) {
        json["innerSep"] = innerSep().toString();
    }

    if (outerSepSet()) {
        json["outerSep"] = outerSep().toString();
    }

    return json;
}