Пример #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)));
}
Пример #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++;
}
Пример #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);
}
Пример #4
0
int HorzPixelsToDots(const Draw& draw, int dots)
{
	return draw.Dots() ? dots : fround(dots / GetHorzPixelsPerDot(draw));
}
Пример #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));
}
Пример #6
0
int PixelsToDots(const Draw& draw, int pixels)
{
	return draw.Dots() ? pixels : fround(pixels / GetAvgPixelsPerDot(draw));
}
Пример #7
0
int VertDotsToPixels(const Draw& draw, int dots)
{
	return draw.Dots() ? dots : fround(dots * GetVertPixelsPerDot(draw));
}
Пример #8
0
double GetAvgPixelsPerDot(const Draw& draw)
{
	if(draw.Dots())
		return 1;
	return GetAvgPixelsPerMeter(draw) / DOTS_PER_METER_DBL;
}
Пример #9
0
double GetVertPixelsPerDot(const Draw& draw)
{
	return draw.Dots() ? 1 : GetVertPixelsPerMeter(draw) / DOTS_PER_METER_DBL;
}
Пример #10
0
int GetVertPixelsPerMeter(const Draw& draw)
{
	return draw.Dots() ? DOTS_PER_METER_INT : 96 * DOTS_PER_METER_INT / 600;
}
Пример #11
0
Size PointsToPixels(const Draw& draw, Size points)
{
	if(draw.Dots())
		return points * 600 / 72;
	return iscale(points, draw.GetPixelsPerInch(), Size(72, 72));
}
Пример #12
0
int PointsToPixels(const Draw& draw, int points)
{
	if(draw.Dots())
		return points * 600 / 72;
	return iscale(points, draw.GetPixelsPerInch().cx, 72);
}
Пример #13
0
Size PixelsToPoints(const Draw& draw, Size pixels)
{
	if(draw.Dots())
		return pixels * 72 / 600;
	return iscale(pixels, Size(72, 72), draw.GetPixelsPerInch());
}
Пример #14
0
int PixelsToPoints(const Draw& draw, int pixels)
{
	if(draw.Dots())
		return pixels * 72 / 600;
	return iscale(pixels, 72, draw.GetPixelsPerInch().cx);
}
Пример #15
0
int GetVertPixelsPerMeter(const Draw& draw)
{
	return draw.Dots() ? DOTS_PER_METER_INT
		: iscale(draw.GetPagePixels().cy, 1000, max(draw.GetPageMMs().cy, 1));
}