If "comm:" the command is run with 'str2' passed as arg 'str1', and
result should be returned as 'bytes' (comm2 called with ->str1 as
array of bytes, ->num1 as length).
-- num is 1 if image should be stretched to fill pane
-- num2 (if num == 0) is 'or' of
+- num is the 'or' of the following bit flags:
+ - 16 stretch image to exactly fit pane. If set, lower bits are ignored.
+ Otherwise image will fill the pane in one dimension, and be positioning
+ left/centre/right in the other.
- 1 centre horizontally
- 2 right-align horizontally
- 4 centre vertically
- - 8 bottom-align vertialls
- Image will fill the pane in one dimension, and be positioning
- left/centre/right in the other.
+ - 8 bottom-align vertially
## all-displays
/* 'str' identifies the image. Options are:
* file:filename - load file from fs
* comm:command - run command collecting bytes
- * 'num' is '1' if image should be stretched to fill pane
- * if 'num is '0', then 'num2' is 'or' of
+ * 'num' is '16' if image should be stretched to fill pane
+ * Otherwise it is the 'or' of
* 0,1,2 for left/middle/right in x direction
* 0,4,8 for top/middle/bottom in y direction
- * only one of these can be used as image will fill pane in other direction.
+ * only one of these can be used as image will fill pane
+ * in other direction.
*/
struct xcb_data *xd = ci->home->data;
- bool stretch = ci->num == 1;
- int pos = ci->num2;
+ bool stretch = ci->num & 16;
+ int pos = ci->num;
int w = ci->focus->w, h = ci->focus->h;
int x = 0, y = 0;
int xo, yo;
}
pane_resize(p, (p->parent->w - width)/2, p->y, width, height);
if (fname && dodraw)
- home_call(focus, "Draw:image", p, 0, NULL, fname, 5);
+ home_call(focus, "Draw:image", p, 5, NULL, fname);
free(fname);
}
# 'str' identifies the image. Options are:
# file:filename - load file from fs
# comm:command - run command collecting bytes
- # 'num' is '1' if image should be stretched to fill pane
- # if 'num is '0', then 'num2' is 'or' of
+ # 'num' is '16' if image should be stretched to fill pane
+ # otherwise it is 'or' of
# 0,1,2 for left/middle/right in x direction
# 0,4,8 for top/middle/bottom in y direction
- # only one of these can be used as image will fill pane in other direction.
+ # only one of these can be used as image will fill pane
+ # in other direction.
if not str:
return edlib.Enoarg
- stretch = num
- pos = num2
+ stretch = num & 16
+ pos = num
w, h = focus.w, focus.h
x, y = 0, 0
try:
if c[:6] == 'color:':
rv = focus.call('Draw:clear', 'bg:' + c[6:])
if c[:14] == "image-stretch:":
- rv = focus.call('Draw:image', 1, "file:" + self.pathto(c[14:]))
+ rv = focus.call('Draw:image', 16, "file:" + self.pathto(c[14:]))
if c[:6] == "image:":
- rv = focus.call('Draw:image', 0, 4+1, "file:" + self.pathto(c[6:])) # centre
+ rv = focus.call('Draw:image', 4+1, "file:" + self.pathto(c[6:])) # centre
if c[:8] == "overlay:":
- rv = focus.call('Draw:image', 0, 0+2, "file:" + self.pathto(c[8:])) # top right
+ rv = focus.call('Draw:image', 0+2, "file:" + self.pathto(c[8:])) # top right
if c == "page-local":
page = self.find_pages(mark)
self.clean_lines(page)
free(a);
} else if (strncmp(s, "image:", 6) == 0) {
home_call(focus, "Draw:clear", p);
- home_call(focus, "Draw:image", p, 1, NULL, s+6);
+ home_call(focus, "Draw:image", p, 16, NULL, s+6);
rl->background_uniform = False;
} else
home_call(focus, "Draw:clear", p, 0, NULL, "");