Beispiel #1
0
void VTimeBar::draw_time()
{
	draw_range();
}
Beispiel #2
0
int create_png_range(const freq_range_t rx_range_list[],
                     const freq_range_t tx_range_list[],
                     int num)
{
    FILE *out;

    /* Input and output images */
    gdImagePtr im_rng;
    char rng_fname[128];

    /* Color indexes */
#if 0
    int white;
#endif
    int black;
    int rx_rgb, tx_rgb;

    /* Create output image, x by y pixels. */
    im_rng  = gdImageCreate(RANGE_WIDTH + IM_LGD, UHF_H + RANGE_HEIGHT);

    /* First color allocated is background. */
//    white = gdImageColorAllocate(im_rng, 255, 255, 255);
    gdImageColorAllocate(im_rng, 255, 255, 255);
    black = gdImageColorAllocate(im_rng, 0, 0, 0);

#if 0
    /* Set transparent color. */
    gdImageColorTransparent(im_rng, white);
#endif

    /* Try to load demoin.png and paste part of it into the
        output image. */

    tx_rgb = gdImageColorAllocate(im_rng, TX_R, TX_G, TX_B);
    rx_rgb = gdImageColorAllocate(im_rng, RX_R, RX_G, RX_B);

    draw_range(rx_range_list, im_rng, 0, RANGE_MIDHEIGHT - 1, rx_rgb);
    draw_range(tx_range_list, im_rng, RANGE_MIDHEIGHT, RANGE_HEIGHT - 1, tx_rgb);

    gdImageRectangle(im_rng,
                     IM_LGD,
                     HF_H,
                     IM_LGD + RANGE_WIDTH - 1,
                     HF_H + RANGE_HEIGHT - 1,
                     black);

    gdImageRectangle(im_rng,
                     IM_LGD,
                     VHF_H,
                     IM_LGD + RANGE_WIDTH - 1,
                     VHF_H + RANGE_HEIGHT - 1,
                     black);

    gdImageRectangle(im_rng,
                     IM_LGD,
                     UHF_H,
                     IM_LGD + RANGE_WIDTH - 1,
                     UHF_H + RANGE_HEIGHT - 1,
                     black);

    /* gdImageStringUp */
    gdImageString(im_rng,
                  gdFontSmall,
                  1,
                  HF_H + 1,
                  (unsigned char *) "HF",
                  black);

    gdImageString(im_rng,
                  gdFontSmall,
                  1,
                  VHF_H + 1,
                  (unsigned char *) "VHF",
                  black);

    gdImageString(im_rng,
                  gdFontSmall,
                  1,
                  UHF_H + 1,
                  (unsigned char *) "UHF",
                  black);

    /* Make output image interlaced (allows "fade in" in some viewers,
        and in the latest web browsers) */
    gdImageInterlace(im_rng, 1);

    sprintf(rng_fname, "range%d.png", num);
    out = fopen(rng_fname, "wb");

    /* Write PNG */
    gdImagePng(im_rng, out);
    fclose(out);
    gdImageDestroy(im_rng);

    return 0;
}