<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Générateur d'art pas tout à fait aléatoire.Notez l'utilisation par la fonction de peinture de l'indexation matricielle pour éviter une boucle JSL explicite pour définir une ligne verticale de pixels, plus ou moins perpendiculaire à la trajectoire du pinceau.M sélectionne les pixels et blend1 & blend2 rendent le centre du large coup de pinceau opaque et les bords plus transparents.(Hors tournage d'un autre projet, inspiré en partie par Génération d'images dynamiques avec Python - SWHarden.com .)
Usine Art - YouTube

Fenêtre( "x" ) << fermer la fenêtre ;
échelle = 4 ;
sourcils = 1080 * échelle ;
bcols = 1920 * échelle ;
rouge = J( sourcils, bcols, 0 );
vert = J( sourcils, bcols, 0 );
bleu = J( sourcils, bcols, 0 );
numéro d'image = 0 ;
paint = Function( {row, col, color, drow},
{m = Max( 1, Min( brows, row - drow ) ) :: Min( brows, Max( 1, row + drow ) ), r, g, b, blend1 = ((1 :: Max( 1, Floor ( N Cols( m ) / 2 ) ))
|| Si( N Cols( m ) > 1,
(Plafond( N Cols( m ) / 2 ) :: 1),
[]
))` / Plafond( N Cols( m ) / 2 ), blend2 = 1 - blend1},
{r, g, b} = Couleur Vers RVB( couleur );
Essayer(
rouge[m, col] = (rouge[m, col]
mélange2 + r * mélange1);
vert[m, col] = (vert[m, col]
mélange2 + g * mélange1);
bleu[m, col] = (bleu[m, col]
mélange2 + b * mélange1);
,
Show( exception_msg, row, col, r, blend1, blend2, drow, m );
Arrêt();
);
);
bande = Fonction( {amp1, reps1, phase1, reps2, phase2, row, h1, h2, mindr, maxdr},
{ic, ir, fract, dr, couleur},
reps1 *= 2 * Pi();
reps2 *= 2 * Pi();
phase1 *= 2 * Pi();
phase2 *= 2 * Pi();
amp1 *= échelle ;
mindr *= échelle ;
maxdr *= échelle ;
Pour( ic = 1, ic <= bcols, ic++,
fract = ic / bcols ;
ir = ligne + amp1 * Sin( phase1 + reps1 * fract );
dr = Interpoler( Sin( phase2 + reps2 * fract ), -1, mindr, 1, maxdr );
color = HLS Color( Interpoler( fract, 0, h1, 1, h2 ), .5, 1 );
peinture( ir, ic, couleur, dr );
Si( Mod( ic, 512 ) == 0,
Attendez( .01 );
img = Nouvelle Image( "rgb", {rouge, vert, bleu} );
img << échelle( .5 );
img << saveimage( "\VBOXSVR\windowsShare\painter\pics\p" || Right( Char( imageno++ ), 6, "0" ) || ".jpg", "jpg" );
);
);
);
image = Fonction( {nstripes},
{istripe, fract, hue1, hue2},
Pour( istripe = 1, istripe <= nstripes, istripe++,
Afficher( istripe );
fract = istripe / nstripes ;
nfract = 1 - fract ;
thisrow = Random Integer( brows / 200, brows - brows / 200 );
rfract = thisrow / brows ;
teinte1 = Uniforme aléatoire (.8 * rfract + .3, .8 * rfract + .3 );
If( hue1 > 1, hue1 -= 1 );// alow h1 wrap around
teinte2 = teinte1 + Aléatoire Uniforme( 0, .2 );
If( hue2 > 1, hue2 = 1 );// empêche le bouclage pour h2
Bande(
Interpoler( fract, 0, 50, 1, 10 ), // amp1
Uniforme aléatoire (.1, .4), // rep1
Uniforme aléatoire (0, 1), //phase
Uniforme aléatoire (0, .2), // rep2
Uniforme aléatoire (0, 1), // phase2
thisrow, // ligne cible
teinte1,
teinte2,
5, // min delta
Entier aléatoire (5 + 25 * nfract, 50 + 150 * nfract ) // max delta
);
)
);
image( 100 );
Attendez( 0 );
img = Nouvelle Image( "rgb", {rouge, vert, bleu} );
img << échelle( .5 );
img << saveimage( "\VBOXSVR\windowsShare\painter\pics\p" || Right( Char( imageno++ ), 6, "0" ) || ".jpg", "jpg" );
Nouvelle fenêtre( "x", img );