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;
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
backgroundImageId = "tx_fabric.tiled"; // tx_fabric.jpg tiled
|
||||
}
|
||||
/// returns true is widget is being animated - need to call animate() and redraw
|
||||
@property override bool animating() { return true; }
|
||||
|
|
|
@ -289,7 +289,17 @@ class ImageDrawable : Drawable {
|
|||
}
|
||||
} else if (_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
|
||||
if (rc.width != _image.width || rc.height != _image.height)
|
||||
buf.drawRescaled(rc, _image.get, Rect(0, 0, _image.width, _image.height));
|
||||
|
|
|
@ -330,6 +330,23 @@ class Widget {
|
|||
invalidate();
|
||||
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)
|
||||
@property uint alpha() const { return stateStyle.alpha; }
|
||||
/// set widget drawing alpha value (0=opaque .. 255=transparent)
|
||||
|
|
Loading…
Reference in New Issue