• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Page类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetReviewResultsForHITResult类代码示例发布时间:2022-05-16
下一篇:
Java DiscreteDistribution类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap