mirror of https://github.com/buggins/dlangui.git
support tiled images, part 1
This commit is contained in:
parent
5b528ec5dc
commit
64f5924b8e
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
|
@ -28,6 +28,7 @@ class SampleAnimationWidget : Widget {
|
||||||
ulong animationProgress;
|
ulong animationProgress;
|
||||||
this(string ID) {
|
this(string ID) {
|
||||||
super(ID);
|
super(ID);
|
||||||
|
backgroundImageId = "tx_fabric.tiled"; // tx_fabric.jpg tiled
|
||||||
}
|
}
|
||||||
/// returns true is widget is being animated - need to call animate() and redraw
|
/// returns true is widget is being animated - need to call animate() and redraw
|
||||||
@property override bool animating() { return true; }
|
@property override bool animating() { return true; }
|
||||||
|
|
|
@ -289,7 +289,17 @@ class ImageDrawable : Drawable {
|
||||||
}
|
}
|
||||||
} else if (_tiled) {
|
} else if (_tiled) {
|
||||||
// tiled
|
// tiled
|
||||||
} else {
|
int imgdx = _image.width;
|
||||||
|
int imgdy = _image.height;
|
||||||
|
tilex0 %= imgdx;
|
||||||
|
if (tilex0 < 0)
|
||||||
|
tilex0 += imgdx;
|
||||||
|
tiley0 %= imgdy;
|
||||||
|
if (tiley0 < 0)
|
||||||
|
tiley0 += imgdy;
|
||||||
|
|
||||||
|
buf.drawRescaled(rc, _image.get, Rect(0, 0, _image.width, _image.height));
|
||||||
|
} else {
|
||||||
// rescaled or normal
|
// rescaled or normal
|
||||||
if (rc.width != _image.width || rc.height != _image.height)
|
if (rc.width != _image.width || rc.height != _image.height)
|
||||||
buf.drawRescaled(rc, _image.get, Rect(0, 0, _image.width, _image.height));
|
buf.drawRescaled(rc, _image.get, Rect(0, 0, _image.width, _image.height));
|
||||||
|
|
|
@ -330,6 +330,23 @@ class Widget {
|
||||||
invalidate();
|
invalidate();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// background image id
|
||||||
|
@property string backgroundImageId() const {
|
||||||
|
return style.backgroundImageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// background image id
|
||||||
|
@property Widget backgroundImageId(string imageId) {
|
||||||
|
ownStyle.backgroundImageId = imageId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// background drawable
|
||||||
|
@property DrawableRef backgroundDrawable() const {
|
||||||
|
return style.backgroundDrawable;
|
||||||
|
}
|
||||||
|
|
||||||
/// widget drawing alpha value (0=opaque .. 255=transparent)
|
/// widget drawing alpha value (0=opaque .. 255=transparent)
|
||||||
@property uint alpha() const { return stateStyle.alpha; }
|
@property uint alpha() const { return stateStyle.alpha; }
|
||||||
/// set widget drawing alpha value (0=opaque .. 255=transparent)
|
/// set widget drawing alpha value (0=opaque .. 255=transparent)
|
||||||
|
|
Loading…
Reference in New Issue