本文整理汇总了C++中RectanglePlacement类的典型用法代码示例。如果您正苦于以下问题:C++ RectanglePlacement类的具体用法?C++ RectanglePlacement怎么用?C++ RectanglePlacement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RectanglePlacement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawImageWithin
void Graphics::drawImageWithin (const Image& imageToDraw,
const int destX, const int destY,
const int destW, const int destH,
const RectanglePlacement& placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const
{
// passing in a silly number can cause maths problems in rendering!
jassert (areCoordsSensibleNumbers (destX, destY, destW, destH));
if (imageToDraw.isValid())
{
const int imageW = imageToDraw.getWidth();
const int imageH = imageToDraw.getHeight();
if (imageW > 0 && imageH > 0)
{
double newX = 0.0, newY = 0.0;
double newW = imageW;
double newH = imageH;
placementWithinTarget.applyTo (newX, newY, newW, newH,
destX, destY, destW, destH);
if (newW > 0 && newH > 0)
{
drawImage (imageToDraw,
roundToInt (newX), roundToInt (newY),
roundToInt (newW), roundToInt (newH),
0, 0, imageW, imageH,
fillAlphaChannelWithCurrentBrush);
}
}
}
}
示例2: setBoundsWithCorrectAspectRatio
void QuickTimeMovieComponent::setBoundsWithCorrectAspectRatio (const Rectangle& spaceToFitWithin,
const RectanglePlacement& placement)
{
int normalWidth, normalHeight;
getMovieNormalSize (normalWidth, normalHeight);
if (normalWidth > 0 && normalHeight > 0 && ! spaceToFitWithin.isEmpty())
{
double x = 0.0, y = 0.0, w = normalWidth, h = normalHeight;
placement.applyTo (x, y, w, h,
spaceToFitWithin.getX(), spaceToFitWithin.getY(),
spaceToFitWithin.getWidth(), spaceToFitWithin.getHeight());
if (w > 0 && h > 0)
{
setBounds (roundToInt (x), roundToInt (y),
roundToInt (w), roundToInt (h));
}
}
else
{
setBounds (spaceToFitWithin);
}
}
示例3: drawImage
void Graphics::drawImage (const Image& imageToDraw, Rectangle<float> targetArea,
RectanglePlacement placementWithinTarget, bool fillAlphaChannelWithCurrentBrush) const
{
if (imageToDraw.isValid())
drawImageTransformed (imageToDraw,
placementWithinTarget.getTransformToFit (imageToDraw.getBounds().toFloat(), targetArea),
fillAlphaChannelWithCurrentBrush);
}
示例4: drawImageWithin
void Graphics::drawImageWithin (const Image& imageToDraw,
int dx, int dy, int dw, int dh,
RectanglePlacement placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const
{
if (imageToDraw.isValid())
drawImageTransformed (imageToDraw,
placementWithinTarget.getTransformToFit (imageToDraw.getBounds().toFloat(),
coordsToRectangle (dx, dy, dw, dh).toFloat()),
fillAlphaChannelWithCurrentBrush);
}
示例5: setBoundsWithCorrectAspectRatio
void QuickTimeMovieComponent::setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
RectanglePlacement placement)
{
int normalWidth, normalHeight;
getMovieNormalSize (normalWidth, normalHeight);
const Rectangle<int> normalSize (0, 0, normalWidth, normalHeight);
if (! (spaceToFitWithin.isEmpty() || normalSize.isEmpty()))
setBounds (placement.appliedTo (normalSize, spaceToFitWithin));
else
setBounds (spaceToFitWithin);
}
示例6: drawCurrentImage
void drawCurrentImage (Graphics& g, int x, int y, int w, int h)
{
if (imageNeedsFlipping)
{
const ScopedLock sl (imageSwapLock);
std::swap (loadingImage, activeImage);
imageNeedsFlipping = false;
}
RectanglePlacement rp (RectanglePlacement::centred);
double dx = 0, dy = 0, dw = width, dh = height;
rp.applyTo (dx, dy, dw, dh, x, y, w, h);
const int rx = roundToInt (dx), ry = roundToInt (dy);
const int rw = roundToInt (dw), rh = roundToInt (dh);
{
Graphics::ScopedSaveState ss (g);
g.excludeClipRegion (Rectangle<int> (rx, ry, rw, rh));
g.fillAll (Colours::black);
}
g.drawImage (activeImage, rx, ry, rw, rh, 0, 0, width, height);
}
示例7: drawWithin
void Drawable::drawWithin (Graphics& g, const Rectangle<float>& destArea, const RectanglePlacement& placement, float opacity) const
{
draw (g, opacity, placement.getTransformToFit (getDrawableBounds(), destArea));
}
示例8: setTransformToFit
void Drawable::setTransformToFit (const Rectangle<float>& area, const RectanglePlacement& placement)
{
if (! area.isEmpty())
setTransform (placement.getTransformToFit (getDrawableBounds(), area));
}