【无标题】

 

Graphics 类

1.1呈现文本

1.1.1设置字体

g.setFont(20.0f); //设置字体大小

juce::Font mainComponentFont ("Times New Roman", 20.0f, juce::Font::italic);

Font 构造函数的第一个参数确定字体,第二个参数是字体大小,第三个参数是字体样式。

可以在一个语句中执行这两项操作,而不是创建一个命名的 Font 对象

g.setFont (juce::Font ("Times New Roman", 20.0f, juce::Font::italic));

警告:

        使用实际上并未安装在计算机上的字体是字体在 JUCE 应用程序中无法正常工作的一个非常常见的原因。

1.1.2 设置位置

g.drawText ("Hello, World!", 20, 40, 200, 40, juce::Justification::centred, true);

        告诉 Graphics 对象将文本呈现到一个区域,该区域宽 200 像素,高 40 像素,位于主组件左上角右侧 20 像素和底部 40 像素处。

  Graphics::drawText() 函数的最后一个参数是一个标志,它决定如果文本不适合给定的宽度,是否应显示省略号 (...),或者是否应简单地切断文本。

Graphics::d rawText() 函数适用于呈现单行文本。对于多行文本,它提供 Graphics::d rawMultiLineText() 和 Graphics::d rawFittedText()。

1.1.3 渲染几何形状

1.1.3.1 绘制线条

将以下行添加到函数的底部:paint()

g.setColour (juce::Colours::green);

g.drawLine (10, 300, 590, 300, 5);

这将在窗口上绘制一条 5 像素宽的绿色水平线,从 (10, 300) 开始,到 (590, 300)

注意:每次您想用上次使用的颜色以外的其他颜色绘制几何形状时,都必须在绘制之前调用 Graphics::setColour() 函数。

1.1.3.2 绘制矩形

使用 Graphics 对象绘制矩形非常简单。将以下行添加到函数体中:paint()

g.setColour (juce::Colours::sandybrown);

g.drawRect (300, 120, 200, 170);

这将呈现一个棕色矩形,宽 200 像素,高 170 像素,左上角位于位置 (300, 120). 可选的第五个参数允许您指定线条粗细:

g.setColour (juce::Colours::sandybrown);

g.drawRect (300, 120, 200, 170, 3);

如果您想要一个填充矩形,请改用函数 Graphics::fillRect():

g.setColour (juce::Colours::sandybrown);

g.fillRect (300, 120, 200, 170);

与单独给出位置、宽度和高度不同,还有一个更方便的类来表示矩形:Rectangle 类。还有一个版本的 Graphics::d rawRect() 函数采用这样的 Rectangle 实例来指定矩形的位置:

juce::Rectangle<int> house (300, 120, 200, 170);

g.setColour (juce::Colours::sandybrown);

g.fillRect (house);

这个非常方便的 Rectangle 类将在以后的教程中进行探讨。

您不必用纯色填充矩形。您还可以使用颜色渐变或其他几种模式之一。让我们想象一下,棕色矩形代表一栋房子。我们可以通过用方格图案填充它来添加类似砖块的纹理。使用以下代码绘制矩形:

juce::Rectangle<float> house (300, 120, 200, 170);

g.fillCheckerBoard (house, 30, 10, juce::Colours::sandybrown, juce::Colours::saddlebrown);

1.1.3.3  绘制圆圈

函数 Graphics::d rawEllipse() 和 Graphics::fillEllipse()。

让我们为我们的小景观添加一个太阳。以下代码将在窗口的右上角区域绘制一个 60 像素的圆圈:

g.setColour (juce::Colours::yellow);

g.drawEllipse (530, 10, 60, 60, 3);

请注意,给定的位置 (530, 10) 不会将圆心置于该位置。相反,与所有其他图形元素一样,对象的放置方式是使其封闭矩形的左上角位于给定位置。

您还可以显式使用组件的边界来计算位置,例如:

g.setColour (juce::Colours::yellow);

g.drawEllipse (getWidth() - 70, 10, 60, 60, 3);

1.1.3.4 绘制其他多边形

 Path 类。它基本上处理任何连接点集。

我们可以使用三个点 (300, 110) , (500, 110) , (400, 70) 绘制三角形

