当前位置: 首页>>代码示例>>C++>>正文


C++ Graphics_line函数代码示例

本文整理汇总了C++中Graphics_line函数的典型用法代码示例。如果您正苦于以下问题:C++ Graphics_line函数的具体用法?C++ Graphics_line怎么用?C++ Graphics_line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Graphics_line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Art_Speaker_draw

void Art_Speaker_draw (Art art, Speaker speaker, Graphics g) {
	double f = speaker -> relativeSize * 1e-3;
	double intX [1 + 16], intY [1 + 16], extX [1 + 11], extY [1 + 11];
	double bodyX, bodyY;
	int i;
	Graphics_Viewport previous;

	Art_Speaker_toVocalTract (art, speaker, intX, intY, extX, extY, & bodyX, & bodyY);
	previous = Graphics_insetViewport (g, 0.1, 0.9, 0.1, 0.9);
	Graphics_setWindow (g, -0.05, 0.05, -0.05, 0.05);

	/* Draw inner contour. */

	for (i = 1; i <= 5; i ++)
		Graphics_line (g, intX [i], intY [i], intX [i + 1], intY [i + 1]);
	Graphics_arc (g, bodyX, bodyY, 20 * f,
		atan2 (intY [7] - bodyY, intX [7] - bodyX) * 180 / NUMpi,
		atan2 (intY [6] - bodyY, intX [6] - bodyX) * 180 / NUMpi);
	for (i = 7; i <= 15; i ++)
		Graphics_line (g, intX [i], intY [i], intX [i + 1], intY [i + 1]);

	/* Draw outer contour. */

	for (i = 1; i <= 5; i ++)
		Graphics_line (g, extX [i], extY [i], extX [i + 1], extY [i + 1]);
	Graphics_arc (g, 0, 0, speaker -> palate.radius,
		speaker -> alveoli.a * 180 / NUMpi,
		speaker -> velum.a * 180 / NUMpi);
	for (i = 7; i <= 10; i ++)
		Graphics_line (g, extX [i], extY [i], extX [i + 1], extY [i + 1]);
	Graphics_resetViewport (g, previous);
}
开发者ID:READSEARCH,项目名称:praat,代码行数:32,代码来源:Art_Speaker.cpp

示例2: Art_Speaker_drawMesh

void Art_Speaker_drawMesh (Art art, Speaker speaker, Graphics graphics) {
	double xi [40], yi [40], xe [40], ye [40], xmm [40], ymm [40];
	int closed [40];
	int i;
	Graphics_Viewport previous;
	int oldLineType = Graphics_inqLineType (graphics);
	Art_Speaker_meshVocalTract (art, speaker, xi, yi, xe, ye, xmm, ymm, closed);
	previous = Graphics_insetViewport (graphics, 0.1, 0.9, 0.1, 0.9);   /* Must be square. */
	Graphics_setWindow (graphics, -0.05, 0.05, -0.05, 0.05);

	/* Mesh lines. */
	for (i = 1; i <= Art_Speaker_meshCount; i ++)
		Graphics_line (graphics, xi [i], yi [i], xe [i], ye [i]);

	/* Radii. */
	Graphics_setLineType (graphics, Graphics_DOTTED);
	for (i = 1; i <= Art_Speaker_meshCount; i ++)
		if (xe [i] <= 0.0 && ye [i] >= 0.0)
			Graphics_line (graphics, 0.0, 0.0, 0.9 * xi [i], 0.9 * yi [i]);
	Graphics_setLineType (graphics, oldLineType);

	/* Lengths. */
	for (i = 1; i <= Art_Speaker_meshCount; i ++)
		Graphics_line (graphics, xmm [i], ymm [i], xmm [i + 1], ymm [i + 1]);

	for (i = 1; i <= Art_Speaker_meshCount + 1; i ++)
		Graphics_speckle (graphics, xmm [i], ymm [i]);
	Graphics_setTextAlignment (graphics, Graphics_LEFT, Graphics_HALF);
	Graphics_text (graphics, 0.0, 0.0, U"O");   // origin
	Graphics_resetViewport (graphics, previous);
}
开发者ID:READSEARCH,项目名称:praat,代码行数:31,代码来源:Art_Speaker.cpp

