Exemplo n.º 1
0
int main(int argc, char **argv){
    if (argc != 4){
        (void) fprintf(stdout,"Usage: %s palette input-file output-file\n",argv[0]);
        exit(0);
    }
    read_palette(argv[1]);
    print_palette();
    
    char *description;
    ExceptionType severity;


    #define ThrowWandException(wand) \
    { \
        description=MagickGetException(wand,&severity); \
        (void) fprintf(stderr,"%s %s %lu %s\n",GetMagickModule(),description); \
        description=(char *) MagickRelinquishMemory(description); \
        exit(-1); \
    }

    MagickBooleanType status;
    MagickPixelPacket pixel;
    MagickWand *wand;
    WandView *view;
    /*
       Read an image.
       */
    MagickWandGenesis();
    wand = NewMagickWand();
    status = MagickReadImage(wand, argv[2]);
    if (status == MagickFalse) ThrowWandException(wand);

    /*
       Sigmoidal non-linearity contrast control.
       */
    view = NewWandView(wand);
    if (view == (WandView *) NULL) ThrowWandException(wand);
    status = UpdateWandViewIterator(view, recolor, (void *)NULL);
    if (status == MagickFalse) ThrowWandException(wand);
    view = DestroyWandView(view);

    /*
       Write the image then destroy it.
       */
    status = MagickWriteImages(wand, argv[3], MagickTrue);
    if (status == MagickFalse) ThrowWandException(wand);
    wand = DestroyMagickWand(wand);
    MagickWandTerminus();

    return 0;
}
Exemplo n.º 2
0
void get_cam_pic(struct camera *cam)
{
    if(ioctl(cam->fd, VIDIOCGPICT, &cam->video_pic) == -1)
    {
        fprintf(stderr, "VIDIOCGPICT  --  could not get picture info, exiting....\n");
        exit(0);
    }
#ifdef DEBUG_CAM
    printf("\nVIDIOCGPICT:\n");
    printf("bright = %d\n", cam->video_pic.brightness);
    printf("hue = %d\n", cam->video_pic.hue);
    printf("colour = %d\n", cam->video_pic.colour);
    printf("contrast = %d\n", cam->video_pic.contrast);
    printf("whiteness = %d\n", cam->video_pic.whiteness);
    printf("colour depth = %d\n", cam->video_pic.depth);
    print_palette(cam->video_pic.palette);
#endif
}
Exemplo n.º 3
0
int main()
{


    unsigned int row = 0;
    unsigned int col = 0;
    unsigned int delay = 0;

    unsigned int color;
    int i;



    // Clear the screen first.
    alt_putstr("Clear the screen\n");
    for (col = 0; col < FRAME_WIDTH; col = col + 4) {
        for (row = 0; row < FRAME_HEIGHT; ++row) {
            color = 0;
            IOWR_32DIRECT(SRAM_0_BASE, row * FRAME_WIDTH + col, color << 24 | color << 16 | color << 8 | color << 0);
        }
    }

    // Print first 16 elements of current palette
    print_palette(16);
    // Switch to EGA colour palette
    switch_palette(&palette_ega);
    print_palette(16);

    alt_putstr("Screen painting demo\n");

    // Cycle through the colours of the EGA colour palette
    for (i = 0; i < 16; i++) {
        for (delay = 0; delay < 700/*2000*/; delay++) {
            unsigned int tdelay = delay;
            for (tdelay; tdelay > 0; tdelay--) {}
        }

        for (row=0; row<480; row++) {
            for (col = 0; col < 640; col=col+4) {
                color = i;
                IOWR_32DIRECT(SRAM_0_BASE, row * 640 + col, color << 24 | color << 16 | color << 8 | color << 0);
            }

        }
    }



    alt_putstr("\nStarting Stephen Test Pattern\n");
    int p;
    for (p = 0; p < palette_count; p++)
    {
        switch_palette(palettes[p]);

        alt_putstr("Clear the screen\n");
        for (col = 0; col < FRAME_WIDTH; col = col + 4) {
            for (row = 0; row < FRAME_HEIGHT; row++) {
                color = 0;
                IOWR_32DIRECT(SRAM_0_BASE, row * FRAME_WIDTH + col, color << 24 | color << 16 | color << 8 | color << 0);
            }
        }


        //Now draw the test pattern
        for (row = 0; row < 480; row++)
        {
            for (col = 0; col < 640; col = col + 4)
            {
                color = ((row + col) % 256) << 0 | ((row + col) % 256) << 8 | ((row + col) % 256) << 16 | ((row + col) % 256) << 24;
                if (row == 0 || row == 479)
                {
                    IOWR_32DIRECT(SRAM_0_BASE, row * 640 + col, 0xFFFFFFFF);
                }
                else if (col == 0)
                {
                    IOWR_32DIRECT(SRAM_0_BASE, row * 640 + col, 0x000000FF | color);
                }
                else if (col == 636)
                {
                    IOWR_32DIRECT(SRAM_0_BASE, row * 640 + col, 0xFF000000 | color);
                }
                else
                {
                    IOWR_32DIRECT(SRAM_0_BASE, row * 640 + col, color);
                }
            }
        }
    }





    alt_putstr("Done.\n");


    return 0;
}