当前位置: 首页>>代码示例>>Java>>正文


Java CGRect.getHeight方法代码示例

本文整理汇总了Java中org.robovm.apple.coregraphics.CGRect.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java CGRect.getHeight方法的具体用法?Java CGRect.getHeight怎么用?Java CGRect.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robovm.apple.coregraphics.CGRect的用法示例。


在下文中一共展示了CGRect.getHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRoundedRectToPath

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
/**
 * Adds a rectangular path to the given context and rounds its corners by
 * the given extents Original author: Björn Sållarp. Used with permission.
 * See: http://blog.sallarp.com/iphone-uiimage-round-corners/
 * 
 * @param rect
 * @param context
 * @param ovalWidth
 * @param ovalHeight
 */
private static void addRoundedRectToPath(CGRect rect, CGContext context, double ovalWidth, double ovalHeight) {
    if (ovalWidth == 0 || ovalHeight == 0) {
        context.addRect(rect);
        return;
    }

    context.saveGState();
    context.translateCTM(rect.getMinX(), rect.getMinY());
    context.scaleCTM(ovalWidth, ovalHeight);
    double fw = rect.getWidth() / ovalWidth;
    double fh = rect.getHeight() / ovalHeight;
    context.moveToPoint(fw, fh / 2);
    context.addArcToPoint(fw, fh, fw / 2, fh, 1);
    context.addArcToPoint(0, fh, 0, fh / 2, 1);
    context.addArcToPoint(0, 0, fw / 2, 0, 1);
    context.addArcToPoint(fw, 0, fw, fh / 2, 1);
    context.closePath();
    context.restoreGState();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:30,代码来源:UIImageUtility.java

示例2: getUIImage

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
private static UIImage getUIImage(InputStream inputStream, PlatformConnector.SvgScaleType scaleType, float scaleValue) {
    String svg = getStringFromInputStream(inputStream);
    SVGRenderer renderer = new SVGRenderer(svg);
    CGRect viewRect = renderer.getViewRect();


    double scale = 1;

    switch (scaleType) {

        case SCALED_TO_WIDTH:
            scale = scaleValue / viewRect.getWidth();
            break;
        case SCALED_TO_HEIGHT:
            scale = scaleValue / viewRect.getHeight();
            break;
        case DPI_SCALED:
            scale = CB.getScaledFloat(scaleValue);
            break;
        case SCALED_TO_WIDTH_OR_HEIGHT:
            scale = Math.min(scaleValue / viewRect.getHeight(), scaleValue / viewRect.getWidth());
            break;
    }

    double bitmapWidth = viewRect.getWidth() * scale;
    double bitmapHeight = viewRect.getHeight() * scale;

    return renderer.asImageWithSize(new CGSize(bitmapWidth, bitmapHeight), 1);
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:30,代码来源:IOS_RealSvgBitmap.java

示例3: screenSize

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
@Override public IDimension screenSize() {
  // we just recompute this when asked so that we have the right orientation

  // TODO: is this properly resolution independent?
  CGRect screenBounds = UIScreen.getMainScreen().getBounds();
  // TODO: (plat.osVersion < 8) manually divide by scale factor?
  // tODO: (plat.osVersion < 8) manually flip width/height when in landscape?
  screenSize.width = (int)screenBounds.getWidth();
  screenSize.height = (int)screenBounds.getHeight();
  if (useHalfSize(config)) {
    screenSize.width /= 2;
    screenSize.height /= 2;
  }
  return screenSize;
}
 
开发者ID:playn,项目名称:playn,代码行数:16,代码来源:RoboGraphics.java

示例4: computeBounds

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
private static Rectangle computeBounds(CTFont font, CGRect bounds) {
  // the y coordinate of bounds is a little tricky: iOS reports y as the number of pixels to
  // below the baseline that the text extends (the descent, but precisely for this text, not the
  // font's "maximum" descent) and the value is negative (due to the inverted coordinate system);
  // so we have to do some math to recover the desired y value which is the number of pixels
  // below the top-left of the line bounding box
  float ascent = (float)font.getAscent();
  return new Rectangle((float)bounds.getMinX(),
                       ascent - (float)(bounds.getHeight() + bounds.getMinY()),
                       (float)bounds.getWidth(), (float)bounds.getHeight());
}
 
开发者ID:playn,项目名称:playn,代码行数:12,代码来源:RoboTextLayout.java


注:本文中的org.robovm.apple.coregraphics.CGRect.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。