SCADA-GDI的APIs
1. 颜色(color)对象:
创建:
GDI::newColor( $r, $g, $b ) ;
GDI::newColor( $a, $r, $g, $b ) ;
GDI::newColor( $RGB ) ;
GDI::newColor( 0 ) ;
GDI::newColor( $colorStr ) ;
GDI::newColor( "red" ) ;
GDI::newColor( "#808080" ) ;
接口:
isColor() // 是否是color对象
2. 画布(graphics)对象:
创建:
GDI::newGraphics( hDC ) ;
接口:
drawLine( $pen, $x1,$y1, $x2,$y2 ) ;
drawLine( $pen, $pt1, $pt2 ) ;
同义词:
drawRectangle()
drawRect()
drawRect( $pen, $rect ) ;
drawRect( $pen, $x,$y, $width,$height ) ;
drawEllipse()
drawEllipse( $pen, $rect ) ;
drawEllipse( $pen, $x,$y, $width,$height ) ;
// 输出文字.
->drawString( $str, $font, $x,$y, $brush ) ;
// 画圆弧
->drawArc( $pen, $rect, $startAngle, $endAngle ) ;
// 画Bezier曲线.
->drawBezier( $pen, $startPt, $controlPt1, $controlPt2, $endPt ) ;
// 画图.
->drawImage( $image, $x, $y ) ;
->drawImage( $image, $x, $y, $width, $height ) ;
->drawImage( $image, $point ) ;
->drawImage( $image, $rect ) ;
// 画圆饼
->drawPie( $pen, $rect, $startAngle, $endAngle ) ;
同义词:
fillRectangle()
fillRect()
fillRect( $brush, $rect ) ;
fillRect( $brush, $x,$y, $width,$height ) ;
fillEllipse()
fillEllipse( $brush, $rect ) ;
fillEllipse( $brush, $x,$y, $width,$height ) ;
// 填充圆饼
->fillPie( $brush, $rect, $startAngle, $endAngle ) ;
// 清除坐标变换信息.
->resetTransform() ;
// 平移
->translateTransform( $dx, $dy ) ;
// 缩放坐标系.
->scaleTransform() ;
// 旋转.
->rotateTransform( $angle ) ;
//( 支持像素,英寸 等 ) Unit enumeration (Windows): http://msdn.microsoft.com/en-us/library/ms534405(v=vs.85).aspx
//->setPageUnit( $unitStyle ) ; // "world"(0) / "display"(1) / "pixel"(2) / "point"(3) / "inch"(4) / "document"(5) / "millimeter"(6)
// 获取X的 dpi.
->getDpiX() ;
// 获取Y的 dpi.
->getDpiY() ;
3. 画笔(pen)对象:
创建:
GDI::newPen( $color ) ; // 这种情况默认 画笔大小为1.
GDI::newPen( $color, $width ) ;
GDI::newPen( "red" ) ;
GDI::newPen( "#FFFFFF", 2 ) ;
GDI::newPen( GDI::newColor( 128,0,0,0 ) ) ;
接口:
setAlignment( $alignStyle ) ; // "inset" / "center"
setStartCap( $lineCap ) ; // "flat" / "square" / "round" / "triangle" / "noAnchor" / "squareAnchor" / "roundAnchor" / "diamondAnchor" / "arrowAnchor" / "custom"
setEndCap( $lineCap ) ; // 同 setStartCap()参数.
setDashStyle( $dashStyle ) ; // "solid" / "dash" / "dot" / "dashDot" / "dashDotDot" / "custom"
setDashCap( $dashCap ) ; // "flat" / "round" / "triangle"
setDashPattern( $val1... ) ;
4. 图像(Image)对象:
创建:
GDI::newImage( $fileName ) ;
5. 刷子(Brush)对象:
创建:
// 单一颜色brush
GDI::newSolidBrush( $color ) ;
GDI::newSolidBrush( "red" ) ;
GDI::newSolidBrush( "#FFFFFF" ) ;
GDI::newSolidBrush( GDI::newColor( 128,0,0,0 ) ) ;
// 中空brush.
GDI::newHatchBrush( $style, $color1, $color2 ) ;
// style: "Horizontal"|"Hor" / "Vertical"|"Vert" / "ForwardDiagonal" / "BackwardDiagonal" / "Cross" /
// "DiagonalCross" / "05Percent" / "10Percent" / "20Percent" / "25Percent" / "30Percent" /
// "40Percent" / "50Percent" / "60Percent" / "70Percent" / "80Percent" / "90Percent" /
// "LightDownwardDiagonal" / "LightUpwardDiagonal" / "DarkDownwardDiagonal" / "DarkUpwardDiagonal" /
// "WideDownwardDiagonal" / "WideUpwardDiagonal" / "LightVertical" / "LightHorizontal" /
// "NarrowVertical" / "NarrowHorizontal" / "DarkVertical" / "DarkHorizontal" / "DashedDownwardDiagonal" /
// "DashedUpwardDiagonal" / "DashedHorizontal" / "DashedVertical" / "SmallConfetti" / "LargeConfetti" /
// "ZigZag" / "Wave" / "DiagonalBrick" / "HorizontalBrick" / "Weave" / "Plaid" / "Divot" / "DottedGrid" /
// "DottedDiamond" / "Shingle" / "Trellis" / "Sphere" / "SmallGrid" / "SmallCheckerBoard" /
// "LargeCheckerBoard" / "OutlinedDiamond" / "SolidDiamond" /
GDI::newHatchBrush( "hor", "black", "red" ) ;
GDI::newHatchBrush( "hor", GDI::newColor( 255,0,0,0 ), GDI::newColor(128,0,0,0 ) ) ;
// TextureBrush
GDI::newTextureBrush( $image ) ;
GDI::newTextureBrush( $image, $wrapMode ) ; // wrapMode: "tile" / "tileFlipX" / "tileFlipY" / "tileFlipXY" / "clamp"
// 线性过渡刷子
GDI::newLinearGradientBrush( $pt1, $pt2, $color1, $color2 ) ; // 注意: 只支持了使用 color对象
GDI::newLinearGradientBrush( $rect, $color1, $color2, $angle, $isAngleScalable ) ; // 注意: 只支持了使用 color对象
接口:
setTransform( $matrix ) // 设置 坐标变换( 注意: 必须要是 TextureBrush. )
isBrush()
6. 矩阵(Matrix)对象: ( 用于坐标变换的 3X3 矩阵 )
GDI::newMatrix() ;
GDI::newMatrix( $m11, $m12, $m21, $m22, $dx, $dy ) ;
7. 点(Point)对象
GDI::newPoint() ;
GDI::newPoint( $x, $y ) ;
属性:
.x
.y
8. 矩形(Rect)对象:
GDI::newRect()
GDI::newRect( $x, $y, $width, $height ) ;
属性:
.x ( 同义词: .left )
.y ( 同义词: .top )
.width
.height
方法:
->getLeft()
->getX()
->getTop()
->getY()
->getWidth()
->getHeight()
->getRight()
->getBottom()
->getCenterX()
->getCenterY()
->setLeft()
->setX()
->setTop()
->setY()
->setWidth()
->setHeight()
9. Path --> 未支持.
10. Region ---> 未支持.
posted on 2012-06-15 17:39 smartfish_liu 阅读(401) 评论(0) 编辑 收藏 举报