Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sx = Std.int(screenX) + 1;
- var sy = Std.int(screenY);
- var cx = Std.int(surfaceWidth) - 1;
- var cy = Std.int(surfaceHeight) - 1;
- var borderSize:Int = 0;
- if (_style.borderSize != null) {
- borderSize = Std.int(_style.borderSize);
- }
- //borderSize = 3;
- //g.color = 0xFF000000;
- if (borderSize > 0) {
- g.color = _style.borderColor | 0xFF000000;
- //g.color = 0xFF000000;
- for (i in 0...borderSize) {
- g.drawRect(sx, sy, cx, cy);
- sx++;
- sy++;
- cx-=2;
- cy-=2;
- }
- //g.drawRect(x, y, cx, cy, borderSize);
- g.color = Color.White;
- }
- if (_style.backgroundColor != null) {
- sx--;
- //sy--;
- cx++;
- cy++;
- if (_style.backgroundColorEnd != null && _style.backgroundColor != _style.backgroundColorEnd) {
- sy-=borderSize;
- var gradientType:String = "vertical";
- if (_style.backgroundGradientStyle != null) {
- gradientType = _style.backgroundGradientStyle;
- }
- /*
- gradientType = "horizontal";
- _style.backgroundColor = 0xFFFF0000;
- _style.backgroundColorEnd = 0xFF00FF00;
- */
- var arr:Array<Int> = null;
- var n:Int = cast borderSize;
- var n:Int = 0;// cast borderSize;
- if (gradientType == "vertical") {
- arr = ColorUtil.buildColorArray(_style.backgroundColor, _style.backgroundColorEnd, Std.int(cy));
- for (c in arr) {
- g.color = c | 0xFF000000;
- g.drawLine(sx, sy + n + 1, sx + cx, sy + n + 1);
- //g.fillRect(sx, sy + n, cx, 1);
- g.color = Color.White;
- n++;
- }
- //g.color = Color.White;
- } else if (gradientType == "horizontal") {
- arr = ColorUtil.buildColorArray(_style.backgroundColor, _style.backgroundColorEnd, Std.int(cx));
- for (c in arr) {
- g.color = c | 0xFF000000;
- //g.fillRect(sx + n, sy, 1, cy);
- g.drawLine(sx + n + 1, sy + 1, sx + n + 1, sy + cy + 1);
- g.color = Color.White;
- //g.
- n++;
- }
- //g.color = Color.White;
- }
- g.color = Color.White;
- } else {
- g.color = _style.backgroundColor | 0xFF000000;
- g.fillRect(sx, sy, cx, cy);
- g.color = Color.White;
- }
- }
- for (c in __children) {
- c.renderTo(g);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement