working on patterns
This commit is contained in:
parent
806c9b0071
commit
ba7ba3d666
@ -9,8 +9,7 @@
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_000(Image_Desc *img, int foo)
|
||||
int Image_pattern_000(Image_Desc *img, int foo)
|
||||
{
|
||||
int x, y, xx, yy, r, g, b;
|
||||
|
||||
@ -18,11 +17,9 @@ int x, y, xx, yy, r, g, b;
|
||||
fprintf(stderr, "%s : foo = %d\n", __func__, foo);
|
||||
#endif
|
||||
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
xx = (x * 256) / img->width;
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (y=0; y<img->height; y++) {
|
||||
yy = (y * 256) / img->height;
|
||||
r = xx & yy & foo;
|
||||
g = ((xx * yy) & 0xf8 );
|
||||
@ -37,8 +34,7 @@ for (x=0; x<img->width; x++)
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_001(Image_Desc *img, int foo)
|
||||
int Image_pattern_001(Image_Desc *img, int foo)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
@ -50,11 +46,10 @@ for (x=0; x<img->width; x++)
|
||||
for (y=0; y<img->height; y++)
|
||||
Image_plotRGB(img, x, y, x^y^foo, (x*y)>>4, x&y);
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_002(Image_Desc *img, int foo)
|
||||
int Image_pattern_002(Image_Desc *img, int foo)
|
||||
{
|
||||
int x, y, x2, y2;
|
||||
|
||||
@ -62,11 +57,9 @@ int x, y, x2, y2;
|
||||
fprintf(stderr, "Pattern 002: %d\n", foo);
|
||||
#endif
|
||||
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
x2 = (x * 256) / img->width;
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (y=0; y<img->height; y++) {
|
||||
y2 = (y * 256) / img->height;
|
||||
Image_plotRGB(img, x, y, (x2/2)&(y2/2)&foo, (x2*y2)>>3, x2^y2);
|
||||
}
|
||||
@ -75,8 +68,7 @@ for (x=0; x<img->width; x++)
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_003(Image_Desc *img, int foo)
|
||||
int Image_pattern_003(Image_Desc *img, int foo)
|
||||
{
|
||||
int x, x2, y, y2;
|
||||
|
||||
@ -85,11 +77,9 @@ fprintf(stderr, "Pattern 003: foo is %d\n", foo);
|
||||
#endif
|
||||
|
||||
/* added some ugly code the 28 february 2008 */
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
x2 = (x * 256) / img->width;
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (y=0; y<img->height; y++) {
|
||||
y2 = (y * 256) / img->height;
|
||||
Image_plotRGB(img, x, y, (x2/4)&(y2/4)&foo, (x2*y2)>>5, x2^y2);
|
||||
}
|
||||
@ -98,8 +88,7 @@ for (x=0; x<img->width; x++)
|
||||
return FUNC_NOT_FINISH;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_004(Image_Desc *img, int a, int b, int c, int d)
|
||||
int Image_pattern_004(Image_Desc *img, int a, int b, int c, int d)
|
||||
{
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Pattern 004: %d, %d, %d, %d\n", a, b, c, d);
|
||||
@ -122,11 +111,9 @@ if (NULL == map) {
|
||||
return NULL_POINTER;
|
||||
}
|
||||
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (y=0; y<img->height; y++) {
|
||||
fy = (double)y;
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
fx = (double)x;
|
||||
|
||||
idx = (int)(127.0+(sin(fx)*cos(fy)*254.99));
|
||||
@ -140,8 +127,7 @@ for (y=0; y<img->height; y++)
|
||||
return FUNC_NOT_FINISH;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_042(Image_Desc *img, int foo)
|
||||
int Image_pattern_042(Image_Desc *img, int foo)
|
||||
{
|
||||
int x, y, r, g, b;
|
||||
|
||||
@ -150,10 +136,8 @@ fprintf(stderr, "Pattern 042: threshold level is %d\n", foo);
|
||||
#endif
|
||||
|
||||
r = g = b = 42;
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
for (y=0; y<img->height; y++) {
|
||||
r += rand() % 4;
|
||||
if (r > foo) r = 0;
|
||||
|
||||
|
@ -16,15 +16,15 @@
|
||||
/*
|
||||
* c'est quasiment impossible de documenter cette fonction.
|
||||
*/
|
||||
int
|
||||
Image_pattern_100(Image_Desc *dst, int kr, int kg, int kb)
|
||||
int Image_pattern_100(Image_Desc *dst, int kr, int kg, int kb)
|
||||
{
|
||||
int x, y, r,g, b;
|
||||
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
fprintf(stderr, ">>> %s ( %p %d %d %d )\n", __func__,
|
||||
dst, kr, kg, kb);
|
||||
|
||||
for (x=0; x<dst->width; x++) {
|
||||
for (y=0; y<dst->height; y++) {
|
||||
r = abs(x+y-(dst->width/3)) * kr;
|
||||
g = abs(x-y-(dst->height/3)) * kg;
|
||||
b = (rand() % 42) + kb;
|
||||
@ -36,19 +36,19 @@ for (x=0; x<dst->width; x++)
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_101(Image_Desc *dst, int kr, int kg, int kb)
|
||||
int Image_pattern_101(Image_Desc *dst, int kr, int kg, int kb)
|
||||
{
|
||||
int x, y, r,g, b;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %d %d %d )\n", __func__,
|
||||
dst, kr, kg, kb);
|
||||
|
||||
if (kr == 0) kr = 1;
|
||||
if (kg == 0) kg = 1;
|
||||
if (kb == 0) kb = 1;
|
||||
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++) {
|
||||
for (y=0; y<dst->height; y++) {
|
||||
if (x < dst->width/2)
|
||||
{ r=x/kr; g=y/kg; b=x/kb; }
|
||||
else
|
||||
@ -59,18 +59,15 @@ for (x=0; x<dst->width; x++)
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_pattern_102(Image_Desc *dst, int param, int kr, int kg, int kb)
|
||||
int Image_pattern_102(Image_Desc *dst, int param, int kr, int kg, int kb)
|
||||
{
|
||||
int x, y, r,g, b;
|
||||
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++) {
|
||||
for (y=0; y<dst->height; y++) {
|
||||
r = x ^ kr;
|
||||
g = y ^ kg;
|
||||
b = (x+y) ^ kb;
|
||||
b = (x+y+param) ^ kb;
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
}
|
||||
}
|
||||
@ -80,26 +77,20 @@ return FUNC_NOT_FINISH;
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* hop, 31 mars 2008, une petite evolution stochastique de base...
|
||||
* */
|
||||
int
|
||||
Image_pattern_103(Image_Desc *dst, int param, int kr, int kg, int kb)
|
||||
int Image_pattern_103(Image_Desc *dst, int param, int kr, int kg, int kb)
|
||||
{
|
||||
int x, y, r, g, b;
|
||||
long surface;
|
||||
double dx, dy;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s: acting on image %p\n", __func__, dst);
|
||||
#endif
|
||||
|
||||
surface = dst->width * dst->height;
|
||||
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++) {
|
||||
dx = (double)x / (double)dst->width;
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (y=0; y<dst->height; y++) {
|
||||
dy = (double)x / (double)dst->height;
|
||||
r = (int)round(256.0 * sqrt(dx * dy)); /* XXX */
|
||||
r = (int)(256.0 * sqrt(dx * dy)); /* XXX */
|
||||
g = b = rand() & 0xf0;
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user