g.setColour (juce::Colours::red);

Path roof;

roof.addTriangle (300, 110, 500, 110, 400, 70);

g.fillPath (roof);

1.2 接口函数

Graphics (const Image &imageToDrawOnto)

  创建一个 Graphics 对象以直接绘制到给定图像上。创建的图形对象将被设置为在图像上绘制,上下文的剪切区域是图像的整个大小,其原点是图像的原点。要绘制到图像的子部分,请使用 reduceClipRegion() 和 setOrigin() 方法。显然,在删除此上下文之前,不应删除图像。

void setColour (Colour newColour)

更改当前绘图颜色。

这将设置现在将用于绘图操作的颜色 - 它还将不透明度设置为传入的颜色的不透明度。

如果在调用此方法时正在使用画笔,则将取消选择画笔,并且将改为使用纯色画笔完成任何后续绘图。

void setOpacity (float newOpacity)

更改要与当前颜色一起使用的不透明度。

如果使用纯色进行绘图,则会将其不透明度更改为此新值(即,它不会将颜色的不透明度乘以此量)。值 0.0 表示完全透明,1.0 表示完全不透明。

void setGradientFill (const ColourGradient &gradient)

  将上下文设置为对其填充模式使用渐变 

void setGradientFill (ColourGradient &&gradient)

  将上下文设置为对其填充模式使用渐变 

void setTiledImageFill (const Image &imageToUse, int anchorX, int anchorY, float opacity(不透明度))

  将上下文设置为使用平铺图像图案进行填充。

void setFillType (const FillType &newFill)

  更改当前填充设置。

void setFillType (const FillType &newFill)

  更改用于后续文本绘制功能的字体。 

void setFont (float newFontHeight)

  更改当前所选字体的大小。

Font getCurrentFont () const

  返回当前选定的字体。

void drawSingleLineText (const String &text, int startX, int baselineY, Justification justification=Justification::left) const

绘制单行文本字符串。这将使用当前颜色(或画笔)来填充文本。字体是 setFont() 指定的最后一个字体。

void drawMultiLineText (const String &text, int startX, int baselineY, int maximumLineWidth, Justification justification=Justification::left, float leading=0.0f) const

在多行之间绘制文本。这会将文本中断到具有换行符或回车符的新行中,或者当文本宽度超过 maximumLineWidth 参数指定的大小时,将文本中断到单词边界上。换行符将由指定的前导线垂直分隔。

void drawText (const String &text, int x, int y, int width, int height, Justification justificationType, bool useEllipsesIfTooBig=true) const

在指定的矩形内绘制一行文本。文本将根据传入的对齐标志放置在矩形内。如果字符串太长而无法放入矩形内,则它将被截断或在其末尾添加省略号(如果 useEllipsesIfTooBig 标志为 true)。

void drawText (const String &text, int x, int y, int width, int height, Justification justificationType, bool useEllipsesIfTooBig=true) const

在指定的矩形内绘制一行文本。文本将根据传入的对齐标志放置在矩形内。如果字符串太长而无法放入矩形内,则它将被截断或在其末尾添加省略号(如果 useEllipsesIfTooBig 标志为 true)。

void drawText (const String &text, Rectangle< float > area, Justification justificationType, bool useEllipsesIfTooBig=true) const

  在指定的矩形内绘制一行文本。文本将根据传入的对齐标志放置在矩形内。如果字符串太长而无法放入矩形内,则它将被截断或在其末尾添加省略号(如果 useEllipsesIfTooBig 标志为 true)。

void drawFittedText (const String &text, int x, int y, int width, int height, Justification justificationFlags, int maximumNumberOfLines, float minimumHorizontalScale=0.0f) const

  尝试在给定空间内绘制文本字符串。这可以尽最大努力使给定的文本在指定的矩形内可读,因此对于标记事物很有用。

如果文本太大,则如果 maximumLinesToUse 值允许,它将被水平压缩或分行分行。如果文本无法适应空间,它会尽可能多地塞进去,并在末尾添加一些省略号以表明它已被截断。

void drawFittedText (const String &text, Rectangle< int > area, Justification justificationFlags, int maximumNumberOfLines, float minimumHorizontalScale=0.0f) const

  Tries to draw a text string inside a given space.

