|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
|||||||||||||||||||||||||||||||||||||||||||||||
2024年02月19日(月) 旧暦 [n年日記] [更新:"2025/05/20 10:20:43"]#1 [DWL66+][bitmap] another (large, 0.55 x 1.0 m/m) version for contrast curve![]() For save link as conversion dialog
#!/usr/pkg/bin/perl
use strict;
my($VERSION);
$VERSION = "2024-02-17 23:28" ; # written by emacs time-stamp
## $VERSION .= ' UTC';
$VERSION =~ s/ /-/g;
$VERSION =~ s/:/./g;
sub box {
my ($arg_ptr) = @_;
my $width = $arg_ptr -> { -width};
my $length = $arg_ptr -> { -length};
my $value = $arg_ptr -> { -value};
my $gap = $arg_ptr -> { -gap};
foreach my $i (0..$length - 1) {
foreach my $j (0..$width - 1) { print PGM $value . ' ' ; }
foreach my $g (0..$gap-1 ) { print PGM '00 ' ; }
foreach my $j (0..$width - 1) { print PGM $value . ' ' ; }
print PGM "\n";
}
}
sub main() {
my $max = 127; # bmp light value
my $width = 250;
my $length_posi = 100;
my $length_nega = 100;
my $slant_length = 600;
my $gap = 50;
my $totalW = $width * 2 + $gap;
my $ref_length = $length_posi + $length_nega;
my $totalH = $ref_length * 2 + $slant_length;
my $base_name = 'cross_x2';
$base_name = sprintf("cross_x2-%d-%d", $totalW, $totalH);
$base_name .= '-'. $VERSION;
my $pgm_name .= $base_name . '.pgm';
my $bmp_name .= $base_name . '.bmp';
open(PGM, "> $pgm_name") || die "problem opening file to write: $!\n";
print $bmp_name,"\n"; # See below after __END__ line
print PGM "P2\n";
printf( PGM " # %2d x %d bitmap PGM format\n", $totalW, $totalH);
print PGM $totalW, ' ' . $totalH . "\n";
print PGM $max . "\n";
box ({ -length => $length_posi, -width => $width, -value => $max, -gap=> $gap});
box ({ -length => $length_nega, -width => $width, -value => 0 , -gap=> $gap});
foreach my $value (0..$slant_length - 1) {
my $light_value = int ($value/$slant_length * 128);
## foreach my $repeat (0,1) {
foreach my $j (0..$width - 1) { print PGM $light_value . ' ' ; }
foreach my $g (0..$gap - 1) { print PGM '00 ' ; }
foreach my $j (0..$width - 1) { print PGM $max - $light_value . ' ' ; }
## }
print PGM "\n";
}
box ({ -length => $length_nega, -width => $width, -value => 0 , -gap=> $gap});
box ({ -length => $length_posi, -width => $width, -value => $max, -gap=> $gap});
system ("convert $pgm_name $bmp_name") && die "conversion problem: $!\n";
}
main();
__END__
feh `perl 225x456`
; please note I have copy in ~/.emacs-sub/time-stamp-setup.el
(require 'time-stamp)
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
;; (setq time-stamp-time-zone "UTC")
(setq time-stamp-time-zone nil)
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M");
(setq time-stamp-start "$VERSION = \"") ;
(setq time-stamp-end "\"") ;
(setq time-stamp-line-limit 20) ; ; default is 8
( Post message... )
|
最近の日記 2024年11月14日 ・DWL66+ 2018 405 nm 2024年02月19日 ・another (large, 0.55 x 1.0 m/m) version for contrast curve 2024年02月15日 ・curved star cone 2024年02月13日 ・paraboloid with base plane 2024年02月09日 ・bit map format for contrast curve | ||