1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00

Added method Image::getClippedImage(), which allows the use of images that refer to subsections of another image. This means that the the parameters to a couple of Graphics methods no longer need a clipping rectangle. Also dded a static Image::null object and another constructor for Image::BitmapData.

This commit is contained in:
Julian Storer 2010-07-09 13:35:50 +01:00
parent fe92227a4d
commit 9f0c91196f
39 changed files with 198 additions and 160 deletions

View file

@ -140,7 +140,7 @@ void LowLevelGraphicsPostScriptRenderer::clipToPath (const Path& path, const Aff
out << "clip\n";
}
void LowLevelGraphicsPostScriptRenderer::clipToImageAlpha (const Image& /*sourceImage*/, const Rectangle<int>& /*srcClip*/, const AffineTransform& /*transform*/)
void LowLevelGraphicsPostScriptRenderer::clipToImageAlpha (const Image& /*sourceImage*/, const AffineTransform& /*transform*/)
{
needToClip = true;
jassertfalse; // xxx
@ -454,11 +454,10 @@ void LowLevelGraphicsPostScriptRenderer::writeImage (const Image& im,
out << "\n>}\n";
}
void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
const AffineTransform& transform, const bool /*fillEntireClipAsTiles*/)
void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, const AffineTransform& transform, const bool /*fillEntireClipAsTiles*/)
{
const int w = jmin (sourceImage.getWidth(), srcClip.getRight());
const int h = jmin (sourceImage.getHeight(), srcClip.getBottom());
const int w = sourceImage.getWidth();
const int h = sourceImage.getHeight();
writeClip();
@ -468,7 +467,6 @@ void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, co
RectangleList imageClip;
sourceImage.createSolidAreaMask (imageClip, 0.5f);
imageClip.clipTo (srcClip);
out << "newpath ";
int itemsOnLine = 0;
@ -491,7 +489,7 @@ void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, co
out << w << ' ' << h << " scale\n";
out << w << ' ' << h << " 8 [" << w << " 0 0 -" << h << ' ' << (int) 0 << ' ' << h << " ]\n";
writeImage (sourceImage, srcClip.getX(), srcClip.getY(), srcClip.getWidth(), srcClip.getHeight());
writeImage (sourceImage, 0, 0, w, h);
out << "false 3 colorimage grestore\n";
needToClip = true;