void fillAll () const

void fillAll (Colour colourToUse) const

  用给定的颜色填充上下文的整个剪辑区域。 

void fillRect (Rectangle< int > rectangle) const

 

void fillRect (Rectangle< float > rectangle) const

  

void fillRect (int x, int y, int width, int height) const



void fillRect (float x, float y, float width, float height) const

  使用当前颜色或画笔填充矩形。 

void fillRectList (const RectangleList< float > &rectangles) const

 

void fillRectList (const RectangleList< int > &rectangles) const

使用当前颜色或画笔填充一组矩形。

如果要绘制很多矩形,则创建 RectangleList 并使用此方法可能比多次调用 fillRect() 更有效。

void fillRoundedRectangle (float x, float y, float width, float height, float cornerSize) const

  使用当前颜色或画笔填充带有圆角的矩形。 

void fillRoundedRectangle (Rectangle< float > rectangle, float cornerSize) const

  使用当前颜色或画笔填充带有圆角的矩形。 

void fillCheckerBoard (Rectangle< float > area, float checkWidth, float checkHeight, Colour colour1, Colour colour2) const

  用棋盘图案填充矩形,在两种颜色之间交替使用。 

void drawRect (int x, int y, int width, int height, int lineThickness=1) const

  使用当前颜色或画笔绘制矩形轮廓。线条绘制在给定矩形内,较大的线条粗细向内延伸。

void drawRect (float x, float y, float width, float height, float lineThickness=1.0f) const

  Draws a rectangular outline, using the current colour or brush.

void drawRect (Rectangle< int > rectangle, int lineThickness=1) const

  Draws a rectangular outline, using the current colour or brush.

void drawRect (Rectangle< float > rectangle, float lineThickness=1.0f) const

  Draws a rectangular outline, using the current colour or brush.

void drawRoundedRectangle (float x, float y, float width, float height, float cornerSize, float lineThickness) const

  使用当前颜色或画笔绘制带有圆角的矩形的轮廓。

void drawRoundedRectangle (Rectangle< float > rectangle, float cornerSize, float lineThickness) const

  使用当前颜色或画笔绘制带有圆角的矩形的轮廓。

void fillEllipse (float x, float y, float width, float height) const

  用当前颜色或画笔填充椭圆。绘制椭圆以适合给定矩形内。.

void fillEllipse (Rectangle< float > area) const

  用当前颜色或画笔填充椭圆。绘制椭圆以适合给定矩形内。.

void drawEllipse (float x, float y, float width, float height, float lineThickness) const

  使用当前颜色或画笔绘制椭圆笔触。 

void drawEllipse (Rectangle< float > area, float lineThickness) const

  使用当前颜色或画笔绘制椭圆笔触。 

void drawLine (float startX, float startY, float endX, float endY) const

  在两点之间画一条线。 

void drawLine (float startX, float startY, float endX, float endY, float lineThickness) const

  在具有给定厚度的两点之间绘制一条线。提示:如果您正在尝试绘制水平线或垂直线,请不要使用此 - 除非您真的需要一条有角度的线,否则最好使用 fillRect()。

void drawLine (Line< float > line) const

  在两点之间画一条线

void drawLine (Line< float > line, float lineThickness) const

  在具有给定厚度的两点之间绘制一条线

void drawDashedLine (Line< float > line, const float *dashLengths, int numDashLengths, float lineThickness=1.0f, int dashIndexToStartFrom=0) const

  使用一组自定义的虚线长度绘制虚线。

参数

line

要画的线

dashLengths

指定开/关长度的一系列长度 - 例如 { 4, 5, 6, 7 } 将绘制一条 4 像素的线,跳过 5 个像素,绘制 6 个像素,跳过 7 个像素,然后重复。

numDashLengths

数组中的元素数(必须是偶数)。

llineThickness

要绘制的线的粗细

dashIndexToStartFrom

短划线长度数组中用于第一段的索引

void drawVerticalLine (int x, float top, float bottom) const

  在给定的 x 位置绘制一条垂直的像素线。

x 位置是一个整数,但行的顶部和底部可以是子像素位置,如有必要,这些位置将被抗锯齿。

底部参数必须大于或等于顶部参数。

