日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > Paths中的幾個重要元素

Paths中的幾個重要元素

來源:程序員人生   發布時間:2014-12-09 08:16:34 閱讀次數:3819次

Paths中的幾個重要元素

Paths中的幾個重要元素

Points
void CGContextMoveToPoint (
                          
CGContextRef c,
                          
CGFloat x,
                          
CGFloat y
                           );
指定1個點成為current point
Quartz
會跟蹤current point1般履行完1個相干函數后,current point都會相應的改變.
Lines
相干的幾個函數
void CGContextAddLineToPoint (
                             
CGContextRef c,
                             
CGFloat x,
                             
CGFloat y
                              );
創建1條直線,從current point (x,y)
然后current point會變成(x,y)

void CGContextAddLines (
                        CGContextRef c,
                       
const CGPoint points[],
                        size_t count
                        );
創建多條直線,比如points有兩個點,那末會畫兩條直線 current point (x1,y1),
然后是(x1,y1)(x2,y2)
然后current point會變成points中的最后1個點

Arcs
兩種方法創建弧度 第1種
void CGContextAddArc (
                      CGContextRef c,
                      CGFloat x,            
//圓心的x坐標
                      CGFloat y,   
//圓心的x坐標
                      CGFloat radius,  
//圓的半徑
                      CGFloat startAngle,   
//開始弧度
                      CGFloat endAngle,  
//結束弧度
                     
int clockwise          //0表示順時針,1表示逆時針
);
假設想創建1個完全的圓圈,那末 開始弧度就是0 結束弧度是 2pi 由于圓周長是 2*pi*r.
最后,函數履行完后,current point就被重置為(x,y).
還有1點要注意的是,假設當前path已存在1個subpath,那末這個函數履行的另外1個效果是
會有1條直線,從current point到弧的出發點


第2種
void CGContextAddArcToPoint (
                             CGContextRef c,
                             CGFloat x1, 
//端點1x坐標
                             CGFloat y1, 
//端點1y坐標
                             CGFloat x2, 
//端點2x坐標
                             CGFloat y2, 
//端點2y坐標
                             CGFloat radius
//半徑
);
原理:首先畫兩條線,這兩條線分別是 current point to (x1,y1) (x1,y1) to (x2,y2).
這樣就是出現1個以(x1,y1)為頂點的兩條射線,
然后定義半徑長度,這個半徑是垂直于兩條射線的,這樣就可以決定1個圓了,更好的理解看下圖,不過個人認為下圖所標的 tangent point 1的位置是毛病的。
最后,函數履行完后,current point就被重置為(x2,y2).
還有1點要注意的是,假設當前path已存在1個subpath,那末這個函數履行的另外1個效果是
會有1條直線,從current point(x1,y1)

