コード例 #1
1
ファイル: aa.c プロジェクト: chouquette/vlc
/**
 * Control for vout display
 */
static int Control(vout_display_t *vd, int query, va_list args)
{
    VLC_UNUSED(args);
    vout_display_sys_t *sys = vd->sys;

    switch (query) {
    case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
        /* We have to ignore what is requested */
        vout_display_SendEventPicturesInvalid(vd);
        return VLC_SUCCESS;

    case VOUT_DISPLAY_RESET_PICTURES:
        if (sys->pool)
            picture_pool_Release(sys->pool);
        sys->pool = NULL;

        vd->fmt.i_width  = aa_imgwidth(sys->aa_context);
        vd->fmt.i_height = aa_imgheight(sys->aa_context);
        return VLC_SUCCESS;

    case VOUT_DISPLAY_HIDE_MOUSE:
        aa_hidemouse(sys->aa_context);
        return VLC_SUCCESS;

    default:
        msg_Err(vd, "Unsupported query in vout display aalib");
        return VLC_EGENERIC;
    }
}
コード例 #2
0
ファイル: scene2.c プロジェクト: stroucki/bb
void drawprujezd(char *mesg, int starttime)
{
    int state = STATE;
    double height = aa_imgheight(context) / 3 + aa_imgheight(context) / 4 * cos(state / (double) LTIME);
    double width = (double) aa_imgwidth(context) * 0.75 * 2.0 / 3.0 / 3;
    int pos = aa_imgwidth(context) - width * state / LTIME;
    print(pos + height, (aa_imgheight(context) - height) / 2, width, height, font, 255, mesg);
}
コード例 #3
0
ファイル: credits2.c プロジェクト: fourks/bb.js
static void pryc()
{
    float size = 3 + (STATE) * 10.0 / MAXTIME;
    float radius = (STATE) * aa_imgwidth(context) / MAXTIME;
    float yradius = (STATE) * aa_imgheight(context) / MAXTIME;
    int xm = aa_imgwidth(context) / 2;
    int ym = aa_imgheight(context) / 3;
    clrscr();
    centerprint(xm + radius * sin(STATE / 100000.0), ym + yradius * cos(STATE / 300000.0), size, 128, "The", 0);
    centerprint(xm + radius * sin(STATE / 150000.0), 2 * ym + yradius * cos(STATE / 400000.0), size, 128, "END", 0);
}
コード例 #4
0
ファイル: scene2.c プロジェクト: stroucki/bb
void message(char *text, int starttime)
{
    int state = STATE;
    if (state > 0 && state < MAXPOS) {
	double pp = state * M_PI / MAXPOS * 2;
	double width = (1 + cos(pp)) * 5 + 2;
	int pos = aa_imgheight(context) - aa_imgheight(context) * state / MAXPOS;
	if (width <= 0)
	    return;
	centerprint(aa_imgwidth(context) / 2, pos, width, sin(pp / 2) * 255, text, 0);
    }
}
コード例 #5
0
ファイル: messager.c プロジェクト: joshdekock/jim-pspware
void devezen1()
{
    bckup = (char *) malloc(aa_imgwidth(context) * aa_imgheight(context));
    memcpy(bckup, context->imagebuffer, aa_imgwidth(context) * aa_imgheight(context));
    tographics();
    bckup1 = (char *) malloc(aa_imgwidth(context) * aa_imgheight(context));
    memcpy(bckup1, context->imagebuffer, aa_imgwidth(context) * aa_imgheight(context));
    drawptr = toblack1;
    timestuff(0, NULL, toblack1, 5000000);
    free(bckup);
    free(bckup1);
}
コード例 #6
0
ファイル: aaedit.c プロジェクト: Jay-Jay-OPL/ps2sdk-ports
struct aa_edit *aa_createedit(aa_context * c, int x, int y, int size, char *s, int maxsize)
{
    struct aa_edit *e;
    if (x < 0)
	x = 0;
    if (y < 0)
	y = 0;
    if (x >= aa_imgwidth(c) - 1)
	x = aa_imgwidth(c) - 2;
    if (y >= aa_imgheight(c) - 1)
	y = aa_imgwidth(c) - 2;
    if (x + size >= aa_imgwidth(c))
	size = aa_imgwidth(c) - 1 - x;
    e = malloc(sizeof(struct aa_edit));
    if (e == NULL)
	return NULL;
    e->maxsize = maxsize;
    e->data = s;
    e->cursor = strlen(s);
    e->clearafterpress = 1;
    e->x = x;
    e->y = y;
    e->size = size;
    e->c = c;
    e->printpos = 0;
    aa_editdisplay(e);
    return (e);
}
コード例 #7
0
ファイル: scene7.c プロジェクト: artyfarty/bb-osx
void scene9(void)
{
    int width, height, scanline;
    int i, formula = 1;
    char *buffer1;
    signal(SIGFPE, SIG_IGN);
    width = aa_imgwidth(context);
    height = aa_imgheight(context);
    scanline = width;
    buffer1 = context->imagebuffer;
    params->bright = -255;
    params->dither = AA_NONE;

    zcontext = make_context(width, height, scanline, 0, 1, flip_buffers, ui_waitfunc, buffer1, buffer1, get_pixelwidth(width), get_pixelheight(height));
    if (!zcontext) {
	exit(-1);
    }
    set_formula(zcontext, formula);
    for (i = 0; i < 255; i++) {
	zcontext->colors[i] = (i * 15) % 255 + 1;
    }
    zcontext->colors[0] = 0;
    zcontext->num_colors = 255;
    tbreak = 2;
    zcontext->maxiter = 255;
    fastmode--;
    zcontext->range = 8;
    zcontext->incoloringmode = 0;
    zcontext->coloringmode = 0;
    zcontext->plane = 0;
    starttime = endtime;
    sef = 1;
    eef = 0;
    is = -1;
    rs = -1;
    ie = 2;
    re = -2;
    timestuff(0, NULL, juliov, ETIME2);
    sef = 0;
    eef = 0;
    is = ie, rs = re;
    ie = 2;
    re = 2;
    timestuff(0, NULL, juliov, ETIME2);
    sef = 0;
    eef = 0;
    is = ie, rs = re;
    ie = -2;
    re = 2;
    timestuff(0, NULL, juliov, ETIME2);
    sef = 0;
    eef = 1;
    is = ie, rs = re;
    ie = 2;
    re = -2;
    timestuff(0, NULL, juliov, ETIME2);
    context->imagebuffer = buffer1;
    params->bright = 0;
    params->dither = AA_FLOYD_S;
}
コード例 #8
0
ファイル: aa.c プロジェクト: forthyen/SDesk
/*****************************************************************************
 * Manage: handle aa events
 *****************************************************************************
 * This function should be called regularly by video output thread. It manages
 * console events. It returns a non null value on error.
 *****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
    int event, x, y, b;
    event = aa_getevent( p_vout->p_sys->aa_context, 0 );
    switch ( event )
    {
    case AA_MOUSE:
        aa_getmouse( p_vout->p_sys->aa_context, &x, &y, &b );
        if ( b & AA_BUTTON3 )
        {
            intf_thread_t *p_intf;
            p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF, FIND_ANYWHERE );
            if( p_intf )
            {
                p_intf->b_menu_change = 1;
                vlc_object_release( p_intf );
            }
        }
        break;
    case AA_RESIZE:
        p_vout->i_changes |= VOUT_SIZE_CHANGE;
        aa_resize( p_vout->p_sys->aa_context );
        p_vout->p_sys->i_width = aa_imgwidth( p_vout->p_sys->aa_context );
        p_vout->p_sys->i_height = aa_imgheight( p_vout->p_sys->aa_context );
        break;
    default:
        break;
    }
    return( 0 );
}
コード例 #9
0
ファイル: aa.c プロジェクト: forthyen/SDesk
/*****************************************************************************
 * Create: allocates aa video thread output method
 *****************************************************************************
 * This function allocates and initializes a aa vout method.
 *****************************************************************************/
static int Create( vlc_object_t *p_this )
{
    vout_thread_t *p_vout = (vout_thread_t *)p_this;

    /* Allocate structure */
    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
    if( p_vout->p_sys == NULL )
    {
        msg_Err( p_vout, "out of memory" );
        return( 1 );
    }

    /* Don't parse any options, but take $AAOPTS into account */
    aa_parseoptions( NULL, NULL, NULL, NULL );

    if (!(p_vout->p_sys->aa_context = aa_autoinit(&aa_defparams)))
    {
        msg_Err( p_vout, "cannot initialize aalib" );
        return( 1 );
    }

    p_vout->pf_init = Init;
    p_vout->pf_end = End;
    p_vout->pf_manage = Manage;
    p_vout->pf_render = Render;
    p_vout->pf_display = Display;

    p_vout->p_sys->i_width = aa_imgwidth(p_vout->p_sys->aa_context);
    p_vout->p_sys->i_height = aa_imgheight(p_vout->p_sys->aa_context);
    aa_autoinitkbd( p_vout->p_sys->aa_context, 0 );
    aa_autoinitmouse( p_vout->p_sys->aa_context, AA_MOUSEPRESSMASK );
    aa_hidemouse( p_vout->p_sys->aa_context );
    return( 0 );
}
コード例 #10
0
ファイル: aa.c プロジェクト: chouquette/vlc
/**
 * This function allocates and initializes a aa vout method.
 */
static int Open(vlc_object_t *object)
{
    vout_display_t *vd = (vout_display_t *)object;
    vout_display_sys_t *sys;

#ifndef _WIN32
    if (!vlc_xlib_init (object))
        return VLC_EGENERIC;
#endif

    /* Allocate structure */
    vd->sys = sys = calloc(1, sizeof(*sys));
    if (!sys)
        return VLC_ENOMEM;

    /* Don't parse any options, but take $AAOPTS into account */
    aa_parseoptions(NULL, NULL, NULL, NULL);

    /* */
    sys->aa_context = aa_autoinit(&aa_defparams);
    if (!sys->aa_context) {
        msg_Err(vd, "cannot initialize aalib");
        goto error;
    }
    vout_display_DeleteWindow(vd, NULL);

    aa_autoinitkbd(sys->aa_context, 0);
    aa_autoinitmouse(sys->aa_context, AA_MOUSEALLMASK);

    /* */
    video_format_t fmt = vd->fmt;
    fmt.i_chroma = VLC_CODEC_RGB8;
    fmt.i_width  = aa_imgwidth(sys->aa_context);
    fmt.i_height = aa_imgheight(sys->aa_context);
    fmt.i_visible_width = fmt.i_width;
    fmt.i_visible_height = fmt.i_height;

    /* Setup vout_display now that everything is fine */
    vd->fmt = fmt;
    vd->info.has_pictures_invalid = true;
    vd->info.needs_event_thread = true;

    vd->pool    = Pool;
    vd->prepare = Prepare;
    vd->display = PictureDisplay;
    vd->control = Control;
    vd->manage  = Manage;

    /* Inspect initial configuration and send correction events
     * FIXME how to handle aspect ratio with aa ? */
    vout_display_SendEventDisplaySize(vd, fmt.i_width, fmt.i_height);

    return VLC_SUCCESS;

error:
    if (sys && sys->aa_context)
        aa_close(sys->aa_context);
    free(sys);
    return VLC_EGENERIC;
}
コード例 #11
0
ファイル: aa_gui.c プロジェクト: dividuum/infon
static void draw_creature(const client_creature_t *creature, void *opaque) {
    int x = creature->x / (256 / SCALE) - ox;
    int y = creature->y / (256 / SCALE) - oy;
    if (x < 0 || x >= aa_imgwidth(context) ||
        y < 0 || y >= aa_imgheight(context))
        return;
    bitmap[y * aa_imgwidth(context) + x] = 0xFF;
}
コード例 #12
0
ファイル: SDL_aavideo.c プロジェクト: 0-14N/NDroid
static void AA_ResizeHandler(aa_context *context)
{
	aa_resize(context);
	local_this->hidden->x_ratio = ((double)aa_imgwidth(context)) / ((double)local_this->screen->w);
	local_this->hidden->y_ratio = ((double)aa_imgheight(context)) / ((double)local_this->screen->h);

	fastscale (local_this->hidden->buffer, aa_image(context), local_this->hidden->w, aa_imgwidth (context), local_this->hidden->h, aa_imgheight (context));
	aa_renderpalette(context, local_this->hidden->palette, local_this->hidden->rparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
	aa_flush(context);
}
コード例 #13
0
ファイル: scene2.c プロジェクト: stroucki/bb
void drawzoomer(char *mesg, int starttime, int pos)
{
    float width = 1000000.0 / (STATE);
    if (width > 1.0) {
	int color = (width - 1) * 255;
	if (color > 255)
	    color = 255;
	centerprint(aa_imgwidth(context) / 2, pos * aa_imgheight(context) / 6, width, color, mesg, 0);
    }
}
コード例 #14
0
ファイル: bb.c プロジェクト: stroucki/bb
void centerprinth(int x, int y, double size, int color, char *text, int mode)
{
    if (!mode || !dual) {
	double width = aa_imgwidth(context) / size;
	double height = width * (double) aa_imgheight(context) * 1.333 / aa_imgwidth(context) * aa_mmwidth(context) / aa_mmheight(context);
	print(x - (width * strlen(text)) / 2, y - height / 2, width, height, font, color, text);
    }
    else {
	if (mode & 1) {
	    double width = aa_imgwidth(context) / size / 2;
	    double height = width * (double) aa_imgheight(context) * 1.333 / aa_imgwidth(context) * aa_mmwidth(context) / aa_mmheight(context);
	    print(x / 2 - (width * strlen(text)) / 2, y - height / 2, width, height, font, color, text);
	}
	if (mode & 1) {
	    double width = aa_imgwidth(context) / size / 2;
	    double height = width * (double) aa_imgheight(context) * 1.333 / aa_imgwidth(context) * aa_mmwidth(context) / aa_mmheight(context);
	    print(aa_imgwidth(context) / 2 + x / 2 - (width * strlen(text)) / 2, y - height / 2, width, height, font, color, text);
	}
    }
}
コード例 #15
0
ファイル: scene7.c プロジェクト: artyfarty/bb-osx
static void ui_display(void)
{
    displayed = 1;
    aa_render(context, params, 0, 0, aa_imgwidth(context), aa_imgheight(context));
    aa_flush(context);

#if 0
    if (numbertype != FORMULA)
	rotate_continue();
#endif
}
コード例 #16
0
ファイル: SDL_aavideo.c プロジェクト: 0-14N/NDroid
SDL_Surface *AA_SetVideoMode(_THIS, SDL_Surface *current,
				int width, int height, int bpp, Uint32 flags)
{
	int mode;

	if ( AA_buffer ) {
		SDL_free( AA_buffer );
	}

	AA_buffer = SDL_malloc(width * height);
	if ( ! AA_buffer ) {
		SDL_SetError("Couldn't allocate buffer for requested mode");
		return(NULL);
	}

/* 	printf("Setting mode %dx%d\n", width, height); */

	SDL_memset(aa_image(AA_context), 0, aa_imgwidth(AA_context) * aa_imgheight(AA_context));
	SDL_memset(AA_buffer, 0, width * height);

	/* Allocate the new pixel format for the screen */
	if ( ! SDL_ReallocFormat(current, 8, 0, 0, 0, 0) ) {
		return(NULL);
	}

	/* Set up the new mode framebuffer */
	current->flags = SDL_FULLSCREEN;
	AA_w = current->w = width;
	AA_h = current->h = height;
	current->pitch = current->w;
	current->pixels = AA_buffer;

	AA_x_ratio = ((double)aa_imgwidth(AA_context)) / ((double)width);
	AA_y_ratio = ((double)aa_imgheight(AA_context)) / ((double)height);

	/* Set the blit function */
	this->UpdateRects = AA_DirectUpdate;

	/* We're done */
	return(current);
}
コード例 #17
0
ファイル: Paddle.cpp プロジェクト: barak/asciipong
 Paddle::Paddle(aa_context *c, int align) {
     context = c;
     this->align=align;
     x1 = aa_imgwidth(context) / 2 - 6;
     x2 = x1 + 12;
     if( align == TOP ) {
         y1 = 2;
     } else {
         y1 = aa_imgheight(context) - 5;
     }
     y2 = y1 + 3;
 }
コード例 #18
0
ファイル: scene2.c プロジェクト: stroucki/bb
void drawhorotoc(char *mesg, char *mesg1, int starttime)
{
    int state = STATE;
    int width = aa_imgwidth(context);
    int height = aa_imgheight(context);
    float ratio = ((float) state / ETIME2);
    if (state < ETIME2 && state > 0) {
	print(0, 0, width / strlen(mesg), height * ratio, font, 255, mesg);
	print(0, height * ratio, width / strlen(mesg1), height * (1 - ratio), font, 255, mesg1);
    }
    if (state > ETIME2)
	print(0, 0, width / strlen(mesg), height, font, 255, mesg);
}
コード例 #19
0
ファイル: aaflush.c プロジェクト: Jay-Jay-OPL/ps2sdk-ports
void aa_flush(aa_context * c)
{
    if (c->driver->print != NULL)
	aa_display(c, 0, 0, aa_imgwidth(c), aa_imgheight(c));
    if (c->driver->flush != NULL)
    { int cursor=c->mousemode;
        if(cursor&&c->mousedriver!=NULL&&(c->mousedriver->flags&AA_HIDECURSOR))
	   aa_hidemouse(c);
	c->driver->flush(c);
        if(cursor&&c->mousedriver!=NULL&&(c->mousedriver->flags&AA_HIDECURSOR))
	   aa_showmouse(c);
    }
}
コード例 #20
0
ファイル: gstaasink.c プロジェクト: ChinnaSuhas/ossbuild
static GstFlowReturn
gst_aasink_render (GstBaseSink * basesink, GstBuffer * buffer)
{
  GstAASink *aasink;

  aasink = GST_AASINK (basesink);

  GST_DEBUG ("render");

  gst_aasink_scale (aasink, GST_BUFFER_DATA (buffer),   /* src */
      aa_image (aasink->context),       /* dest */
      aasink->width,            /* sw */
      aasink->height,           /* sh */
      aa_imgwidth (aasink->context),    /* dw */
      aa_imgheight (aasink->context));  /* dh */

  aa_render (aasink->context, &aasink->ascii_parms,
      0, 0, aa_imgwidth (aasink->context), aa_imgheight (aasink->context));
  aa_flush (aasink->context);
  aa_getevent (aasink->context, FALSE);

  return GST_FLOW_OK;
}
コード例 #21
0
ファイル: gstaasink.c プロジェクト: an146/gst-plugins-good
static GstFlowReturn
gst_aasink_show_frame (GstVideoSink * videosink, GstBuffer * buffer)
{
  GstAASink *aasink;
  GstVideoFrame frame;

  aasink = GST_AASINK (videosink);

  GST_DEBUG ("show frame");

  if (!gst_video_frame_map (&frame, &aasink->info, buffer, GST_MAP_READ))
    goto invalid_frame;

  gst_aasink_scale (aasink, GST_VIDEO_FRAME_PLANE_DATA (&frame, 0),     /* src */
      aa_image (aasink->context),       /* dest */
      GST_VIDEO_INFO_WIDTH (&aasink->info),     /* sw */
      GST_VIDEO_INFO_HEIGHT (&aasink->info),    /* sh */
      GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0), /* ss */
      aa_imgwidth (aasink->context),    /* dw */
      aa_imgheight (aasink->context));  /* dh */

  aa_render (aasink->context, &aasink->ascii_parms,
      0, 0, aa_imgwidth (aasink->context), aa_imgheight (aasink->context));
  aa_flush (aasink->context);
  aa_getevent (aasink->context, FALSE);
  gst_video_frame_unmap (&frame);

  return GST_FLOW_OK;

  /* ERRORS */
invalid_frame:
  {
    GST_DEBUG_OBJECT (aasink, "invalid frame");
    return GST_FLOW_ERROR;
  }
}
コード例 #22
0
static void
resize(void){
    /*
     * this function is called by aa lib if windows resizes
     * further during init, because here we have to calculate
     * a little bit
     */

    aa_resize(c);

    aspect_save_screenres(aa_imgwidth(c),aa_imgheight(c));
    image_height =  aa_imgheight(c); //src_height;
    image_width = aa_imgwidth(c); //src_width;

    aspect(&image_width,&image_height,A_ZOOM);

    image_x = (aa_imgwidth(c) - image_width) / 2;
    image_y = (aa_imgheight(c) - image_height) / 2;
    screen_w = image_width * aa_scrwidth(c) / aa_imgwidth(c);
    screen_h = image_height * aa_scrheight(c) / aa_imgheight(c);
    screen_x = (aa_scrwidth(c) - screen_w) / 2;
    screen_y = (aa_scrheight(c) - screen_h) / 2;

    if(sws) sws_freeContext(sws);
    sws = sws_getContextFromCmdLine(src_width,src_height,image_format,
				   image_width,image_height,IMGFMT_Y8);

    memset(image, 0, sizeof(image));
    image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x;

    memset(image_stride, 0, sizeof(image_stride));
    image_stride[0] = aa_imgwidth(c);

    showosdmessage=0;

}
コード例 #23
0
ファイル: credits2.c プロジェクト: fourks/bb.js
static void morphdraw()
{
    int s = STATE > 0 ? (STATE < MTIME ? STATE : MTIME) : 0;
    int mul = s * 256 / MTIME;
    int mul1 = 256 - mul;
    int i;
    int size = aa_imgwidth(context) * (aa_imgheight(context) - YSTART * 2);
    char *c = context->imagebuffer + aa_imgwidth(context) * 2 * YSTART;
    for (i = 0; i < size; i++, c++) {
	*c = (source[i] * mul1 + target[i] * mul) >> 8;
    }
    aa_fastrender(context, 0, YSTART, aa_scrwidth(context), aa_scrheight(context));
    aa_flush(context);
    emscripten_sleep(1);
}
コード例 #24
0
ファイル: messager.c プロジェクト: fourks/bb.js
static void toblack1()
{
    int x, y, mul1, mul2 = 0, pos;
    int minpos = 0;
    unsigned char *b1 = bckup, *b2 = bckup1;
    pos = STAGE * (aa_imgheight(context) + aa_imgheight(context)) / (endtime - starttime) - aa_imgheight(context);
    for (y = 0; y < aa_imgheight(context); y++) {
	mul1 = (y - pos);
	if (mul1 < 0)
	    mul1 = 0;
	else
	    mul1 = mul1 * 256 * 4 / aa_imgheight(context);
	if (mul1 > 256)
	    mul1 = 256;
	mul2 = (y - pos - aa_imgheight(context));
	if (mul2 < 0)
	    mul2 = 0;
	else
	    mul2 = mul2 * 256 * 8 / aa_imgheight(context);
	if (mul2 > 256)
	    mul2 = 256;
	if (mul2 == 0)
	    minpos = y;
	mul1 -= mul2;
	for (x = 0; x < aa_imgwidth(context); x++) {
	    aa_putpixel(context, x, y,
			(mul1 * (int) (*b1) + mul2 * (int) (*b2)) / 256);
	    b1++;
	    b2++;
	}
    }
    minpos = pos + 3 * aa_imgheight(context) / 4;
    if (minpos < 0)
	minpos = 0;
    if (minpos > aa_imgheight(context))
	minpos = aa_imgheight(context);
    aa_render(context, params, 0, 0, aa_imgwidth(context), minpos);
    aa_flush(context);
    emscripten_sleep(1);
}
コード例 #25
0
ファイル: aa.c プロジェクト: FLYKingdom/vlc
/**
 * Prepare a picture for display */