void drawHorizontalLine (int y, float left, float right) const

在给定的 y 位置绘制像素的水平线。y 位置是一个整数,但线的左端和右端可以是子像素位置,如有必要,这些位置将被抗锯齿。right 参数必须大于或等于 left 参数。

void fillPath (const Path &path) const

  使用当前选定的颜色或画笔填充路径。

void fillPath (const Path &path, const AffineTransform &transform) const

  使用当前选定的颜色或画笔填充路径,并添加变换。 

void strokePath (const Path &path, const PathStrokeType &strokeType, const AffineTransform &transform={}) const

  使用当前选定的颜色或画笔绘制路径的轮廓。

void drawArrow (Line< float > line, float lineThickness, float arrowheadWidth, float arrowheadLength) const

  绘制一条末端带有箭头的线。 

void setImageResamplingQuality (ResamplingQuality newQuality)

更改重新取样图像时将使用的质量。

默认情况下,Graphics 对象将设置为 mediumRenderingQuality。

void drawImageAt (const Image &imageToDraw, int topLeftX, int topLeftY, bool fillAlphaChannelWithCurrentBrush=false) const

 绘制图像。

这将绘制图像的整个过程,将其左上角放置在给定的坐标上,并保持其大小不变。这是最简单的图像绘制方法 - 其他方法可以更好地控制图像的缩放和裁剪。