示例3: drawWhileDragging

static void drawWhileDragging (FormantGridEditor me, double xWC, double yWC, long first, long last, double dt, double dy) {
	FormantGrid grid = (FormantGrid) my data;
	Ordered tiers = my editingBandwidths ? grid -> bandwidths : grid -> formants;
	RealTier tier = (RealTier) tiers -> item [my selectedFormant];
	double ymin = my editingBandwidths ? my p_bandwidthFloor   : my p_formantFloor;
	double ymax = my editingBandwidths ? my p_bandwidthCeiling : my p_formantCeiling;
	(void) xWC;
	(void) yWC;

	/*
	 * Draw all selected points as magenta empty circles, if inside the window.
	 */
	for (long i = first; i <= last; i ++) {
		RealPoint point = (RealPoint) tier -> points -> item [i];
		double t = point -> number + dt, y = point -> value + dy;
		if (t >= my d_startWindow && t <= my d_endWindow)
			Graphics_circle_mm (my d_graphics, t, y, 3);
	}

	if (last == first) {
		/*
		 * Draw a crosshair with time and y.
		 */
		RealPoint point = (RealPoint) tier -> points -> item [first];
		double t = point -> number + dt, y = point -> value + dy;
		Graphics_line (my d_graphics, t, ymin, t, ymax - Graphics_dyMMtoWC (my d_graphics, 4.0));
		Graphics_setTextAlignment (my d_graphics, kGraphics_horizontalAlignment_CENTRE, Graphics_TOP);
		Graphics_text (my d_graphics, t, ymax, Melder_fixed (t, 6));
		Graphics_line (my d_graphics, my d_startWindow, y, my d_endWindow, y);
		Graphics_setTextAlignment (my d_graphics, Graphics_LEFT, Graphics_BOTTOM);
		Graphics_text (my d_graphics, my d_startWindow, y, Melder_fixed (y, 6));
	}
}
开发者ID:ffostertw,项目名称:praat,代码行数:33,代码来源:FormantGridEditor.cpp

示例4: Transition_drawAsNumbers

void Transition_drawAsNumbers (I, Graphics g, int iformat, int precision) {
	iam (Transition);
	double maxTextWidth = 0, maxTextHeight = 0;
	Graphics_setInner (g);
	Graphics_setWindow (g, 0.5, my numberOfStates + 0.5, 0, 1);
	double leftMargin = Graphics_dxMMtoWC (g, 1);
	double lineSpacing = Graphics_dyMMtoWC (g, 1.5 * Graphics_inqFontSize (g) * 25.4 / 72);
	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_BOTTOM);
	for (long col = 1; col <= my numberOfStates; col ++) {
		if (my stateLabels && my stateLabels [col] && my stateLabels [col] [0]) {
			Graphics_text (g, col, 1, my stateLabels [col]);
			if (! maxTextHeight) maxTextHeight = lineSpacing;
		}
	}
	for (long row = 1; row <= my numberOfStates; row ++) {
		double y = 1 - lineSpacing * (row - 1 + 0.7);
		Graphics_setTextAlignment (g, Graphics_RIGHT, Graphics_HALF);
		if (my stateLabels && my stateLabels [row]) {
			double textWidth = Graphics_textWidth (g, my stateLabels [row]);
			if (textWidth > maxTextWidth) maxTextWidth = textWidth;
			Graphics_text (g, 0.5 - leftMargin, y, my stateLabels [row]);
		}
		Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
		for (long col = 1; col <= my numberOfStates; col ++) {
			wchar text [40];
			print4 (text, my data [row] [col], iformat, 0, precision);
			Graphics_text (g, col, y, text);
		}
	}
	if (maxTextWidth)
		Graphics_line (g, 0.5 - maxTextWidth - leftMargin, 1, my numberOfStates + 0.5, 1);
	if (maxTextHeight)
		Graphics_line (g, 0.5, 1 + maxTextHeight, 0.5, 1 - lineSpacing * (my numberOfStates + 0.2));
	Graphics_unsetInner (g);
}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:35,代码来源:Transition.cpp

