秀丸マクロの colormarker を使ってグラデーション

秀丸マクロの colormarker を使ってグラデーション

秀丸マクロに colormarker というのがあったのでちょっと遊んでみました。カーソルの行をグラデーションにします。

disabledraw;
movetolineno 1, lineno;
while( column < linelen2 ) {
    beginsel;
    right;
    call colorBlend 0xff0000, 0x0000ff, 255 - 255 * column / linelen2;
    colormarker 0xffffff, ##return, 1, 1;
}
escape;
if ( code == eof ) {
    insert "\n";
}
enabledraw;
endmacro;

colorBlend:
    ##1 = ##1 & 0x00ffffff;
    ##2 = ##2 & 0x00ffffff;
    if ( ##3 < 0 )   {
        ##3 = 0;
    }
    if ( ##3 > 255 ) {
        ##3 = 255;
    }

    ##red1   = ##1         & 255;
    ##green1 = ##1 /   256 & 255;
    ##blue1  = ##1 / 65536 & 255;
    ##blend1 = ##3;

    ##red2   = ##2         & 255;
    ##green2 = ##2 /   256 & 255;
    ##blue2  = ##2 / 65536 & 255;
    ##blend2 = 255 - ##3;

    ##red3   = ( ##red1   * ##blend1 + ##red2   * ##blend2 ) / 255;
    ##green3 = ( ##green1 * ##blend1 + ##green2 * ##blend2 ) / 255;
    ##blue3  = ( ##blue1  * ##blend1 + ##blue2  * ##blend2 ) / 255;
    
    return ##red3 + ##green3 * 256 + ##blue3 * 65536;

インフォメーション

公開日時
2007年11月21日 午後8時56分52秒
最終更新日時
2007年12月20日 午後5時30分51秒
カテゴリ
秀丸エディタ