图像是使用上下文的当前不透明度合成的,因此,如果您不希望以半透明方式绘制图像,请务必在绘制图像之前调用 setOpacity (1.0f)(或使用不透明颜色的 setColour

void drawImage (const Image &imageToDraw, int destX, int destY, int destWidth, int destHeight, int sourceX, int sourceY, int sourceWidth, int sourceHeight, bool fillAlphaChannelWithCurrentBrush=false) const

  imageToDraw 要叠加的图像

destX 目标矩形的左侧

目标 目标矩形的顶部

destWidth(德斯特宽度) 目标矩形的宽度

destHeight(目标高度) 目标矩形的高度

来源X 要从源图像复制的矩形的左侧

来源Y 要从源图像复制的矩形的顶部

源宽度 要从源图像复制的矩形的宽度

sourceHeight 要从源图像复制的矩形的高度

fillAlphaChannelWithCurrentBrush 如果为 true,则不会绘制源图像的像素,而是将源图像的 Alpha 通道用作蒙版,用于使用当前颜色或画笔填充目标。(如果源没有 Alpha 通道,那么它将只用一个实心矩形填充目标)

void drawImageTransformed (const Image &imageToDraw, const AffineTransform &transform, bool fillAlphaChannelWithCurrentBrush=false) const

  绘制一个图像,并对其应用仿射变换。这使您可以以一些古怪的方式抛出图像,旋转它,剪切,缩放它,等等。图像是使用上下文的当前不透明度合成的,因此,如果您不希望以半透明方式绘制图像,请务必在绘制图像之前调用 setOpacity (1.0f)(或使用不透明颜色的 setColour())。

如果 fillAlphaChannelWithCurrentBrush 设置为 true,则将忽略图像的 RGB 通道,并使用当前画笔填充,并由其 Alpha 通道屏蔽。

如果您只想渲染图像的一个子部分,请使用 Image::getClippedImage() 创建您需要的部分。

void drawImage (const Image &imageToDraw, Rectangle< float > targetArea, RectanglePlacement placementWithinTarget=RectanglePlacement::stretchToFit, bool fillAlphaChannelWithCurrentBrush=false) const

  绘制图像以适应指定的矩形。

imageToDraw 要绘制的源图像

targetArea 要适应它的目标矩形

placementWithinTarget 这指定了图像应如何在目标矩形中定位 - 有关此内容的更多详细信息,请参阅 RectanglePlacement 类。

fillAlphaChannelWithCurrentBrush 如果为 true,则不会绘制图像,而是仅使用其 Alpha 通道用作蒙版,以便使用当前画笔或颜色进行绘制。这类似于 fillAlphaMap(),另请参阅 drawImage()

void drawImageWithin (const Image &imageToDraw, int destX, int destY, int destWidth, int destHeight, RectanglePlacement placementWithinTarget, bool fillAlphaChannelWithCurrentBrush=false) const

  绘制图像以适应指定的矩形。如果图像对于空间来说太大或太小,它将被重新缩放以尽可能好地适应,而不会影响其纵横比。然后,它将根据指定的对齐标志放置在目标矩形内。

参数

imageToDraw

要绘制的源图像

destX

目标矩形的左上角以使其适合

目标

目标矩形的左上角以使其适合

destWidth(德斯特宽度)

要使图像适应的目标矩形的大小

destHeight(目标高度)

要使图像适应的目标矩形的大小

placementWithinTarget

这指定了图像应如何在目标矩形中定位 - 有关此内容的更多详细信息,请参阅 RectanglePlacement 类。

fillAlphaChannelWithCurrentBrush

如果为 true,则不会绘制图像,而是仅使用其 Alpha 通道用作蒙版,以便使用当前画笔或颜色进行绘制。这类似于 fillAlphaMap(),另请参阅 drawImage()

Rectangle< int > getClipBounds () const

  返回当前剪裁区域的边界框的位置。 

bool clipRegionIntersects (Rectangle< int > area) const

  检查矩形是否与上下文的剪裁区域重叠。如果返回 false,则不能绘制给定区域的任何部分,因此可以使用此方法优化组件的 paint() 方法,让它避免绘制不在要重绘的区域内的复杂对象。

bool reduceClipRegion (int x, int y, int width, int height)

  将当前剪裁区域与另一个区域相交。

返回 如果生成的剪切区域的大小不为零,则为 true

bool reduceClipRegion (Rectangle< int > area)

  将当前剪裁区域与另一个区域相交。

返回 如果生成的剪切区域的大小不为零,则为 true

bool reduceClipRegion (const RectangleList< int > &clipRegion)

  将当前剪裁区域与另一个区域相交。

返回 如果生成的剪切区域的大小不为零,则为 true

bool reduceClipRegion (const Path &path, const AffineTransform &transform=AffineTransform())

  I将当前剪裁区域与另一个区域相交。

返回 如果生成的剪切区域的大小不为零,则为 true

bool reduceClipRegion (const Image &image, const AffineTransform &transform)

将当前剪切区域与图像的 Alpha 通道相交。

在图像被指定的矩阵变换后,当前剪切路径与此图像的 alpha 通道所覆盖的区域相交。

参数

图像 应使用其 Alpha 通道的图像。如果图像没有 Alpha 通道,则会将其视为完全不透明。

变换 要应用于图像的矩阵

返回

如果生成的剪切区域的大小不为零,则为 true

void excludeClipRegion (Rectangle< int > rectangleToExclude)

  排除矩形以阻止将其绘制到该矩形。

bool isClipEmpty () const

  如果由于剪辑区域为零而无法进行绘制,则返回 true。 

void saveState ()

  将当前图形状态保存在内部堆栈上。要恢复状态,请使用 restoreState()。

void restoreState ()

  恢复以前使用 saveState() 保存的图形状态。 

void beginTransparencyLayer (float layerOpacity)

  开始呈现到屏幕外位图,该位图稍后将使用给定的不透明度拼合到当前上下文中。

上下文使用临时图像层的内部堆栈来执行此操作。完成对图层的绘制后,调用 endTransparencyLayer() 以完成操作并合成完成的图层。对 beginTransparencyLayer() 的每次调用都必须与对 endTransparencyLayer() 的相应调用匹配!

此调用还会保存当前状态,而 endTransparencyLayer() 会恢复它。

void endTransparencyLayer ()

  完成对临时半透明缓冲区的绘图操作 

void setOrigin (Point< int > newOrigin)

  移动上下文原点的位置。这会将上下文认为为 (0, 0) 的位置更改为指定位置。

因此,如果使用 (100, 100) 调用 setOrigin,则之前称为 (100, 100) 的位置随后将被视为 (0, 0)。

void setOrigin (int newOriginX, int newOriginY)

  移动上下文原点的位置。这会将上下文认为为 (0, 0) 的位置更改为指定位置。

因此,如果调用 setOrigin (100, 100),则之前称为 (100, 100) 的位置随后将被视为 (0, 0)。

void addTransform (const AffineTransform &transform)

  添加一个转换,该转换将对上下文随后执行的所有图形操作执行。

调用 this 后,所有传递到上下文中的坐标都将由此矩阵转换。

void resetToDefaultState ()

  将当前颜色、画笔和字体重置为默认设置。 

bool isVectorDevice () const

  如果此上下文正在绘制到基于矢量的设备(如打印机),则返回 true。 

1.3 path 类

https://docs.juce.com/master/classPath.html

Path ()
Creates an empty path.
Path (const Path &)
Creates a copy of another path.
~Path ()
Destructor.
Path & operator= (const Path &)
从另一个路径复制此路径。
Path (Path &&) noexcept
Move 构造函数。
Path & operator= (Path &&) noexcept
Move assignment operator.
bool operator== (const Path &) const noexcept
bool operator!= (const Path &) const noexcept
bool isEmpty () const noexcept
如果路径不包含任何线条或曲线,则返回 true。
Rectangle< float > getBounds () const noexcept
返回包含路径内所有点的最小矩形。
Rectangle< float > getBoundsTransformed (const AffineTransform &transform) const noexcept
返回最小的矩形,该矩形包含路径内的所有点,该矩形在使用给定的转换矩阵进行转换后。
bool contains (float x, float y, float tolerance=defaultToleranceForTesting) const
检查点是否位于路径内。
bool contains (Point< float > point, float tolerance=defaultToleranceForTesting) const
检查点是否位于路径内。
bool intersectsLine (Line< float > line, float tolerance=defaultToleranceForTesting) const
检查线是否与路径相交
Line< float > getClippedLine (Line< float > line, bool keepSectionOutsidePath) const
切断线的某些部分,以保留此路径内部或外部的部分。
float getLength (const AffineTransform &transform=AffineTransform(), float tolerance=defaultToleranceForMeasurement) const
返回路径的长度
Point< float > getPointAlongPath (float distanceFromStart, const AffineTransform &transform=AffineTransform(), float tolerance=defaultToleranceForMeasurement) const
返回一个点,该点是沿路径的指定距离
float getNearestPoint (Point< float > targetPoint, Point< float > &pointOnPath, const AffineTransform &transform=AffineTransform(), float tolerance=defaultToleranceForMeasurement) const
查找路径上最接近给定位置的点。
void clear () noexcept
删除所有线条和曲线,完全重置路径。
void startNewSubPath (float startX, float startY)
从给定的起始位置开始新的子路径。
void startNewSubPath (Point< float > start)
Begins a new subpath with a given starting position.
void closeSubPath ()
Closes a the current sub-path with a line back to its start-point.
void lineTo (float endX, float endY)
Adds a line from the shape's last position to a new end-point.
void lineTo (Point< float > end)
Adds a line from the shape's last position to a new end-point.
void quadraticTo (float controlPointX, float controlPointY, float endPointX, float endPointY)
Adds a quadratic bezier curve from the shape's last position to a new position.
void quadraticTo (Point< float > controlPoint, Point< float > endPoint)
Adds a quadratic bezier curve from the shape's last position to a new position.
void cubicTo (float controlPoint1X, float controlPoint1Y, float controlPoint2X, float controlPoint2Y, float endPointX, float endPointY)
Adds a cubic bezier curve from the shape's last position to a new position.
void cubicTo (Point< float > controlPoint1, Point< float > controlPoint2, Point< float > endPoint)
Adds a cubic bezier curve from the shape's last position to a new position.
Point< float > getCurrentPosition () const
Returns the last point that was added to the path by one of the drawing methods.
void addRectangle (float x, float y, float width, float height)
Adds a rectangle to the path.
template<typename ValueType >
void addRectangle (Rectangle< ValueType > rectangle)
Adds a rectangle to the path.
void addRoundedRectangle (float x, float y, float width, float height, float cornerSize)
Adds a rectangle with rounded corners to the path.
void addRoundedRectangle (float x, float y, float width, float height, float cornerSizeX, float cornerSizeY)
Adds a rectangle with rounded corners to the path.
void addRoundedRectangle (float x, float y, float width, float height, float cornerSizeX, float cornerSizeY, bool curveTopLeft, bool curveTopRight, bool curveBottomLeft, bool curveBottomRight)
Adds a rectangle with rounded corners to the path.
template<typename ValueType >
void addRoundedRectangle (Rectangle< ValueType > rectangle, float cornerSizeX, float cornerSizeY)
Adds a rectangle with rounded corners to the path.
template<typename ValueType >
void addRoundedRectangle (Rectangle< ValueType > rectangle, float cornerSize)
Adds a rectangle with rounded corners to the path.
void addTriangle (float x1, float y1, float x2, float y2, float x3, float y3)
Adds a triangle to the path.
void addTriangle (Point< float > point1, Point< float > point2, Point< float > point3)
Adds a triangle to the path.
void addQuadrilateral (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
Adds a quadrilateral to the path.
void addEllipse (float x, float y, float width, float height)
Adds an ellipse to the path.
void addEllipse (Rectangle< float > area)
Adds an ellipse to the path.
void addArc (float x, float y, float width, float height, float fromRadians, float toRadians, bool startAsNewSubPath=false)
Adds an elliptical arc to the current path.
void addCentredArc (float centreX, float centreY, float radiusX, float radiusY, float rotationOfEllipse, float fromRadians, float toRadians, bool startAsNewSubPath=false)
Adds an arc which is centred at a given point, and can have a rotation specified.
void addPieSegment (float x, float y, float width, float height, float fromRadians, float toRadians, float innerCircleProportionalSize)
Adds a "pie-chart" shape to the path.
void addPieSegment (Rectangle< float > segmentBounds, float fromRadians, float toRadians, float innerCircleProportionalSize)
Adds a "pie-chart" shape to the path.
void addLineSegment (Line< float > line, float lineThickness)
Adds a line with a specified thickness.
void addArrow (Line< float > line, float lineThickness, float arrowheadWidth, float arrowheadLength)
Adds a line with an arrowhead on the end.
void addPolygon (Point< float > centre, int numberOfSides, float radius, float startAngle=0.0f)
Adds a polygon shape to the path.
void addStar (Point< float > centre, int numberOfPoints, float innerRadius, float outerRadius, float startAngle=0.0f)
Adds a star shape to the path.
void addBubble (Rectangle< float > bodyArea, Rectangle< float > maximumArea, Point< float > arrowTipPosition, float cornerSize, float arrowBaseWidth)
Adds a speech-bubble shape to the path.
void addPath (const Path &pathToAppend)
Adds another path to this one.
void addPath (const Path &pathToAppend, const AffineTransform &transformToApply)
Adds another path to this one, transforming it on the way in.
void swapWithPath (Path &) noexcept
Swaps the contents of this path with another one.
void preallocateSpace (int numExtraCoordsToMakeSpaceFor)
Preallocates enough space for adding the given number of coordinates to the path.
void applyTransform (const AffineTransform &transform) noexcept
Applies a 2D transform to all the vertices in the path.
void scaleToFit (float x, float y, float width, float height, bool preserveProportions) noexcept
Rescales this path to make it fit neatly into a given space.
AffineTransformgetTransformToScaleToFit (float x, float y, float width, float height, bool preserveProportions, Justification justificationType=Justification::centred) const
Returns a transform that can be used to rescale the path to fit into a given space.
AffineTransformgetTransformToScaleToFit (Rectangle< float > area, bool preserveProportions, Justification justificationType=Justification::centred) const
Returns a transform that can be used to rescale the path to fit into a given space.
PathcreatePathWithRoundedCorners (float cornerRadius) const
Creates a version of this path where all sharp corners have been replaced by curves.
void setUsingNonZeroWinding (bool isNonZeroWinding) noexcept
Changes the winding-rule to be used when filling the path.
bool isUsingNonZeroWinding () const
Returns the flag that indicates whether the path should use a non-zero winding rule.
void loadPathFromStream (InputStream &source)
Loads a stored path from a data stream.
void loadPathFromData (const void *data, size_t numberOfBytes)
Loads a stored path from a block of data.
void writePathToStream (OutputStream &destination) const
Stores the path by writing it out to a stream.
StringtoString () const
Creates a string containing a textual representation of this path.
void restoreFromString (StringRef stringVersion)
Restores this path from a string that was created with the toString() method.
  • 5
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值