示例5: EditDistanceTable_draw

void EditDistanceTable_draw (EditDistanceTable me, Graphics graphics, int iformat, int precision, double angle) {
    long rowmin = 1, rowmax = my numberOfRows;
    Graphics_setInner (graphics);
    Graphics_setWindow (graphics, 0.5, my numberOfColumns + 0.5, 0, 1);
    double leftMargin = getLeftMargin (graphics);   // not earlier!
    double lineSpacing = getLineSpacing (graphics);   // not earlier!
    double maxTextWidth = getMaxRowLabelWidth (me, graphics, rowmin, rowmax);
    double y = 1 + 0.1 * lineSpacing;
    autoNUMmatrix<bool> onPath (1, my numberOfRows, 1, my numberOfColumns);
    for (long i = 1; i <= my warpingPath -> pathLength; i++) {
        structPairOfInteger poi = my warpingPath -> path[i];
        onPath[poi.y] [poi.x] = true;
    }

    for (long irow = my numberOfRows; irow > 0; irow --) {
        Graphics_setTextAlignment (graphics, Graphics_RIGHT, Graphics_HALF);
        if (my rowLabels && my rowLabels [irow] && my rowLabels [irow] [0])
            Graphics_text (graphics, 0.5 - leftMargin, y, my rowLabels [irow]);
        Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_HALF);
        for (long icol = 1; icol <= my numberOfColumns; icol ++) {
            char text [40];
            print4 (text, my data [irow] [icol], iformat, 0, precision);
            Graphics_setBold (graphics, onPath[irow][icol]);
            Graphics_text (graphics, icol, y, Melder_peek8to32 (text));
            if (onPath[irow][icol]) {
                Graphics_rectangle (graphics, icol-0.5, icol+0.5, y - 0.5*lineSpacing, y + 0.5*lineSpacing);
            }
        }
        y -= lineSpacing;
        Graphics_setBold (graphics, false);
    }

    double left = 0.5;
    if (maxTextWidth > 0.0) left -= maxTextWidth + 2 * leftMargin;
    Graphics_line (graphics, left, y, my numberOfColumns + 0.5, y);

    Graphics_setTextRotation (graphics, angle);
    if (angle < 0) {
        y -= 0.3*lineSpacing;
        Graphics_setTextAlignment (graphics, Graphics_LEFT, Graphics_HALF);
    } else if (angle > 0) {
        Graphics_setTextAlignment (graphics, Graphics_RIGHT, Graphics_HALF);
        y -= 0.3*lineSpacing;
    } else {
        Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_TOP);
    }
    for (long icol = 1; icol <= my numberOfColumns; icol ++) {
        if (my columnLabels && my columnLabels [icol] && my columnLabels [icol] [0])
            Graphics_text (graphics, icol, y, my columnLabels [icol]);
    }
    Graphics_setTextRotation (graphics, 0);
    y -= lineSpacing;
    Graphics_line (graphics, 0.5, y, 0.5, 1 + 0.5 * lineSpacing);
    Graphics_unsetInner (graphics);
}
开发者ID:psibre,项目名称:praat,代码行数:55,代码来源:EditDistanceTable.cpp

示例6: Pitch_line