static void Prepare(vout_display_t *vd, picture_t *picture)
{
    vout_display_sys_t *sys = vd->sys;

    assert(vd->fmt.i_width  == aa_imgwidth(sys->aa_context) &&
           vd->fmt.i_height == aa_imgheight(sys->aa_context));

#if 0
    if (picture->format.p_palette) {
        for (int i = 0; i < 256; i++) {
            aa_setpalette(vd->sys->palette, 256 - i,
                           red[ i ], green[ i ], blue[ i ]);
        }
    }
#else
    VLC_UNUSED(picture);
#endif

    aa_fastrender(sys->aa_context, 0, 0,
                  vd->fmt.i_width, vd->fmt.i_height);
}
コード例 #26
0
ファイル: aa.c プロジェクト: chouquette/vlc
/**
 * Return a pool of direct buffers
 */
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
    vout_display_sys_t *sys = vd->sys;
    VLC_UNUSED(count);

    if (!sys->pool) {
        picture_resource_t rsc;

        memset(&rsc, 0, sizeof(rsc));
        rsc.p[0].p_pixels = aa_image(sys->aa_context);
        rsc.p[0].i_pitch = aa_imgwidth(sys->aa_context);
        rsc.p[0].i_lines = aa_imgheight(sys->aa_context);

        picture_t *p_picture = picture_NewFromResource(&vd->fmt, &rsc);
        if (!p_picture)
            return NULL;

        sys->pool = picture_pool_New(1, &p_picture);
    }
    return sys->pool;
}
コード例 #27
0
ファイル: SDL_aavideo.c プロジェクト: 0-14N/NDroid
static void AA_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
{
	int i;
	SDL_Rect *rect;

	fastscale (AA_buffer, aa_image(AA_context), AA_w, aa_imgwidth (AA_context), AA_h, aa_imgheight (AA_context));
#if 1
	aa_renderpalette(AA_context, AA_palette, AA_rparams, 0, 0, aa_scrwidth(AA_context), aa_scrheight(AA_context));
#else
	/* Render only the rectangles in the list */
	printf("Update rects : ");
	for ( i=0; i < numrects; ++i ) {
		rect = &rects[i];
		printf("(%d,%d-%d,%d)", rect->x, rect->y, rect->w, rect->h);
		aa_renderpalette(AA_context, AA_palette, AA_rparams, rect->x * AA_x_ratio, rect->y * AA_y_ratio, rect->w * AA_x_ratio, rect->h * AA_y_ratio);
	}
	printf("\n");
#endif
	SDL_mutexP(AA_mutex);
	aa_flush(AA_context);
	SDL_mutexV(AA_mutex);
	return;
}
コード例 #28
0
ファイル: aa_gui.c プロジェクト: dividuum/infon
static void aarenderer_tick(int gt, int delta) {
    const client_world_info_t *worldsize = infon->get_world_info();
    if (!worldsize) return;
    const client_maptile_t *world = infon->get_world();
    unsigned char *p = bitmap;
    int x;
    int y;
    p--;
    for (y = 0; y < aa_imgheight(context); y++) {
        for (x = 0; x < aa_imgwidth(context); x++) {
            int terrainx = (x - ox) / SCALE;
            int terrainy = (y - oy) / SCALE;
            p++;
            if (terrainx < 0 || terrainx >= worldsize->width || 
                terrainy < 0 || terrainy >= worldsize->height)
                continue;
            const client_maptile_t *tile = &world[terrainy * worldsize->width + terrainx];
            switch (tile->type) {
                case TILE_SOLID:
                    *p = 90;
                    break;
                case TILE_PLAIN:
                    *p = 0;
                    break;
                default:
                    *p = 50;
                    break;
            }
        }
    }

    infon->each_creature(draw_creature, NULL);
    aa_renderpalette (context, palette, params, 0, 0, aa_scrwidth (context), aa_scrheight (context));
    aa_printf(context, 0, 0, AA_SPECIAL, infon->version);
    aa_flush(context);
}
コード例 #29
0
ファイル: aatest.c プロジェクト: dgeelen/tmvp
int main(int argc, char **argv)
{
	aa_context *c;
	int i, y;
	char s[256];
	aa_renderparams *p;
	strcpy(s, "line editor.");
	if (!aa_parseoptions(NULL, NULL, &argc, argv) || argc != 1) {
		printf("%s\n", aa_help);
		exit(1);
	}
	c = aa_autoinit(&aa_defparams);
	if (c == NULL) {
		printf("Can not intialize aalib\n");
		exit(2);
	}
	if (!aa_autoinitkbd(c, 0)) {
		printf("Can not intialize keyboard\n");
		aa_close(c);
		exit(3);
	}
	for (i = 0; i < aa_imgwidth(c); i++)
		for (y = 0; y < aa_imgheight(c); y++)
			aa_putpixel(c, i, y, i + y < 80 ? i : ((i + y) < 100 ? (i + y == 89 ? 150 : 0) : y * 8));
	aa_hidecursor(c);
	aa_fastrender(c, 0, 0, aa_scrwidth(c), aa_scrheight(c));
	aa_printf(c, 0, 0, AA_SPECIAL, "Fast rendering routine %i",1);
	aa_flush(c);
	aa_getkey(c, 1);
	aa_edit(c, 0, 1, 20, s, 256);
	aa_puts(c, 0, 0, AA_SPECIAL, "Key lookup test        ");
	aa_flush(c);
	int ch;
	while ((ch = aa_getevent(c, 1)) != ' ') {
		char s[80];
		sprintf(s, "Key event test-space to exit. c:%i", ch);
		aa_puts(c, 0, 0, AA_SPECIAL, s);
		aa_flush(c);
	}
	if (aa_autoinitmouse(c, AA_MOUSEALLMASK)) {
		int co = 0;
		sprintf(s, "Mouse test-space to exit");
		aa_puts(c, 0, 0, AA_SPECIAL, s);
		aa_flush(c);
		while (aa_getevent(c, 1) != ' ') {
			int x, y, b;
			char s[80];
			co++;
			aa_getmouse(c, &x, &y, &b);
			sprintf(s, "Mouse test-space to exit. x:%i y:%i b:%i event #%i  ", x, y, b, co);
			aa_puts(c, 0, 0, AA_SPECIAL, s);
			aa_flush(c);
		}
		aa_hidemouse(c);
		while (aa_getevent(c, 1) != ' ') {
			int x, y, b;
			char s[80];
			co++;
			aa_getmouse(c, &x, &y, &b);
			sprintf(s, "Hidden mouse test-space to exit. x:%i y:%i b:%i event #%i  ", x, y, b, co);
			aa_puts(c, 0, 0, AA_SPECIAL, s);
			aa_flush(c);
		}
		aa_uninitmouse(c);
	}
	p = aa_getrenderparams();
	for (i = 0; i < AA_DITHERTYPES; i++) {
		p->dither = i;
		aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
		aa_puts(c, 0, 0, AA_SPECIAL, aa_dithernames[i]);
		aa_flush(c);
		aa_getkey(c, 1);
	}
	for (i = 0; i < 255; i += 32) {
		p->bright = i;
		aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
		aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - bright changes");
		aa_flush(c);
		aa_getkey(c, 1);
	}
	p->bright = 0;
	for (i = 0; i < 128; i += 16) {
		p->contrast = i;
		aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
		aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - contrast changes");
		aa_flush(c);
		aa_getkey(c, 1);
	}
	p->contrast = 0;
	for (i = 0; i < 255; i += 32) {
		p->gamma = 1 + i / 32.0;
		aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
		aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - gamma changes");
		aa_flush(c);
		aa_getkey(c, 1);
	}
	p->gamma = 1.0;
	for (i = 0; i < 255; i += 32) {
		p->randomval = i;
		aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
		aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - randomval changes");
		aa_flush(c);
		aa_getkey(c, 1);
	}
	aa_close(c);
	return 0;
}
コード例 #30
0
ファイル: scene2.c プロジェクト: stroucki/bb
static void dvojprujezd2(int starttime, char *text1, char *text2)
{
    int pos = (getwidth(2) * strlen(text1) + 1);
    centerprint(-pos / 2 + (aa_imgwidth(context) + pos * 1.2) * STATE / (endtime - starttime), aa_imgheight(context) / 3, 2, 255, text1, 0);
    pos = (getwidth(2) * strlen(text2) + 1);
    centerprint(aa_imgwidth(context) + pos / 2 - (aa_imgwidth(context) + pos * 1.2) * STATE / (endtime - starttime), 2 * aa_imgheight(context) / 3, 2, 255, text2, 0);
}