Curves
畫曲線,1般是1條直線,然后定義幾個控制點,使直線變曲折。
3次曲線函數
void CGContextAddCurveToPoint (
                               CGContextRef c,
                               CGFloat cp1x,
//控制點1 x坐標
                               CGFloat cp1y,
//控制點1 y坐標
                               CGFloat cp2x,
//控制點2 x坐標
                               CGFloat cp2y,
//控制點2 y坐標
                               CGFloat x, 
//直線的終點 x坐標
                               CGFloat y 
//直線的終點 y坐標
);
假設第2個控制點(cp2xcp2y)比(cp1x,cp1y 更接近current point,那末會構成1個封閉的曲線

2次曲線函數
void CGContextAddQuadCurveToPoint (
                                   CGContextRef c,
                                   CGFloat cpx, 
//控制點 x坐標
                                   CGFloat cpy, 
//控制點 y坐標
                                   CGFloat x, 
//直線的終點 x坐標
                                   CGFloat y 
//直線的終點 y坐標
);
履行完函數貌似current point不會變化,沒有具體測試過
Ellipses
void CGContextAddEllipseInRect (
                                CGContextRef context,
                                CGRect rect 
//1矩形
);
如果矩形是1個正方形,那末畫出來就是1個圓
履行完函數貌似current point不會變化,沒有具體測試過
Rectangles
void CGContextAddRect (
                       CGContextRef c,
                       CGRect rect
                       );

1次性畫出多個矩形
void CGContextAddRects (
                        CGContextRef c,
                       
const CGRect rects[],
                        size_t count
                        );
需要注意的是,畫矩形有1些特別,current point沒有產生變化


Creating a Path
調用函數 CGContextBeginPath 開始創建路徑,線調用函數CGContextMoveToPoint設置出發點
然后開始畫自己想畫的路徑,注意1下幾點:
1.Lines, arcs, and curves,是從current point開始的
2.假設想封閉1條路徑,那末調用函數 CGContextClosePath 把當前點和出發點連接起來
3.當在畫 arcs的時候,Quartz會畫1條線從current point starting point
4.畫矩形的時候不會有第3條那這樣的的1條直線
5.創建完路徑后,必須調用 painting 函數  fill or stroke the path,不然不會畫上面東東在相應的裝備上】
6.開始創建1個新的路徑的時候,使用函數 CGContextBeginPath

重復利用路徑的相干函數和數據類型
CGPathCreateMutable
類似于 CGContextBeginPath
CGPathMoveToPoint
類似于 CGContextMoveToPoint
CGPathAddLineToPoint
類似于 CGContextAddLineToPoint
CGPathAddCurveToPoint
類似于 CGContextAddCurveToPoint
CGPathAddEllipseInRect
類似于 CGContextAddEllipseInRect
CGPathAddArc
類似于 CGContextAddArc
CGPathAddRect
類似于 CGContextAddRect
CGPathCloseSubpath
類似于 CGContextClosePath
CGPathRef
CGMutablePathRef

CGContextAddPath函數把1個路徑添加到graphics context
void CGContextAddPath (
                       CGContextRef context,
                       CGPathRef path
                       );

Painting a Path
Stroking
:畫前途徑
Filling
:填充路徑的封閉區域

影響Stroking的參數
Line width
void CGContextSetLineWidth (
                            CGContextRef c,
                            CGFloat width
                            );
Line join
:線轉彎的時候的樣式,比如油滑的方式
void CGContextSetLineJoin (
                           CGContextRef c,
                           CGLineJoin join
                           );


Line cap:線的兩真個樣式,比如兩端變的油滑
void CGContextSetLineCap (
                          CGContextRef c,
                          CGLineCap cap
                          );


Miter limit:當Line join的模式是Miter join的時候,這個參數會有影響
void CGContextSetMiterLimit (
                             CGContextRef c,
                             CGFloat limit
                             );
Line dash pattern
:虛線相干
void CGContextSetLineDash (
                           CGContextRef c,
                           CGFloat phase,
                          
const CGFloat lengths[],
                           size_t count
                           );

Stroke color space
void CGContextSetStrokeColorSpace (
                                   CGContextRef c,
                                   CGColorSpaceRef colorspace
                                   );
Stroke color
void CGContextSetStrokeColor (
                             
CGContextRef c,
                             
const CGFloat components[]
                              );
void CGContextSetStrokeColorWithColor (
                                      
CGContextRef c,
                                      
CGColorRef color
                                       );
Stroke pattern
(和透明度相干)
void CGContextSetStrokePattern (
                                CGContextRef c,
                                CGPatternRef pattern,
                               
const CGFloat components[]
                                );


Stroking
的相干函數
Strokes
當前path.
void CGContextStrokePath (
                          CGContextRef c
                          );

Strokes
指定的 矩形.
void CGContextStrokeRect (
                          CGContextRef c,
                          CGRect rect
                          );

Strokes
指定的 矩形, 使用指定的寬度.
void CGContextStrokeRectWithWidth (
                                   CGContextRef c,
                                   CGRect rect,
                                   CGFloat width
                                   );

Strokes
指定的橢圓.
void CGContextStrokeEllipseInRect (
                                   CGContextRef context,
                                   CGRect rect
                                   );

Strokes
1些直線.
void CGContextStrokeLineSegments (
                                  CGContextRef c,
                                 
const CGPoint points[],
                                  size_t count
                                  );

決定是Stroking 還是 生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 日本一二区视频 | 亚洲专区欧美 | 警花av一区二区三区 | 久久高清精品 | 久久久久久精 | 麻豆精品国产 | 国产九九精品 | 中文字幕一区二区三区在线观看 | 久久精品九九 | 久久久综合色 | 亚洲电影免费观看 | 久久久久国产精品一区二区 | 亚洲一区中文字幕 | 国产理论片 | 欧美性猛交xxxx乱大交蜜桃 | 美女黄视频网站 | 一区二区福利视频 | 国产精品黄在线观看 | 正在播放国产一区 | 国产精品亚洲第一区在线暖暖韩国 | 日韩一级在线观看 | 免费一二三区 | 精品成人网 | 国产欧美欧洲 | 色诱亚洲精品久久久久久 | 精品国产乱码久久久久久蜜柚 | 亚洲精品尤物福利在线一区 | 久久久精品电影 | 欧美区一区二 | 亚洲精品乱码久久久久久动图 | 亚洲免费视频网站 | av影视网 | 中文字幕综合网 | 国产福利在线 | 五月婷婷在线观看 | 一级黄色国产片 | 日韩av电影在线播放 | 亚洲国产精品成人 | 日本精品在线视频 | 国产精品免费网站 | 亚洲国产第一 |