當前位置: 首頁>>代碼示例>>Java>>正文


Java Page類代碼示例

本文整理匯總了Java中com.badlogic.gdx.tools.texturepacker.TexturePacker.Page的典型用法代碼示例。如果您正苦於以下問題:Java Page類的具體用法?Java Page怎麽用?Java Page使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Page類屬於com.badlogic.gdx.tools.texturepacker.TexturePacker包,在下文中一共展示了Page類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: pack

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
public Array<Page> pack (Array<Rect> inputRects) {
for (int i = 0, nn = inputRects.size; i < nn; i++) {
	Rect rect = inputRects.get(i);
	rect.width += settings.paddingX;
	rect.height += settings.paddingY;
}

if (settings.fast) {
	if (settings.rotation) {
		// Sort by longest side if rotation is enabled.
		sort.sort(inputRects, new Comparator<Rect>() {
			public int compare (Rect o1, Rect o2) {
				int n1 = o1.width > o1.height ? o1.width : o1.height;
				int n2 = o2.width > o2.height ? o2.width : o2.height;
				return n2 - n1;
			}
		});
	} else {
		// Sort only by width (largest to smallest) if rotation is disabled.
		sort.sort(inputRects, new Comparator<Rect>() {
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:21,代碼來源:MaxRectsPacker.java

示例2: packAtSize

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
/** @param fully If true, the only results that pack all rects will be considered. If false, all results are considered, not
 *           all rects may be packed. */
private Page packAtSize (boolean fully, int width, int height, Array<Rect> inputRects) {
	Page bestResult = null;
	for (int i = 0, n = methods.length; i < n; i++) {
		maxRects.init(width, height);
		Page result;
		if (!settings.fast) {
			result = maxRects.pack(inputRects, methods[i]);
		} else {
			Array<Rect> remaining = new Array();
			for (int ii = 0, nn = inputRects.size; ii < nn; ii++) {
				Rect rect = inputRects.get(ii);
				if (maxRects.insert(rect, methods[i]) == null) {
					while (ii < nn)
						remaining.add(inputRects.get(ii++));
				}
			}
			result = maxRects.getResult();
			result.remainingRects = remaining;
		}
		if (fully && result.remainingRects.size > 0) continue;
		if (result.outputRects.size == 0) continue;
		bestResult = getBest(bestResult, result);
	}
	return bestResult;
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:28,代碼來源:MaxRectsPacker.java

示例3: pack

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
public Array<Page> pack (Array<Rect> inputRects) {
	if (!settings.silent) System.out.print("Packing");

	int cellWidth = 0, cellHeight = 0;
	for (int i = 0, nn = inputRects.size; i < nn; i++) {
		Rect rect = inputRects.get(i);
		cellWidth = Math.max(cellWidth, rect.width);
		cellHeight = Math.max(cellHeight, rect.height);
	}
	cellWidth += settings.paddingX;
	cellHeight += settings.paddingY;

	inputRects.reverse();

	Array<Page> pages = new Array();
	while (inputRects.size > 0) {
		Page result = packPage(inputRects, cellWidth, cellHeight);
		pages.add(result);
	}
	return pages;
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:22,代碼來源:GridPacker.java

示例4: packAtSize

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
/** @param fully If true, the only results that pack all rects will be considered. If false, all results are considered, not all
 *           rects may be packed. */
private Page packAtSize (boolean fully, int width, int height, Array<Rect> inputRects) {
	Page bestResult = null;
	for (int i = 0, n = methods.length; i < n; i++) {
		maxRects.init(width, height);
		Page result;
		if (!settings.fast) {
			result = maxRects.pack(inputRects, methods[i]);
		} else {
			Array<Rect> remaining = new Array();
			for (int ii = 0, nn = inputRects.size; ii < nn; ii++) {
				Rect rect = inputRects.get(ii);
				if (maxRects.insert(rect, methods[i]) == null) {
					while (ii < nn)
						remaining.add(inputRects.get(ii++));
				}
			}
			result = maxRects.getResult();
			result.remainingRects = remaining;
		}
		if (fully && result.remainingRects.size > 0) continue;
		if (result.outputRects.size == 0) continue;
		bestResult = getBest(bestResult, result);
	}
	return bestResult;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:28,代碼來源:MaxRectsPacker.java

示例5: pack

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
public Array<Page> pack (Array<Rect> inputRects) {
	System.out.print("Packing");

	int cellWidth = 0, cellHeight = 0;
	for (int i = 0, nn = inputRects.size; i < nn; i++) {
		Rect rect = inputRects.get(i);
		cellWidth = Math.max(cellWidth, rect.width);
		cellHeight = Math.max(cellHeight, rect.height);
	}
	cellWidth += settings.paddingX;
	cellHeight += settings.paddingY;

	inputRects.reverse();

	Array<Page> pages = new Array();
	while (inputRects.size > 0) {
		Page result = packPage(inputRects, cellWidth, cellHeight);
		pages.add(result);
	}
	return pages;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:22,代碼來源:GridPacker.java

示例6: getResult

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
public Page getResult () {
	int w = 0, h = 0;
	for (int i = 0; i < usedRectangles.size; i++) {
		Rect rect = usedRectangles.get(i);
		w = Math.max(w, rect.x + rect.width);
		h = Math.max(h, rect.y + rect.height);
	}
	Page result = new Page();
	result.outputRects = new Array(usedRectangles);
	result.occupancy = getOccupancy();
	result.width = w;
	result.height = h;
	return result;
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:15,代碼來源:MaxRectsPacker.java

示例7: getBest

import com.badlogic.gdx.tools.texturepacker.TexturePacker.Page; //導入依賴的package包/類
private Page getBest (Page result1, Page result2) {
	if (result1 == null) return result2;
	if (result2 == null) return result1;
	return result1.occupancy > result2.occupancy ? result1 : result2;
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:6,代碼來源:MaxRectsPacker.java


注:本文中的com.badlogic.gdx.tools.texturepacker.TexturePacker.Page類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。