static void Pitch_line (Pitch me, Graphics g, double tmin, double fleft, double tmax, double fright,
	int nonPeriodicLineType)
{
	/*
	 * f = fleft + (t - tmin) * (fright - fleft) / (tmax - tmin);
	 */
	int lineType = Graphics_inqLineType (g);
	double lineWidth = Graphics_inqLineWidth (g);
	double slope = (fright - fleft) / (tmax - tmin);
	long imin = Sampled_xToNearestIndex (me, tmin);
	if (imin < 1) imin = 1;
	long imax = Sampled_xToNearestIndex (me, tmax);
	if (imax > my nx) imax = my nx;
	for (long i = imin; i <= imax; i ++) {
		double tleft, tright;
		if (! Pitch_isVoiced_i (me, i)) {
			if (nonPeriodicLineType == 2) continue;
			Graphics_setLineType (g, Graphics_DOTTED);
			Graphics_setLineWidth (g, 0.67 * lineWidth);
		} else if (nonPeriodicLineType != 2) {
			Graphics_setLineWidth (g, 2 * lineWidth);
		}
		tleft = Sampled_indexToX (me, i) - 0.5 * my dx, tright = tleft + my dx;
		if (tleft < tmin) tleft = tmin;
		if (tright > tmax) tright = tmax;
		Graphics_line (g, tleft, fleft + (tleft - tmin) * slope,
			tright, fleft + (tright - tmin) * slope);
		Graphics_setLineType (g, lineType);
		Graphics_setLineWidth (g, lineWidth);
	}
}
开发者ID:READSEARCH,项目名称:praat,代码行数:31,代码来源:Pitch_to_PitchTier.cpp

示例7: TableOfReal_drawAsNumbers

void TableOfReal_drawAsNumbers (TableOfReal me, Graphics graphics, long rowmin, long rowmax, int iformat, int precision) {
	fixRows (me, & rowmin, & rowmax);
	Graphics_setInner (graphics);
	Graphics_setWindow (graphics, 0.5, my numberOfColumns + 0.5, 0, 1);
	double leftMargin = getLeftMargin (graphics);   // not earlier!
	double lineSpacing = getLineSpacing (graphics);   // not earlier!
	double maxTextWidth = getMaxRowLabelWidth (me, graphics, rowmin, rowmax);
	double maxTextHeight = getMaxColumnLabelHeight (me, graphics, 1, my numberOfColumns);

	Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_BOTTOM);
	for (long icol = 1; icol <= my numberOfColumns; icol ++) {
		if (my columnLabels && my columnLabels [icol] && my columnLabels [icol] [0])
			Graphics_text (graphics, icol, 1, my columnLabels [icol]);
	}
	for (long irow = rowmin; irow <= rowmax; irow ++) {
		double y = 1 - lineSpacing * (irow - rowmin + 0.6);
		Graphics_setTextAlignment (graphics, Graphics_RIGHT, Graphics_HALF);
		if (my rowLabels && my rowLabels [irow] && my rowLabels [irow] [0])
			Graphics_text (graphics, 0.5 - leftMargin, y, my rowLabels [irow]);
		Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_HALF);
		for (long icol = 1; icol <= my numberOfColumns; icol ++) {
			wchar_t text [40];
			print4 (text, my data [irow] [icol], iformat, 0, precision);
			Graphics_text (graphics, icol, y, text);
		}
	}
	if (maxTextHeight) {
		double left = 0.5;
		if (maxTextWidth > 0.0) left -= maxTextWidth + 2 * leftMargin;
		Graphics_line (graphics, left, 1, my numberOfColumns + 0.5, 1);
	}
	Graphics_unsetInner (graphics);
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:33,代码来源:TableOfReal.cpp

示例8: Graphics_quantileQuantilePlot

void Graphics_quantileQuantilePlot (Graphics g, long numberOfQuantiles, double xdata[], long xnumberOfData, double ydata[], long ynumberOfData, double xmin, double xmax, double ymin, double ymax, int labelSize, const wchar_t *plotLabel) {
	int fontSize = Graphics_inqFontSize (g);

	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
	Graphics_setFontSize (g, labelSize);
	autoNUMvector<double> xsorted (NUMvector_copy<double> (xdata, 1, xnumberOfData), 1);
	autoNUMvector<double> ysorted (NUMvector_copy<double> (ydata, 1, ynumberOfData), 1);
	NUMsort_d (xnumberOfData, xsorted.peek());
	NUMsort_d (ynumberOfData, ysorted.peek());

	long numberOfData = xnumberOfData < ynumberOfData ? xnumberOfData : ynumberOfData;
	numberOfQuantiles = numberOfData < numberOfQuantiles ? numberOfData : numberOfQuantiles;
	double un = pow (0.5, 1.0 / numberOfQuantiles);
	double u1 = 1 - un;
	if (xmin == xmax) {
		xmin = NUMquantile (xnumberOfData, xsorted.peek(), u1);
		xmax = NUMquantile (xnumberOfData, xsorted.peek(), un);
	}
	if (ymin == ymax) {
		ymin = NUMquantile (ynumberOfData, ysorted.peek(), u1);
		ymax = NUMquantile (ynumberOfData, ysorted.peek(), un);
	}
	for (long i = 1; i <= numberOfQuantiles; i++) {
		double ui = i == 1 ? u1 : (i == numberOfQuantiles ? un : (i - 0.3175) / (numberOfQuantiles + 0.365));
		double qx = NUMquantile (xnumberOfData, xsorted.peek(), ui);
		double qy = NUMquantile (ynumberOfData, ysorted.peek(), ui);
		if (qx < xmin || qx > xmax || qy < ymin || qy > ymax) continue; // outside area
		Graphics_text (g, qx, qy, plotLabel);
	}
	Graphics_setLineType (g, Graphics_DOTTED);
	Graphics_line (g, xmin, ymin, xmax, ymax);
	Graphics_setLineType (g, Graphics_DRAWN);
	Graphics_setFontSize (g, fontSize);
}
开发者ID:Crisil,项目名称:praat,代码行数:34,代码来源:Graphics_extensions.cpp

示例9: Formant_drawTracks

void Formant_drawTracks (Formant me, Graphics g, double tmin, double tmax, double fmax, int garnish) {
	long itmin, itmax, ntrack = Formant_getMinNumFormants (me);
	if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; }
	if (! Sampled_getWindowSamples (me, tmin, tmax, & itmin, & itmax)) return;
	Graphics_setInner (g);
	Graphics_setWindow (g, tmin, tmax, 0.0, fmax);
	for (long itrack = 1; itrack <= ntrack; itrack ++) {
		for (long iframe = itmin; iframe < itmax; iframe ++) {
			Formant_Frame curFrame = & my d_frames [iframe], nextFrame = & my d_frames [iframe + 1];
			double x1 = Sampled_indexToX (me, iframe), x2 = Sampled_indexToX (me, iframe + 1);
			double f1 = curFrame -> formant [itrack]. frequency;
			double f2 = nextFrame -> formant [itrack]. frequency;
			if (NUMdefined (x1) && NUMdefined (f1) && NUMdefined (x2) && NUMdefined (f2))
				Graphics_line (g, x1, f1, x2, f2);
		}
	}
	Graphics_unsetInner (g);
	if (garnish) {
		Graphics_drawInnerBox (g);
		Graphics_textBottom (g, 1, U"Time (s)");
		Graphics_textLeft (g, 1, U"Formant frequency (Hz)");
		Graphics_marksBottom (g, 2, 1, 1, 0);
		Graphics_marksLeftEvery (g, 1.0, 1000.0, 1, 1, 1);
	}
}
开发者ID:psibre,项目名称:praat,代码行数:25,代码来源:Formant.cpp

示例10: EditDistanceTable_drawEditOperations

