这篇教程C++ Graphics_line函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Graphics_line函数的典型用法代码示例。如果您正苦于以下问题:C++ Graphics_line函数的具体用法?C++ Graphics_line怎么用?C++ Graphics_line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Graphics_line函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Art_Speaker_drawvoid 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,
示例2: Art_Speaker_drawMeshvoid 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,
示例3: drawWhileDraggingstatic 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,
示例4: Transition_drawAsNumbersvoid 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,
示例5: EditDistanceTable_drawvoid 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,
示例6: Pitch_linestatic 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,
示例7: TableOfReal_drawAsNumbersvoid 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,
示例8: Graphics_quantileQuantilePlotvoid 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,
示例9: Formant_drawTracksvoid 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,
示例10: EditDistanceTable_drawEditOperationsvoid 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,
示例11: TableOfReal_drawTopAndBottomLinesvoid 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,
示例12: v_drawvoid 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,
示例13: BandFilterSpectrogram_drawSpectrumAtNearestTimeSlicevoid 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,
示例14: FFNet_Eigen_drawIntersectionvoid 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,
示例15: VocalTract_drawSegmentsvoid 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,
示例16: TableOfReal_drawVerticalLinesvoid TableOfReal_drawVerticalLines (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); // not earlier! double maxTextWidth = getMaxRowLabelWidth (me, graphics, rowmin, rowmax); double maxTextHeight = getMaxColumnLabelHeight (me, graphics, 1, my numberOfColumns); if (maxTextWidth > 0.0) colmin -= 1; for (long col = colmin + 1; col <= colmax; col ++) Graphics_line (graphics, col - 0.5, 1 + maxTextHeight, col - 0.5, 1 - lineSpacing * (rowmax - rowmin + 1)); Graphics_unsetInner (graphics);}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:14,
示例17: drawMarkersstatic void drawMarkers (Picture me)/* * The drawing area is a square measuring 12x12 inches. */#define SIDE 12/* * The selection grid has a resolution of 1/2 inch. */#define SQUARES 24/* * Vertical and horizontal lines every 3 inches. */#define YELLOW_GRID 3{ /* Fill the entire canvas with GC's background. */ Graphics_setColour (my selectionGraphics.get(), Graphics_WHITE); Graphics_fillRectangle (my selectionGraphics.get(), 0, SIDE, 0, SIDE); /* Draw yellow grid lines for coarse navigation. */ Graphics_setColour (my selectionGraphics.get(), Graphics_YELLOW); for (int i = YELLOW_GRID; i < SIDE; i += YELLOW_GRID) { Graphics_line (my selectionGraphics.get(), 0, i, SIDE, i); Graphics_line (my selectionGraphics.get(), i, 0, i, SIDE); } /* Draw red ticks and numbers for feedback on viewport measurement. */ Graphics_setColour (my selectionGraphics.get(), Graphics_RED); for (int i = 1; i < SIDE; i ++) { double x = i; Graphics_setTextAlignment (my selectionGraphics.get(), Graphics_CENTRE, Graphics_TOP); Graphics_text (my selectionGraphics.get(), x, SIDE, i); Graphics_setTextAlignment (my selectionGraphics.get(), Graphics_CENTRE, Graphics_BOTTOM); Graphics_text (my selectionGraphics.get(), x, 0, i); } for (int i = 1; i < SQUARES ; i ++) { // vertical ticks double x = 0.5 * i; Graphics_line (my selectionGraphics.get(), x, SIDE - 0.04, x, SIDE); Graphics_line (my selectionGraphics.get(), x, 0, x, 0.04); } for (int i = 1; i < SIDE; i ++) { double y = SIDE - i; Graphics_setTextAlignment (my selectionGraphics.get(), Graphics_LEFT, Graphics_HALF); Graphics_text (my selectionGraphics.get(), 0.04, y, i); Graphics_setTextAlignment (my selectionGraphics.get(), Graphics_RIGHT, Graphics_HALF); Graphics_text (my selectionGraphics.get(), SIDE - 0.03, y, i); } for (int i = 1; i < SQUARES; i ++) { // horizontal ticks double y = SIDE - 0.5 * i; Graphics_line (my selectionGraphics.get(), SIDE - 0.04, y, SIDE, y); Graphics_line (my selectionGraphics.get(), 0, y, 0.04, y); } Graphics_setColour (my selectionGraphics.get(), Graphics_BLACK);}
开发者ID:DsRQuicke,项目名称:praat,代码行数:57,
示例18: v_drawvoid structPointEditor :: v_draw () { PointProcess point = static_cast <PointProcess> (our data); Sound sound = d_sound.data; Graphics_setColour (our graphics.get(), Graphics_WHITE); Graphics_setWindow (our graphics.get(), 0.0, 1.0, 0.0, 1.0); Graphics_fillRectangle (our graphics.get(), 0.0, 1.0, 0.0, 1.0); double minimum = -1.0, maximum = +1.0; if (sound && (p_sound_scalingStrategy == kTimeSoundEditor_scalingStrategy_BY_WINDOW || p_sound_scalingStrategy == kTimeSoundEditor_scalingStrategy_BY_WINDOW_AND_CHANNEL)) { long first, last; if (Sampled_getWindowSamples (sound, our startWindow, our endWindow, & first, & last) >= 1) { Matrix_getWindowExtrema (sound, first, last, 1, 1, & minimum, & maximum); if (minimum == maximum) minimum -= 1.0, maximum += 1.0; } } Graphics_setWindow (our graphics.get(), our startWindow, our endWindow, minimum, maximum); Graphics_setColour (our graphics.get(), Graphics_BLACK); if (sound) { long first, last; if (Sampled_getWindowSamples (sound, our startWindow, our endWindow, & first, & last) > 1) { Graphics_setLineType (our graphics.get(), Graphics_DOTTED); Graphics_line (our graphics.get(), our startWindow, 0.0, our endWindow, 0.0); Graphics_setLineType (our graphics.get(), Graphics_DRAWN); Graphics_function (our graphics.get(), sound -> z [1], first, last, Sampled_indexToX (sound, first), Sampled_indexToX (sound, last)); } } Graphics_setColour (our graphics.get(), Graphics_BLUE); Graphics_setWindow (our graphics.get(), our startWindow, our endWindow, -1.0, +1.0); for (long i = 1; i <= point -> nt; i ++) { double t = point -> t [i]; if (t >= our startWindow && t <= our endWindow) Graphics_line (our graphics.get(), t, -0.9, t, +0.9); } Graphics_setColour (our graphics.get(), Graphics_BLACK); v_updateMenuItems_file ();}
开发者ID:ghedlund,项目名称:libpraat,代码行数:36,
示例19: LogisticRegression_drawBoundaryvoid LogisticRegression_drawBoundary (LogisticRegression me, Graphics graphics, long colx, double xleft, double xright, long coly, double ybottom, double ytop, bool garnish){ RegressionParameter parmx = static_cast<RegressionParameter> (my parameters -> item [colx]); RegressionParameter parmy = static_cast<RegressionParameter> (my parameters -> item [coly]); if (xleft == xright) { xleft = parmx -> minimum; xright = parmx -> maximum; } if (ybottom == ytop) { ybottom = parmy -> minimum; ytop = parmy -> maximum; } double intercept = my intercept; for (long iparm = 1; iparm <= my parameters -> size; iparm ++) { if (iparm != colx && iparm != coly) { RegressionParameter parm = static_cast<RegressionParameter> (my parameters -> item [iparm]); intercept += parm -> value * (0.5 * (parm -> minimum + parm -> maximum)); } } Graphics_setInner (graphics); Graphics_setWindow (graphics, xleft, xright, ybottom, ytop); double xbottom = (intercept + parmy -> value * ybottom) / - parmx -> value; double xtop = (intercept + parmy -> value * ytop) / - parmx -> value; double yleft = (intercept + parmx -> value * xleft) / - parmy -> value; double yright = (intercept + parmx -> value * xright) / - parmy -> value; double xmin = NUMmin2 (xleft, xright), xmax = NUMmax2 (xleft, xright); double ymin = NUMmin2 (ybottom, ytop), ymax = NUMmax2 (ybottom, ytop); //Melder_casual ("LogisticRegression_drawBoundary: %f %f %f %f %f %f %f %f", // xmin, xmax, xbottom, xtop, ymin, ymax, yleft, yright); if (xbottom >= xmin && xbottom <= xmax) { // line goes through bottom? if (xtop >= xmin && xtop <= xmax) // line goes through top? Graphics_line (graphics, xbottom, ybottom, xtop, ytop); // draw from bottom to top else if (yleft >= ymin && yleft <= ymax) // line goes through left? Graphics_line (graphics, xbottom, ybottom, xleft, yleft); // draw from bottom to left else if (yright >= ymin && yright <= ymax) // line goes through right? Graphics_line (graphics, xbottom, ybottom, xright, yright); // draw from bottom to right } else if (yleft >= ymin && yleft <= ymax) { // line goes through left? if (yright >= ymin && yright <= ymax) // line goes through right? Graphics_line (graphics, xleft, yleft, xright, yright); // draw from left to right else if (xtop >= xmin && xtop <= xmax) // line goes through top? Graphics_line (graphics, xleft, yleft, xtop, ytop); // draw from left to top } else if (xtop >= xmin && xtop <= xmax) { // line goes through top? if (yright >= ymin && yright <= ymax) // line goes through right? Graphics_line (graphics, xtop, ytop, xright, yright); // draw from top to right } Graphics_unsetInner (graphics); if (garnish) { Graphics_drawInnerBox (graphics); Graphics_textBottom (graphics, true, parmx -> label); Graphics_marksBottom (graphics, 2, true, true, false); Graphics_textLeft (graphics, true, parmy -> label); Graphics_marksLeft (graphics, 2, true, true, false); }}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:55,
示例20: classMinimizer_afterHookstatic void classMinimizer_afterHook (Minimizer me, Thing /* boss */) { if (my success || ! my gmonitor) { return; } if (my start == 1) { Minimizer_drawHistory (me, my gmonitor, 0, my maxNumOfIterations, 0.0, 1.1 * my history[1], 1); Graphics_textTop (my gmonitor, false, Melder_cat (U"Dimension of search space: ", my nParameters)); } Graphics_setInner (my gmonitor); Graphics_line (my gmonitor, my iteration, my history[my iteration], my iteration, my history[my iteration]); Graphics_unsetInner (my gmonitor); Melder_monitor ((double) (my iteration) / my maxNumOfIterations, U"Iterations: ", my iteration, U", Function calls: ", my funcCalls, U", Cost: ", my minimum);}
开发者ID:jjatria,项目名称:praat,代码行数:16,
示例21: BandFilterSpectrogram_drawFrequencyScale// xmin, xmax in hz versus bark/mel or linvoid BandFilterSpectrogram_drawFrequencyScale (BandFilterSpectrogram me, Graphics g, double xmin, double xmax, double ymin, double ymax, int garnish) { if (xmin < 0 || xmax < 0 || ymin < 0 || ymax < 0) { Melder_warning (U"Frequencies must be >= 0."); return; } // scale is in hertz if (xmin >= xmax) { // autoscaling xmin = 0; xmax = my v_frequencyToHertz (my ymax); } if (ymin >= ymax) { // autoscaling ymin = my ymin; ymax = my ymax; } long n = 2000; Graphics_setInner (g); Graphics_setWindow (g, xmin, xmax, ymin, ymax); double dx = (xmax - xmin) / (n - 1); double x1 = xmin, y1 = my v_hertzToFrequency (x1); for (long i = 2; i <= n; i++) { double x2 = x1 + dx, y2 = my v_hertzToFrequency (x2); if (NUMdefined (y1) && NUMdefined (y2)) { double xo1, yo1, xo2, yo2; if (NUMclipLineWithinRectangle (x1, y1, x2, y2, xmin, ymin, xmax, ymax, &xo1, &yo1, &xo2, &yo2)) { Graphics_line (g, xo1, yo1, xo2, yo2); } } x1 = x2; y1 = y2; } Graphics_unsetInner (g); if (garnish) { Graphics_drawInnerBox (g); Graphics_marksLeft (g, 2, 1, 1, 0); Graphics_textLeft (g, 1, Melder_cat (U"Frequency (", my v_getFrequencyUnit (), U")")); Graphics_marksBottom (g, 2, 1, 1, 0); Graphics_textBottom (g, 1, U"Frequency (Hz)"); }}
开发者ID:davideberdin,项目名称:praat,代码行数:45,
示例22: TableOfReal_drawAsNumbers_ifvoid TableOfReal_drawAsNumbers_if (TableOfReal me, Graphics graphics, long rowmin, long rowmax, int iformat, int precision, const wchar_t *conditionFormula, Interpreter interpreter){ try { autoMatrix original = TableOfReal_to_Matrix (me); autoMatrix conditions = original.clone (); 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); Matrix_formula (original.peek(), conditionFormula, interpreter, conditions.peek()); 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 ++) if (conditions -> z [irow] [icol] != 0.0) { 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); } catch (MelderError) { Melder_throw (me, ": numbers not drawn."); }}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:42,
示例23: TableOfReal_drawHorizontalLinesvoid TableOfReal_drawHorizontalLines (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; double top = rowmin; if (maxTextWidth > 0.0) left -= maxTextWidth + 2 * lineSpacing; if (maxTextHeight > 0.0) rowmin -= 1; double right = colmax + 0.5; for (long irow = rowmin; irow < rowmax; irow ++) { double y = 1 - lineSpacing * (irow - top + 1); Graphics_line (graphics, left, y, right, y); } Graphics_unsetInner (graphics);}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:20,
示例24: PointProcess_drawvoid PointProcess_draw (PointProcess me, Graphics g, double tmin, double tmax, bool garnish) { if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; } Graphics_setWindow (g, tmin, tmax, -1.0, 1.0); if (my nt) { long imin = PointProcess_getHighIndex (me, tmin); long imax = PointProcess_getLowIndex (me, tmax); int lineType = Graphics_inqLineType (g); Graphics_setLineType (g, Graphics_DOTTED); Graphics_setInner (g); for (long i = imin; i <= imax; i ++) { Graphics_line (g, my t [i], -1.0, my t [i], 1.0); } Graphics_setLineType (g, lineType); Graphics_unsetInner (g); } if (garnish) { Graphics_drawInnerBox (g); Graphics_textBottom (g, true, U"Time (s)"); Graphics_marksBottom (g, 2, true, true, false); }}
开发者ID:READSEARCH,项目名称:praat,代码行数:21,
示例25: Pitch_Intensity_drawvoid Pitch_Intensity_draw (Pitch pitch, Intensity intensity, Graphics g, double f1, double f2, double s1, double s2, int garnish, int connect){ if (f2 <= f1) Pitch_getExtrema (pitch, & f1, & f2); if (f1 == 0.0) return; /* All voiceless. */ if (f1 == f2) { f1 -= 1.0; f2 += 1.0; } if (s2 <= s1) Matrix_getWindowExtrema (intensity, 0, 0, 1, 1, & s1, & s2); if (s1 == s2) { s1 -= 1.0; s2 += 1.0; } Graphics_setWindow (g, f1, f2, s1, s2); Graphics_setInner (g); long previousI = 0; double previousX = NUMundefined, previousY = NUMundefined; for (long i = 1; i <= pitch -> nx; i ++) { double t = Sampled_indexToX (pitch, i); double x = pitch -> frame [i]. candidate [1]. frequency; double y = Sampled_getValueAtX (intensity, t, Pitch_LEVEL_FREQUENCY, kPitch_unit_HERTZ, TRUE); if (x == 0) { continue; /* Voiceless. */ } if (connect & 1) Graphics_speckle (g, x, y); if ((connect & 2) && NUMdefined (previousX)) { if (previousI >= 1 && previousI < i - 1) { Graphics_setLineType (g, Graphics_DOTTED); } Graphics_line (g, previousX, previousY, x, y); Graphics_setLineType (g, Graphics_DRAWN); } previousX = x; previousY = y; previousI = i; } Graphics_unsetInner (g); if (garnish) { Graphics_drawInnerBox (g); Graphics_textBottom (g, 1, L"Fundamental frequency (Hz)"); Graphics_marksBottom (g, 2, 1, 1, 0); Graphics_textLeft (g, 1, L"Intensity (dB)"); Graphics_marksLeft (g, 2, 1, 1, 0); }}
开发者ID:Crisil,项目名称:praat,代码行数:40,
示例26: classMinimizer_afterstatic void classMinimizer_after (I, Any aclosure) { iam (Minimizer); (void) aclosure; if (my success || ! my gmonitor) { return; } if (my start == 1) { wchar_t s[35]; Minimizer_drawHistory (me, my gmonitor, 0, my maxNumOfIterations, 0, 1.1 * my history[1], 1); swprintf (s, 35, L"Dimension of search space: %6ld", my nParameters); Graphics_textTop (my gmonitor, 0, s); } Graphics_setInner (my gmonitor); Graphics_line (my gmonitor, my iteration, my history[my iteration], my iteration, my history[my iteration]); Graphics_unsetInner (my gmonitor); Melder_monitor ( (double) (my iteration) / my maxNumOfIterations, L"Iterations: ", Melder_integer (my iteration), L", Function calls: ", Melder_integer (my funcCalls), L", Cost: ", Melder_double (my minimum));}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:23,
示例27: Polygons_drawConnectionvoid Polygons_drawConnection (Polygon me, Polygon thee, Graphics g, double xmin, double xmax, double ymin, double ymax, int hasArrow, double relativeLength){ double w2 = 0.5 * (1 - relativeLength), w1 = 1 - w2; long n = my numberOfPoints; if (thy numberOfPoints < n) n = thy numberOfPoints; Graphics_setInner (g); setWindow (me, g, xmin, xmax, ymin, ymax); for (long i = 1; i <= n; i ++) { double x1 = my x [i], x2 = thy x [i], y1 = my y [i], y2 = thy y [i]; double dummy = w1 * x1 + w2 * x2; x2 = w1 * x2 + w2 * x1; x1 = dummy; dummy = w1 * y1 + w2 * y2; y2 = w1 * y2 + w2 * y1; y1 = dummy; if (hasArrow) Graphics_arrow (g, x1, y1, x2, y2); else Graphics_line (g, x1, y1, x2, y2); } Graphics_unsetInner (g);}
开发者ID:psibre,项目名称:praat,代码行数:23,
示例28: RealTier_drawvoid RealTier_draw (RealTier me, Graphics g, double tmin, double tmax, double fmin, double fmax, int garnish, const char32 *method, const char32 *quantity){ bool drawLines = str32str (method, U"lines") || str32str (method, U"Lines"); bool drawSpeckles = str32str (method, U"speckles") || str32str (method, U"Speckles"); long n = my points.size, imin, imax, i; if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; } Graphics_setWindow (g, tmin, tmax, fmin, fmax); Graphics_setInner (g); imin = AnyTier_timeToHighIndex (me->asAnyTier(), tmin); imax = AnyTier_timeToLowIndex (me->asAnyTier(), tmax); if (n == 0) { } else if (imax < imin) { double fleft = RealTier_getValueAtTime (me, tmin); double fright = RealTier_getValueAtTime (me, tmax); if (drawLines) Graphics_line (g, tmin, fleft, tmax, fright); } else for (i = imin; i <= imax; i ++) { RealPoint point = my points.at [i]; double t = point -> number, f = point -> value; if (drawSpeckles) Graphics_speckle (g, t, f); if (drawLines) { if (i == 1) Graphics_line (g, tmin, f, t, f); else if (i == imin) Graphics_line (g, t, f, tmin, RealTier_getValueAtTime (me, tmin)); if (i == n) Graphics_line (g, t, f, tmax, f); else if (i == imax) Graphics_line (g, t, f, tmax, RealTier_getValueAtTime (me, tmax)); else { RealPoint pointRight = my points.at [i + 1]; Graphics_line (g, t, f, pointRight -> number, pointRight -> value); } } } Graphics_unsetInner (g); if (garnish) { Graphics_drawInnerBox (g); Graphics_textBottom (g, true, my v_getUnitText (0, 0, 0)); Graphics_marksBottom (g, 2, true, true, false); Graphics_marksLeft (g, 2, true, true, false); if (quantity) Graphics_textLeft (g, true, quantity); }}
开发者ID:READSEARCH,项目名称:praat,代码行数:44,
示例29: v_drawvoid structFormantGridEditor :: v_draw () { FormantGrid grid = (FormantGrid) our data; Ordered tiers = our editingBandwidths ? grid -> bandwidths : grid -> formants; RealTier selectedTier = (RealTier) tiers -> item [selectedFormant]; double ymin = our editingBandwidths ? our p_bandwidthFloor : our p_formantFloor; double ymax = our editingBandwidths ? our p_bandwidthCeiling : our p_formantCeiling; Graphics_setColour (our d_graphics, Graphics_WHITE); Graphics_setWindow (our d_graphics, 0, 1, 0, 1); Graphics_fillRectangle (our d_graphics, 0, 1, 0, 1); Graphics_setWindow (our d_graphics, our d_startWindow, our d_endWindow, ymin, ymax); Graphics_setColour (our d_graphics, Graphics_RED); Graphics_line (our d_graphics, our d_startWindow, our ycursor, our d_endWindow, our ycursor); Graphics_setTextAlignment (our d_graphics, Graphics_RIGHT, Graphics_HALF); Graphics_text (our d_graphics, our d_startWindow, our ycursor, Melder_float (Melder_half (our ycursor))); Graphics_setColour (our d_graphics, Graphics_BLUE); Graphics_setTextAlignment (our d_graphics, Graphics_LEFT, Graphics_TOP); Graphics_text (our d_graphics, our d_endWindow, ymax, Melder_float (Melder_half (ymax)), U" Hz"); Graphics_setTextAlignment (our d_graphics, Graphics_LEFT, Graphics_HALF); Graphics_text (our d_graphics, our d_endWindow, ymin, Melder_float (Melder_half (ymin)), U" Hz"); Graphics_setLineWidth (our d_graphics, 1); Graphics_setColour (our d_graphics, Graphics_GREY); for (long iformant = 1; iformant <= grid -> formants -> size; iformant ++) if (iformant != our selectedFormant) { RealTier tier = (RealTier) tiers -> item [iformant]; long imin = AnyTier_timeToHighIndex (tier, our d_startWindow); long imax = AnyTier_timeToLowIndex (tier, our d_endWindow); long n = tier -> points -> size; if (n == 0) { } else if (imax < imin) { double yleft = RealTier_getValueAtTime (tier, our d_startWindow); double yright = RealTier_getValueAtTime (tier, our d_endWindow); Graphics_line (our d_graphics, our d_startWindow, yleft, our d_endWindow, yright); } else for (long i = imin; i <= imax; i ++) { RealPoint point = (RealPoint) tier -> points -> item [i]; double t = point -> number, y = point -> value; Graphics_fillCircle_mm (our d_graphics, t, y, 2); if (i == 1) Graphics_line (our d_graphics, our d_startWindow, y, t, y); else if (i == imin) Graphics_line (our d_graphics, t, y, our d_startWindow, RealTier_getValueAtTime (tier, our d_startWindow)); if (i == n) Graphics_line (our d_graphics, t, y, our d_endWindow, y); else if (i == imax) Graphics_line (our d_graphics, t, y, our d_endWindow, RealTier_getValueAtTime (tier, our d_endWindow)); else { RealPoint pointRight = (RealPoint) tier -> points -> item [i + 1]; Graphics_line (our d_graphics, t, y, pointRight -> number, pointRight -> value); } } } Graphics_setColour (our d_graphics, Graphics_BLUE); long ifirstSelected = AnyTier_timeToHighIndex (selectedTier, our d_startSelection); long ilastSelected = AnyTier_timeToLowIndex (selectedTier, our d_endSelection); long n = selectedTier -> points -> size; long imin = AnyTier_timeToHighIndex (selectedTier, our d_startWindow); long imax = AnyTier_timeToLowIndex (selectedTier, our d_endWindow); Graphics_setLineWidth (our d_graphics, 2); if (n == 0) { Graphics_setTextAlignment (our d_graphics, Graphics_CENTRE, Graphics_HALF); Graphics_text (our d_graphics, 0.5 * (our d_startWindow + our d_endWindow), 0.5 * (ymin + ymax), U"(no points in selected formant tier)"); } else if (imax < imin) { double yleft = RealTier_getValueAtTime (selectedTier, our d_startWindow); double yright = RealTier_getValueAtTime (selectedTier, our d_endWindow); Graphics_line (our d_graphics, our d_startWindow, yleft, our d_endWindow, yright); } else for (long i = imin; i <= imax; i ++) { RealPoint point = (RealPoint) selectedTier -> points -> item [i]; double t = point -> number, y = point -> value; if (i >= ifirstSelected && i <= ilastSelected) Graphics_setColour (our d_graphics, Graphics_RED); Graphics_fillCircle_mm (our d_graphics, t, y, 3); Graphics_setColour (our d_graphics, Graphics_BLUE); if (i == 1) Graphics_line (our d_graphics, our d_startWindow, y, t, y); else if (i == imin) Graphics_line (our d_graphics, t, y, our d_startWindow, RealTier_getValueAtTime (selectedTier, our d_startWindow)); if (i == n) Graphics_line (our d_graphics, t, y, our d_endWindow, y); else if (i == imax) Graphics_line (our d_graphics, t, y, our d_endWindow, RealTier_getValueAtTime (selectedTier, our d_endWindow)); else { RealPoint pointRight = (RealPoint) selectedTier -> points -> item [i + 1]; Graphics_line (our d_graphics, t, y, pointRight -> number, pointRight -> value); } } Graphics_setLineWidth (our d_graphics, 1); Graphics_setColour (our d_graphics, Graphics_BLACK);}
开发者ID:ffostertw,项目名称:praat,代码行数:87,
注:本文中的Graphics_line函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Graphics_marksBottom函数代码示例 C++ Graphics_drawInnerBox函数代码示例 |