zoukankan      html  css  js  c++  java
  • Draw a Star using Quartz 2D 不及格的程序员

     1 #define PSIZE 16    // size of the pattern cell
     2  
     3 static void MyDrawStencilStar (void *info, CGContextRef myContext)
     4 {
     5     int k;
     6     double r, theta;
     7  
     8     r = 0.8 * PSIZE / 2;
     9     theta = 2 * M_PI * (2.0 / 5.0); // 144 degrees
    10  
    11     CGContextTranslateCTM (myContext, PSIZE/2, PSIZE/2);
    12  
    13     CGContextMoveToPoint(myContext, 0, r);
    14     for (k = 1; k < 5; k++) {
    15         CGContextAddLineToPoint (myContext,
    16                     r * sin(k * theta),
    17                     r * cos(k * theta));
    18     }
    19     CGContextClosePath(myContext);
    20     CGContextFillPath(myContext);
    21 }
  • 相关阅读:
    在jsp页面如果运行时路径错误解决方法
    Maven实现ssm框架整合
    JS进阶(二)this指南——绑定了谁?
    防御性编程方法收集
    react将多个公共组件归成一类,方便调用
    初始化构建React+Ts项目时出现:Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssSyntaxError
    Dva三种方式实现dispatch的Promise回调
    ES6多层解构
    ES6解构过程添加一个默认值和赋值一个新的值
    Antd-Pro2.0版本如何修改代理,让Mock变为真实服务器接口
  • 原文地址:https://www.cnblogs.com/ioriwellings/p/2757176.html
Copyright © 2011-2022 走看看