void EditDistanceTable_drawEditOperations (EditDistanceTable me, Graphics graphics) {
    const char32 *oinsertion = U"i", *insertion = U"*", *odeletion = U"d", *deletion = U"*", *osubstitution = U"s", *oequal = U"";
    Graphics_setWindow (graphics, 0.5, my warpingPath -> pathLength - 0.5, 0, 1); // pathLength-1 symbols
    double lineSpacing = getLineSpacing (graphics);
    double ytarget = 1 - lineSpacing, ysource = ytarget - 2 * lineSpacing, yoper = ysource - lineSpacing;
    Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_BOTTOM);
    for (long i = 2; i <= my warpingPath -> pathLength; i++) {
        structPairOfInteger p = my warpingPath -> path[i], p1 = my warpingPath -> path[i - 1];
        double x = i - 1;
        if (p.x == p1.x) { // insertion
            Graphics_text (graphics, x, ytarget, my rowLabels[p.y]);
            Graphics_text (graphics, x, ysource, deletion);
            Graphics_text (graphics, x, yoper, oinsertion);
        } else if (p.y == p1.y) { // deletion
            Graphics_text (graphics, x, ytarget, insertion);
            Graphics_text (graphics, x, ysource, my columnLabels[p.x]);
            Graphics_text (graphics, x, yoper, odeletion);
        } else { // substitution ?
            Graphics_text (graphics, x, ytarget, my rowLabels[p.y]);
            Graphics_text (graphics, x, ysource, my columnLabels[p.x]);
            Graphics_text (graphics, x, yoper, (Melder_equ (my rowLabels[p.y], my columnLabels[p.x]) ? oequal : osubstitution));
        }
        Graphics_line (graphics, x, ysource + lineSpacing, x, ytarget - 0.1 * lineSpacing);
    }
}
开发者ID:psibre,项目名称:praat,代码行数:25,代码来源:EditDistanceTable.cpp

示例11: TableOfReal_drawTopAndBottomLines

