Esempio n. 1
0
Size GetPixelsPerMeter(const Draw& draw)
{
	if(draw.Dots())
		return Size(DOTS_PER_METER_INT, DOTS_PER_METER_INT);
	else
		return iscale(draw.GetPagePixels(), Size(1000, 1000), max(draw.GetPageMMs(), Size(1, 1)));
}
Esempio n. 2
0
void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp)
{
	int xi = 0;
	int cx = m.GetWidth();
	int ccy = m.GetHeight();
	Buffer<bool> todo(cx, true);
#ifdef BENCHMARK_RLE
	sTotal += cx;
#endif
	while(xi < cx) {
		int xi0 = xi;
		while(w.Dots() && IsWhiteColumn(m, xi) && xi < cx)
			xi++;
		if(xi - xi0 >= 16) {
#ifdef BENCHMARK_RLE
			sRle += xi - xi0;
#endif
			w.DrawRect(x + xi0, y, xi - xi0, ccy, White);
			Fill(~todo + xi0, ~todo + xi, false);
		}
		xi++;
	}
	
	xi = 0;
	while(xi < cx)
		if(todo[xi]) {
			int xi0 = xi;
			while(xi < cx && todo[xi] && xi - xi0 < 2000)
				xi++;
			w.DrawImage(x + xi0, y, m, RectC(xi0, 0, xi - xi0, ccy));
		}
		else
			xi++;
}
Esempio n. 3
0
NAMESPACE_UPP

#ifdef SYSTEMDRAW

Size GetPixelsPerMeter(const Draw& draw)
{
	if(draw.Dots())
		return Size(DOTS_PER_METER_INT, DOTS_PER_METER_INT);
	else
		return Size(96 * DOTS_PER_METER_INT / 600, 96 * DOTS_PER_METER_INT / 600);
}
Esempio n. 4
0
int HorzPixelsToDots(const Draw& draw, int dots)
{
	return draw.Dots() ? dots : fround(dots / GetHorzPixelsPerDot(draw));
}
Esempio n. 5
0
Size PixelsToDots(const Draw& draw, Size size)
{
	return draw.Dots() ? size
		: iscale(size, Size(DOTS_PER_METER_INT, DOTS_PER_METER_INT), GetPixelsPerMeter(draw));
}
Esempio n. 6
0
int PixelsToDots(const Draw& draw, int pixels)
{
	return draw.Dots() ? pixels : fround(pixels / GetAvgPixelsPerDot(draw));
}
Esempio n. 7
0
int VertDotsToPixels(const Draw& draw, int dots)
{
	return draw.Dots() ? dots : fround(dots * GetVertPixelsPerDot(draw));
}
Esempio n. 8
0
double GetAvgPixelsPerDot(const Draw& draw)
{
	if(draw.Dots())
		return 1;
	return GetAvgPixelsPerMeter(draw) / DOTS_PER_METER_DBL;
}
Esempio n. 9
0
double GetVertPixelsPerDot(const Draw& draw)
{
	return draw.Dots() ? 1 : GetVertPixelsPerMeter(draw) / DOTS_PER_METER_DBL;
}
Esempio n. 10
0
int GetVertPixelsPerMeter(const Draw& draw)
{
	return draw.Dots() ? DOTS_PER_METER_INT : 96 * DOTS_PER_METER_INT / 600;
}
Esempio n. 11
0
Size PointsToPixels(const Draw& draw, Size points)
{
	if(draw.Dots())
		return points * 600 / 72;
	return iscale(points, draw.GetPixelsPerInch(), Size(72, 72));
}
Esempio n. 12
0
int PointsToPixels(const Draw& draw, int points)
{
	if(draw.Dots())
		return points * 600 / 72;
	return iscale(points, draw.GetPixelsPerInch().cx, 72);
}
Esempio n. 13
0
Size PixelsToPoints(const Draw& draw, Size pixels)
{
	if(draw.Dots())
		return pixels * 72 / 600;
	return iscale(pixels, Size(72, 72), draw.GetPixelsPerInch());
}
Esempio n. 14
0
int PixelsToPoints(const Draw& draw, int pixels)
{
	if(draw.Dots())
		return pixels * 72 / 600;
	return iscale(pixels, 72, draw.GetPixelsPerInch().cx);
}
Esempio n. 15
0
int GetVertPixelsPerMeter(const Draw& draw)
{
	return draw.Dots() ? DOTS_PER_METER_INT
		: iscale(draw.GetPagePixels().cy, 1000, max(draw.GetPageMMs().cy, 1));
}