From 6f029b6dc6dc8acc2b2252fbc9d3ffc8d1050c5b Mon Sep 17 00:00:00 2001 From: borisneubert <> Date: Wed, 16 Apr 2014 19:13:35 +0000 Subject: [PATCH] feature: new layout command rect and new attribute bgcolor for RSS git-svn-id: https://svn.fhem.de/fhem/trunk@5536 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/02_RSS.pm | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index e06d83b20..b31343a60 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. - SVN + - feature: new layout command rect and new attribute bgcolor for RSS - added: new module 55_weco.pm (betateilchen) - added: new module 70_Jabber.pm (BioS) - bugfix: Dashboard: use "loadScript" for load JavaScripts diff --git a/fhem/FHEM/02_RSS.pm b/fhem/FHEM/02_RSS.pm index b5b7ef481..2ec2ec230 100644 --- a/fhem/FHEM/02_RSS.pm +++ b/fhem/FHEM/02_RSS.pm @@ -46,7 +46,7 @@ RSS_Initialize($) { my ($hash) = @_; $hash->{DefFn} = "RSS_Define"; #$hash->{AttrFn} = "RSS_Attr"; - $hash->{AttrList}= "size bg tmin"; + $hash->{AttrList}= "size bg bgcolor tmin"; $hash->{SetFn} = "RSS_Set"; RSS_addExtension("RSS_CGI","rss","RSS"); @@ -384,6 +384,16 @@ RSS_itemLine { $S->line($x1,$y1,$x2,$y2,RSS_color($S,$params{rgb})); } +sub +RSS_itemRect { + my ($S,$x1,$y1,$x2,$y2,$filled,%params)= @_; + if($filled) { + $S->filledRectangle($x1,$y1,$x2,$y2,RSS_color($S,$params{rgb})); + } else { + $S->rectangle($x1,$y1,$x2,$y2,RSS_color($S,$params{rgb})); + } +} + ################## sub RSS_evalLayout($$@) { @@ -495,6 +505,12 @@ RSS_evalLayout($$@) { ($x2,$y2)= RSS_xy($S, $x2,$y2,%params); $format //= 1; # set format to 1 as default thickness for the line RSS_itemLine($S,$x1,$y1,$x2,$y2, $format,%params); + } elsif($cmd eq "rect") { + ($x1,$y1,$x2,$y2,$format)= split("[ \t]+", $def, 5); + ($x1,$y1)= RSS_xy($S, $x1,$y1,%params); + ($x2,$y2)= RSS_xy($S, $x2,$y2,%params); + $format //= 0; # set format to 0 as default (not filled) + RSS_itemRect($S,$x1,$y1,$x2,$y2, $format,%params); } elsif($cmd eq "time") { ($x,$y)= split("[ \t]+", $def, 2); ($x,$y)= RSS_xy($S, $x,$y,%params); @@ -554,8 +570,10 @@ RSS_returnJPEG($) { my $S; # let's create a blank image, we will need it in most cases. $S= GD::Image->newTrueColor($width,$height); - $S->colorAllocate(0,0,0); # black is the background - + my $bgcolor = AttrVal($name,'bgcolor','000000'); #default bg color = black + $bgcolor = RSS_color($S, $bgcolor); + # $S->colorAllocate(0,0,0); # other colors seem not to work (issue with GD) + $S->fill(0,0,$bgcolor); # wrap to make problems with GD non-lethal eval { @@ -715,6 +733,9 @@ RSS_CGI(){
<width>x<height>
.FF0000
for red, C0C0C0
for light gray).tmin
seconds,
no matter how frequently the RSS feed consumer accesses the page.gif
, jpeg
, png
.
The picture is scaled by the factor <s> (a decimal value). If 'w' or 'h' is in front of scale-value the value is used to set width or height to the value in pixel. If <srctype> is file
, the picture