void TableOfReal_drawTopAndBottomLines (TableOfReal me, Graphics graphics, long rowmin, long rowmax) {
	long colmin = 1, colmax = my numberOfColumns;
	fixRows (me, & rowmin, & rowmax);
	Graphics_setInner (graphics);
	Graphics_setWindow (graphics, colmin - 0.5, colmax + 0.5, 0, 1);
	double lineSpacing = getLineSpacing (graphics);
	double maxTextWidth = getMaxRowLabelWidth (me, graphics, rowmin, rowmax);
	double maxTextHeight = getMaxColumnLabelHeight (me, graphics, 1, my numberOfColumns);

	double left = 0.5;
	if (maxTextWidth > 0.0) left -= maxTextWidth + 2 * lineSpacing;
	double right = colmax + 0.5;
	double top = 1 + maxTextHeight;
	double bottom = 1 - lineSpacing * (rowmax - rowmin + 1);
	Graphics_line (graphics, left, top, right, top);
	Graphics_line (graphics, left, bottom, right, bottom);
	Graphics_unsetInner (graphics);
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:18,代码来源:TableOfReal.cpp

示例12: v_draw

void structSpectrogramEditor :: v_draw () {
	Spectrogram spectrogram = (Spectrogram) our data;

	Graphics_setWindow (our d_graphics.get(), 0.0, 1.0, 0.0, 1.0);
	Graphics_setColour (our d_graphics.get(), Graphics_WHITE);
	Graphics_fillRectangle (our d_graphics.get(), 0.0, 1.0, 0.0, 1.0);
	Graphics_setColour (our d_graphics.get(), Graphics_BLACK);
	Graphics_rectangle (our d_graphics.get(), 0.0, 1.0, 0.0, 1.0);

	long itmin, itmax;
	Sampled_getWindowSamples (spectrogram, our d_startWindow, our d_endWindow, & itmin, & itmax);

	/*
	 * Autoscale frequency axis.
	 */
	our maximum = spectrogram -> ymax;

	Graphics_setWindow (our d_graphics.get(), our d_startWindow, our d_endWindow, 0.0, our maximum);
	Spectrogram_paintInside (spectrogram, our d_graphics.get(), our d_startWindow, our d_endWindow, 0, 0, 0.0, true,
		 60, 6.0, 0);

	/*
	 * Horizontal scaling lines.
	 */
	Graphics_setWindow (our d_graphics.get(), 0.0, 1.0, 0.0, our maximum);
	Graphics_setTextAlignment (our d_graphics.get(), Graphics_RIGHT, Graphics_HALF);
	Graphics_setColour (our d_graphics.get(), Graphics_RED);
	long df = 1000;
	for (long f = df; f <= our maximum; f += df) {
		Graphics_line (our d_graphics.get(), 0.0, f, 1.0, f);
		Graphics_text (our d_graphics.get(), -0.01, f,   f, U" Hz");
	}

	/*
	 * Vertical cursor lines.
	 */
	Graphics_setWindow (our d_graphics.get(), our d_startWindow, our d_endWindow, 0.0, our maximum);
	if (our d_startSelection > our d_startWindow && our d_startSelection < our d_endWindow)
		Graphics_line (our d_graphics.get(), our d_startSelection, 0, our d_startSelection, our maximum);
	if (our d_endSelection > our d_startWindow && d_endSelection < d_endWindow)
		Graphics_line (our d_graphics.get(), our d_endSelection, 0, our d_endSelection, our maximum);
	Graphics_setColour (our d_graphics.get(), Graphics_BLACK);
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:43,代码来源:SpectrogramEditor.cpp

示例13: BandFilterSpectrogram_drawSpectrumAtNearestTimeSlice

void BandFilterSpectrogram_drawSpectrumAtNearestTimeSlice (BandFilterSpectrogram me, Graphics g, double time, double fmin, double fmax, double dBmin, double dBmax, int garnish) {
	if (time < my xmin || time > my xmax) {
		return;
	}
	if (fmin == 0 && fmax == 0) { // autoscaling
		fmin = my ymin; fmax = my ymax;
	}
	if (fmax <= fmin) {
		fmin = my ymin; fmax = my ymax;
	}
	long icol = Matrix_xToNearestColumn (me, time);
	icol = icol < 1 ? 1 : (icol > my nx ? my nx : icol);
	autoNUMvector<double> spectrum (1, my ny);
	for (long i = 1; i <= my ny; i++) {
		spectrum[i] = my v_getValueAtSample (icol, i, 1); // dB's
	}
	long iymin, iymax;
	if (Matrix_getWindowSamplesY (me, fmin, fmax, &iymin, &iymax) < 2) { // too few values
		return;
	}
	if (dBmin == dBmax) { // autoscaling
		dBmin = spectrum[iymin]; dBmax = dBmin;
		for (long i = iymin + 1; i <= iymax; i++) {
			if (spectrum[i] < dBmin) {
				dBmin = spectrum[i];
			} else if (spectrum[i] > dBmax) {
				dBmax = spectrum[i];
			}
		}
		if (dBmin == dBmax) { 
			dBmin -= 1; dBmax += 1;
		}
	}
	Graphics_setWindow (g, fmin, fmax, dBmin, dBmax);
	Graphics_setInner (g);

	double x1 = my y1 + (iymin -1) * my dy, y1 = spectrum[iymin];
	for (long i = iymin + 1; i <= iymax - 1; i++) {
		double x2 = my y1 + (i -1) * my dy, y2 = spectrum[i];
		double xo1, yo1, xo2, yo2;
		if (NUMclipLineWithinRectangle (x1, y1, x2, y2, fmin, dBmin, fmax, dBmax, &xo1, &yo1, &xo2, &yo2)) {
			Graphics_line (g, xo1, yo1, xo2, yo2);
		}
		x1 = x2; y1 = y2;
	}
	Graphics_unsetInner (g);

	if (garnish) {
		Graphics_drawInnerBox (g);
		Graphics_marksBottom (g, 2, 1, 1, 0);
		Graphics_marksLeft (g, 2, 1, 1, 0);
		Graphics_textLeft (g, 1, U"Power (dB)");
		Graphics_textBottom (g, 1, Melder_cat (U"Frequency (", my v_getFrequencyUnit (), U")"));
	}
}
开发者ID:davideberdin,项目名称:praat,代码行数:55,代码来源:Spectrogram_extensions.cpp

示例14: FFNet_Eigen_drawIntersection

void FFNet_Eigen_drawIntersection (FFNet me, Eigen eigen, Graphics g, long pcx, long pcy, double xmin, double xmax, double ymin, double ymax) {
	long ix = labs (pcx), iy = labs (pcy);
	long numberOfEigenvalues = eigen -> numberOfEigenvalues;
	long dimension = eigen -> dimension;

	if (ix > numberOfEigenvalues || iy > numberOfEigenvalues || my nInputs != dimension) {
		return;
	}
	Melder_assert (ix > 0 && iy > 0);
	double x1, x2, y1, y2;
	if (xmax <= xmin || ymax <= ymin) {
		Graphics_inqWindow (g, & x1, & x2, & y1, & y2);
	}
	if (xmax <= xmin) {
		xmin = x1;
		xmax = x2;
	}
	if (ymax <= ymin) {
		ymin = y1;
		ymax = y2;
	}
	Graphics_setInner (g);
	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
	for (long i = 1; i <= my nUnitsInLayer[1]; i++) {
		long unitOffset = my nInputs + 1;
		double c1 = 0.0, c2 = 0.0, bias = my w[ my wLast[unitOffset + i] ];
		double x[6], y[6], xs[3], ys[3]; int ns = 0;
		for (long j = 1; j <= my nInputs; j++) {
			c1 += my w[ my wFirst[unitOffset + i] + j - 1 ] * eigen->eigenvectors[ix][j];
			c2 += my w[ my wFirst[unitOffset + i] + j - 1 ] * eigen->eigenvectors[iy][j];
		}
		x[1] = x[2] = x[5] = xmin; x[3] = x[4] = xmax;
		y[1] = y[4] = y[5] = ymin; y[2] = y[3] = ymax;
		for (long j = 1; j <= 4; j++) {
			double p1 = c1 * x[j  ] + c2 * y[j  ] + bias;
			double p2 = c1 * x[j + 1] + c2 * y[j + 1] + bias;
			double r = fabs (p1) / (fabs (p1) + fabs (p2));
			if (p1 *p2 > 0 || r == 0.0) {
				continue;
			}
			if (++ns > 2) {
				break;
			}
			xs[ns] = x[j] + (x[j + 1] - x[j]) * r;
			ys[ns] = y[j] + (y[j + 1] - y[j]) * r;
		}
		if (ns < 2) {
			Melder_casual (U"Intersection for unit ", i, U" outside range");
		} else {
			Graphics_line (g, xs[1], ys[1], xs[2], ys[2]);
		}
	}
	Graphics_unsetInner (g);
}
开发者ID:READSEARCH,项目名称:praat,代码行数:54,代码来源:FFNet_Eigen.cpp

示例15: VocalTract_drawSegments

void VocalTract_drawSegments (VocalTract me, Graphics g, double maxLength, double maxArea, bool closedAtGlottis)
{
	Graphics_setInner (g);
	double maxCrossection = sqrt (maxArea);
	Graphics_setWindow (g, 0, maxLength, -maxCrossection, maxCrossection);
	for (long isection = 1; isection <= my nx; isection++) {
		double x1 = (isection - 1.0) * my dx, x2 = x1 + my dx;
		double crosssection2 = sqrt (my z[1][isection]);
		Graphics_line (g, x1, crosssection2, x2, crosssection2);
		Graphics_line (g, x1, -crosssection2, x2, -crosssection2);
		if (isection > 1) {
			double crosssection1 = sqrt (my z[1][isection - 1]);
			Graphics_line (g, x1, crosssection1, x1, crosssection2);
			Graphics_line (g, x1, -crosssection1, x1, -crosssection2);
		} else if (isection == 1 and closedAtGlottis) {
			Graphics_line (g, x1, crosssection2, x1, -crosssection2);
		}
	}
	Graphics_unsetInner (g);
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:20,代码来源:VocalTractTier.cpp


注:本文中的Graphics_line函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。