Image:Antialiased.png

From Wikipedia, the free encyclopedia

No higher resolution available.

Antialiased.png (128 × 128 pixel, file size: 11 KB, MIME type: image/png)

antialiased chessboard

GFDL

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
Subject to disclaimers.


generated by this code, which I (Loisel 03:57 Jan 24, 2003 (UTC)) wrote myself

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <assert.h>
int color(double x, double y)
{
  double t,z;
  int i,j,k;

  x=x/128.0-0.5;
  y=y/1024.0;

  t=1.0/(y+0.01);
  z=t*x;
  i=floor(t);
  j=floor(z);
  k=i+j;
  //  printf("%f %f -> %i %i %i\n",t,z,i,j,k%2);
  return ((k%2)!=0);
}

double myrand()
{
  return rand()/((double)RAND_MAX);
}

int main()
{
  int i,j,k,l;
  double x,y;
  printf("P5\n128 128\n255\n");
  srand(time(0));
  for(i=0;i<128;i++)
    for(j=0;j<128;j++)
      {
         k=0;
         for(l=0;l<255;l++)
           {
             x=j+myrand();
             y=i+myrand();
             k+=color(x,y);
           }
         assert(k>=0 && k<=255);
         k=(k/4)*4; // cygwin bug?
         fwrite(&k,1,1,stdout);
      }
}

File history

Legend: (cur) = this is the current file, (del) = delete this old version, (rev) = revert to this old version.
Click on date to download the file or see the image uploaded on that date.


The following pages on the English Wikipedia link to this file (pages on other projects are not listed):