zoukankan      html  css  js  c++  java
  • SkScalar

    http://code.google.com/p/skia/wiki/SkScalar 

    Skia使用SkScalar指定所有设备无关的坐标.

    SkScalar 在编译时指定为32位整形(16.16 见SkFixed)或者IEEE 32位float

    可以通过头文件SkScalar.h的宏定义/内联来判断SkScalar的准确定义。

       SkScalar x, y;
    
       // all of these work fine as floats or SkFixed    以下在float和SkFixed都正确
       x = SkIntToScalar(35);
       y = x * 5;
       x = y / 3;
       y += x;
    
       // these give drastically different results between floats and SkFixed 以下在float和SkFixed有巨大差异
       x += 1;
       x = y * y;
       // This won't compile if scalar == float   以下在float情况导致编译错误
       y >>= 2;
    

      SkScalar.h通过宏/内联抽象了大多数操作的知识

       SkScalarMul(a, b)  // mulitplies two scalars, returning a scalar   相乘
       SkScalarDiv(a, b)  // divides two scalars, returning a scalar    除以
       SkScalarCos(a)     // returns the cosine as a scalar [0 .. SK_Scalar1] given a scalar radians   
       SkScalarRound(a)   // returns the nearest int to the specified scalar
    

      

    ezhong的博客园:http://www.cnblogs.com/ezhong/

  • 相关阅读:
    弹性盒子模型属性之flex-shrink
    Git----基本操作
    Git----简介
    ES6常用语法
    nginx学习
    Shell基础命令(二)
    Linux目录
    Shell基础命令(一)
    CRM之分页
    Django之ModelForm组件
  • 原文地址:https://www.cnblogs.com/ezhong/p/2264212.html
Copyright © 2011-2022 走看看