Ejemplo n.º 1
0
void EasyRPG::register_text(mrb_state* M) {
	static method_info const methods[] = {
		{ "draw", &draw, MRB_ARGS_REQ(4) | MRB_ARGS_OPT(2) },
		method_info_end };
	RClass* const mod = define_module(M, "Text", methods);
	mrb_define_const(M, mod, "AlignLeft", mrb_fixnum_value(Text::AlignLeft));
	mrb_define_const(M, mod, "AlignCenter", mrb_fixnum_value(Text::AlignCenter));
	mrb_define_const(M, mod, "AlignRight", mrb_fixnum_value(Text::AlignRight));
}
Ejemplo n.º 2
0
EXPORT void
define_model(void) {
	int   intype[MAX_ARGS], outtype[MAX_ARGS];

	/* Define static property of modules. i.e number and type of args */
	intype[0]  = EFI_NONE;
	outtype[0] = EFI_WAVEFORM_PRESSURE;
	define_module("Reader", 0, intype, 1, outtype);

/***************************************************************
	intype[0]  = EFI_WAVEFORM_PRESSURE;
	outtype[0] = EFI_WAVEFORM_PRESSURE;
	define_module("UpSample", 1, intype, 1, outtype);

	intype[0]  = EFI_WAVEFORM_PRESSURE;
	outtype[0] = EFI_WAVEFORM_PRESSURE;
	define_module("MidEar", 1, intype, 1, outtype);

	intype[0]  = EFI_WAVEFORM_PRESSURE;
	outtype[0] = EFI_WAVEFORM_DISPLACEMENT;
	define_module("Gamma", 1, intype, 1, outtype);

	intype[0]  = EFI_WAVEFORM_DISPLACEMENT;
	outtype[0] = EFI_WAVEFORM_VOLTAGE;
	define_module("Haircell", 1, intype, 1, outtype);

	intype[0]  = EFI_WAVEFORM_VOLTAGE;
	outtype[0] = EFI_WAVEFORM_VOLTAGE;
	define_module("TTS", 1, intype, 1, outtype);

***************************************************************/

	intype[0]  = EFI_WAVEFORM_VOLTAGE;
	outtype[0] = EFI_NONE;
	define_module("Writer", 1, intype, 0, outtype);
}
Ejemplo n.º 3
0
int main(int argc, char *argv[])
{
    struct Options opts;
    struct ScaleRange iscale;	/* input file's data is scaled to this interval */
    struct ScaleRange oscale;	/* output file's scale */
    int iimg_fd;		/* input image's file descriptor */
    int oimg_fd;		/* output image's file descriptor */
    int ialt_fd = -1;		/* input elevation map's file descriptor */
    int ivis_fd = -1;		/* input visibility map's file descriptor */
    struct History hist;
    struct Cell_head orig_window;

    /* Define module */
    define_module();

    /* Define the different input options */
    opts = define_options();

    /**** Start ****/
    G_gisinit(argv[0]);
    if (G_parser(argc, argv) < 0)
	exit(EXIT_FAILURE);

    G_get_set_window(&orig_window);
    adjust_region(opts.iimg->answer);

    /* open input raster */
    if ((iimg_fd = Rast_open_old(opts.iimg->answer, "")) < 0)
	G_fatal_error(_("Unable to open raster map <%s>"), opts.iimg->answer);

    if (opts.ialt->answer) {
	if ((ialt_fd = Rast_open_old(opts.ialt->answer, "")) < 0)
	    G_fatal_error(_("Unable to open raster map <%s>"),
			  opts.ialt->answer);
    }

    if (opts.ivis->answer) {
	if ((ivis_fd = Rast_open_old(opts.ivis->answer, "")) < 0)
	    G_fatal_error(_("Unable to open raster map <%s>"),
			  opts.ivis->answer);
    }

    /* open a floating point raster or not? */
    if (opts.oint->answer) {
	if ((oimg_fd = Rast_open_new(opts.oimg->answer, CELL_TYPE)) < 0)
	    G_fatal_error(_("Unable to create raster map <%s>"),
			  opts.oimg->answer);
    }
    else {
	if ((oimg_fd = Rast_open_fp_new(opts.oimg->answer)) < 0)
	    G_fatal_error(_("Unable to create raster map <%s>"),
			  opts.oimg->answer);
    }

    /* read the scale parameters */
    read_scale(opts.iscl, iscale);
    read_scale(opts.oscl, oscale);

    /* initialize this 6s computation and parse the input conditions file */
    init_6S(opts.icnd->answer);

    InputMask imask = RADIANCE;	/* the input mask tells us what transformations if any
				   needs to be done to make our input values, reflectance
				   values scaled between 0 and 1 */
    if (opts.irad->answer)
	imask = REFLECTANCE;
    if (opts.etmbefore->answer)
	imask = (InputMask) (imask | ETM_BEFORE);
    if (opts.etmafter->answer)
	imask = (InputMask) (imask | ETM_AFTER);

    /* process the input raster and produce our atmospheric corrected output raster. */
    G_message(_("Atmospheric correction..."));
    process_raster(iimg_fd, imask, iscale, ialt_fd, ivis_fd,
		   oimg_fd, opts.oint->answer, oscale);


    /* Close the input and output file descriptors */
    Rast_short_history(opts.oimg->answer, "raster", &hist);
    Rast_close(iimg_fd);
    if (opts.ialt->answer)
	Rast_close(ialt_fd);
    if (opts.ivis->answer)
	Rast_close(ivis_fd);
    Rast_close(oimg_fd);

    Rast_command_history(&hist);
    Rast_write_history(opts.oimg->answer, &hist);

    /* Copy the colors of the input raster to the output raster.
       Scaling is ignored and color ranges might not be correct. */
    copy_colors(opts.iimg->answer, opts.oimg->answer);

    Rast_set_window(&orig_window);
    G_message(_("Atmospheric correction complete."));

    exit(EXIT_SUCCESS);
}