Пример #1
0
CChannelN::CChannelN (TImage * pImg, TImage * pCodeImg, int n_Chan)
{
	m_nCurPosition = 0;
	m_nChan=n_Chan;
	pImage = pImg;
	pCodeImage = pCodeImg;

	m_sSize.x=pImage->ClientRect.right;
	m_sSize.y=pImage->ClientRect.bottom;

	m_nVScale=Form1->VScale();

	m_pnDisplayState = new long[m_sSize.x*m_nChan];
	for (int i = 0; i < m_sSize.x*n_Chan; i++) {  //
		m_pnDisplayState[i] = 0;//5- rand() %10;
	}
	allegro_init();
	set_gdi_color_format();
	install_keyboard();
	install_mouse();
	install_timer();

	bmpCanvas = create_bitmap_ex(32,m_sSize.x,m_sSize.y);
	bmpCodeCanvas  = create_bitmap_ex(32,pCodeImage->ClientRect.Width(),Form1->ImageCode->ClientRect.Height());
	m_nColor=makecol24(0,255,255);

	PenYellow= CreatePen(PS_SOLID,1, 0x0000ff00);
	PenBlack = CreatePen(PS_SOLID,1, 0x00000000);
	PenGray  = CreatePen(PS_SOLID,1, clGray);
	PenRed   = CreatePen(PS_SOLID,1, clRed);
}
Пример #2
0
TDisplay3D::TDisplay3D(TImage * pImg,int nChan)//:CChannelN(pImg,Form1->ImageCode,nChan)
{
	pImage = pImg;
	int x=pImage->ClientRect.right;
	int y=pImage->ClientRect.bottom;
	bmpCanvasBackground = create_bitmap_ex(32,x,y);
	bmpCanvas = create_bitmap_ex(32,x,y);
	for (int i=0; i < 72; i++)
		Display3DBuffer[i].AddSample(0,0,0);
}
Пример #3
0
NaroolLurker::NaroolLurker(Vector2 opos, double shipAngle,
ShipData *shipData, unsigned int code)
:
Ship(opos, shipAngle, shipData, code)
{
	STACKTRACE;
	weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
	weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponDamage   = get_config_int("Weapon", "Damage", 0);
	weaponArmour   = get_config_int("Weapon", "Armour", 0);
	weaponDuration = get_config_int("Weapon", "Duration", 0);
	poison         = get_config_float("Weapon", "poison", 0);

	normalRechargeAmount = recharge_amount;

	cloak = FALSE;
	cloak_frame = 0;

	BITMAP *shpbmp = sprite->get_bitmap(0);
	int bpp = bitmap_color_depth(shpbmp);
	lightningbmp = create_bitmap_ex(bpp, shpbmp->w, shpbmp->h);
	clear_to_color(lightningbmp, makeacol(0,0,0,255));
	//maxsparktime = 2000;
	maxsparktime = get_config_float("Quirk", "maxsparktime", 2000);
	sparktime = maxsparktime;
	sparkpos = 0.5 * Vector2(lightningbmp->w,lightningbmp->h);

	Rmax = get_config_float("Quirk", "Rmax", 1);
}
GLuint _gk_load_texture( const GLYPH_GL_PIXELTYPE *pixeldata, int w, int h )
{
   GLuint textureId;
   
#if (GLYPH_TARGET == GLYPH_TARGET_ALLEGGL)

   BITMAP *temp;
   int i;
   
   /* Unfortunately, we currenly need to make a copy of the pixel data */
   
   temp = create_bitmap_ex( 8, w, h );
   
   for( i = 0; i < w*h; i++ )
      putpixel( temp, i%w, i/w, pixeldata[i] );
   
   allegro_gl_use_alpha_channel( TRUE );
   allegro_gl_use_mipmapping(FALSE);
   allegro_gl_set_texture_format( GL_ALPHA8 );
   
   textureId = allegro_gl_make_texture_ex( AGL_TEXTURE_ALPHA_ONLY, temp, GL_ALPHA8 );
   
   destroy_bitmap( temp );

#else

   glGenTextures( 1, &textureId );
   glBindTexture( GL_TEXTURE_2D, textureId );
   glTexImage2D( GL_TEXTURE_2D, 0, 1, w, h, 0, GL_ALPHA8, GL_UNSIGNED_BYTE, pixeldata );
   
#endif
   
   return textureId;
}
Пример #5
0
/* color_copy_glyph_range:
 *  Colour font helper function. Copies (part of) a glyph range
 */
static FONT_COLOR_DATA *color_copy_glyph_range(FONT_COLOR_DATA *cf, int begin, int end)
{
   FONT_COLOR_DATA *newcf;
   BITMAP **gl;
   BITMAP *g;
   int num, c;
   
   if (begin<cf->begin || end>cf->end)
      return NULL;
   
   newcf = _AL_MALLOC(sizeof *newcf);

   if (!newcf)
      return NULL;

   newcf->begin = begin;
   newcf->end = end;
   newcf->next = NULL;
   num = end - begin;

   gl = newcf->bitmaps = _AL_MALLOC(num * sizeof *gl);
   for (c=0; c<num; c++) {
      g = cf->bitmaps[begin - cf->begin + c];
      gl[c] = create_bitmap_ex(bitmap_color_depth(g), g->w, g->h);
      int y;
      for (y = 0; y < g->h; y++){
          memcpy(gl[c]->line[y], g->line[y], g->w);
      }
      //blit(g, gl[c], 0, 0, 0, 0, g->w, g->h);
   }

   return newcf;
}
Пример #6
0
Alleg4Surface::Alleg4Surface(int width, int height, int bpp, DestroyFlag destroy)
  : m_bmp(create_bitmap_ex(bpp, width, height))
  , m_destroy(destroy)
  , m_lock(0)
{
  saveClip();
}
Пример #7
0
/* save_bitmap_state:
 *  Remember everything important about a screen bitmap.
 *
 *  Note: this must run even for SWITCH_BACKAMNESIA.  With the fbcon driver,
 *  writes to the screen would still show up while we are switched away.
 *  So we let this function run to redirect the screen to a memory bitmap while
 *  we are switched away.  We also let this run for SWITCH_AMNESIA just for
 *  consistency.
 */
static void save_bitmap_state(BITMAP_INFORMATION *info, int switch_mode)
{
   int copy;

   info->other = create_bitmap_ex(bitmap_color_depth(info->bmp), info->bmp->w, info->bmp->h);
   if (!info->other)
      return;

   copy = (switch_mode != SWITCH_AMNESIA) && (switch_mode != SWITCH_BACKAMNESIA);
   fudge_bitmap(info->bmp, info->other, copy);
   info->blit_on_restore = copy;

   info->acquire = info->other->vtable->acquire;
   info->release = info->other->vtable->release;

   info->other->vtable->acquire = info->bmp->vtable->acquire;
   info->other->vtable->release = info->bmp->vtable->release;

   #define INTERESTING_ID_BITS   (BMP_ID_VIDEO | BMP_ID_SYSTEM | \
				  BMP_ID_SUB | BMP_ID_MASK)

   info->other->id = (info->bmp->id & INTERESTING_ID_BITS) | 
		     (info->other->id & ~INTERESTING_ID_BITS);

   swap_bitmap_contents(info->bmp, info->other);
}
Пример #8
0
void init()
{
 allegro_init();

 set_color_depth(32);
 if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, GFX_W, GFX_H, 0, 0))
  {
   allegro_message("Error: %s.", allegro_error);
   exit(1);
  }

 install_keyboard();
 install_mouse();

 buffer = create_bitmap(SCREEN_W, SCREEN_H);
 zbuffer = create_bitmap_ex(32, SCREEN_W, SCREEN_H);
 texture = load_bitmap("data/wall.bmp", NULL);
 skin = load_bitmap("data/babe_skin.bmp", NULL);
 texture2 = load_bitmap("data/color.bmp", NULL);

 setup_projection(90.0, -1.333, 1.333, -1.0, 1.0, -1.0, 200.0);
 init_renderer(GFX_H);
 bind_color_buffer(buffer);
 bind_zbuffer(zbuffer);
 bind_texture(texture);
}
Пример #9
0
GameOver::GameOver(LinkClass& l):
    counter(0),
    link(l),
    subscrbmp(create_bitmap_ex(8, framebuf->w, framebuf->h))
{
    
}
Пример #10
0
// Does not account for converting luminance...
BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal)
{
	BITMAP *Bitmap;
	ILimage *TempImage;
	ILuint i = 0, j = 0;

	ilutCurImage = ilGetCurImage();

	if (ilutCurImage == NULL) {
		ilSetError(ILUT_ILLEGAL_OPERATION);
		return NULL;
	}

	// Should be IL_BGR(A), but Djgpp screws up somewhere along the line.
	if (ilutCurImage->Format == IL_RGB || ilutCurImage->Format == IL_RGBA) {
		iluSwapColours();
	}

	if (ilutCurImage->Origin == IL_ORIGIN_LOWER_LEFT)
		iluFlipImage();
	if (ilutCurImage->Type > IL_UNSIGNED_BYTE) {}  // Can't do anything about this right now...
	if (ilutCurImage->Type == IL_BYTE) {}  // Can't do anything about this right now...

	Bitmap = create_bitmap_ex(ilutCurImage->Bpp * 8, ilutCurImage->Width, ilutCurImage->Height);
	if (Bitmap == NULL) {
		return IL_FALSE;
	}
	memcpy(Bitmap->dat, ilutCurImage->Data, ilutCurImage->SizeOfData);

	// Should we make this toggleable?
	if (ilutCurImage->Bpp == 8 && ilutCurImage->Pal.PalType != IL_PAL_NONE) {
		// Use the image's palette if there is one

		// ilConvertPal is destructive to the original image
		// @TODO:  Use new ilCopyPal!!!
		TempImage = ilNewImage(ilutCurImage->Width, ilutCurImage->Height, ilutCurImage->Depth, ilutCurImage->Bpp, 1);
		ilCopyImageAttr(TempImage, ilutCurImage);
		ilSetCurImage(TempImage);

		if (!ilConvertPal(IL_PAL_RGB24)) {
			destroy_bitmap(Bitmap);
			ilSetError(ILUT_ILLEGAL_OPERATION);
			return NULL;
		}

		for (; i < ilutCurImage->Pal.PalSize && i < 768; i += 3, j++) {
			Pal[j].r = TempImage->Pal.Palette[i+0];
			Pal[j].g = TempImage->Pal.Palette[i+1];
			Pal[j].b = TempImage->Pal.Palette[i+2];
			Pal[j].filler = 255;
		}

		ilCloseImage(TempImage);
		ilSetCurImage(ilutCurImage);
	}

	return Bitmap;
}
Пример #11
0
void window_sub::resize_sub_buffer(coord_int w, coord_int h)
{
  if (sub_buffer) destroy_bitmap(sub_buffer);

  sub_buffer = create_bitmap_ex(bitmap_color_depth(get_master()->get_buffer()), w+1, h+1);     
  Assert(sub_buffer, "Error allocating new sub-buffer for window " << this);

  update_sub();
}
Пример #12
0
void EditboxScriptView::init()
{
    EditboxNoWrapView::init();
    bottomarrow_y-=16;
    area_height-=16;
    leftarrow_y-=16;
    rightarrow_y-=16;
    linetext = create_bitmap_ex(8,host->w,16);
}
Пример #13
0
void TMainCaptureForm::SetToVideoMode() {

		Caption = "Four Channel Video stream: video camera";
		MainCaptureForm->Caption = UnicodeString("Video Stream, version ") + getVersion();

		allegro_init();
		set_gdi_color_format();
		set_color_depth(CDEPTH);
		bmpCanvas = create_bitmap_ex(CDEPTH,tPanel->Width,tPanel->Height);
		bmpCanvas1 = create_bitmap_ex(CDEPTH,tPanel1->Width,tPanel1->Height);
		bmpCanvas2 = create_bitmap_ex(CDEPTH,tPanel2->Width,tPanel2->Height);
		bmpCanvas3 = create_bitmap_ex(CDEPTH,tPanel3->Width,tPanel3->Height);

		clear_bitmap(bmpCanvas);
		clear_bitmap(bmpCanvas1);
		clear_bitmap(bmpCanvas2);
		clear_bitmap(bmpCanvas3);
}
void VideoManager::initialize()
{
	reset();
	apeg_ignore_audio(true);

	frameData = create_bitmap_ex(32, 320, 192);
	clear_to_color(frameData, 0);
	videoBuffer = NULL;
}
Пример #15
0
AMesaBuffer GLAPIENTRY AMesaCreateBuffer(AMesaVisual visual, BITMAP* bmp)
{
	AMesaBuffer buffer;

	/* Buffer and visual must share the same color depth */
	if (bitmap_color_depth(bmp) != visual->Depth)
		return NULL;

	buffer = (AMesaBuffer) malloc(sizeof(struct amesa_buffer));
	if (!buffer)
		return NULL;

	buffer->FrontBuffer    = bmp;
	buffer->BackBuffer     = NULL;
	buffer->Active         = NULL;
	buffer->ReadActive     = NULL;
	buffer->DepthBuffer    = NULL;

	if (visual->DBFlag) {
		buffer->BackBuffer = create_bitmap_ex(visual->Depth, bmp->w, bmp->h);
		if (!buffer->BackBuffer) {
			free(buffer);
			return NULL;
		}
	}
	
	if (visual->GLVisual->depthBits > 0) {
		buffer->DepthBuffer = create_zbuffer(bmp);
		if (!buffer->DepthBuffer) {
			if (buffer->BackBuffer)
				destroy_bitmap(buffer->BackBuffer);
			free(buffer);
			return NULL;
		}
		set_zbuffer(buffer->DepthBuffer);
	}

	buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual,
                         0,   				    /*depth buffer is handled by Allegro */
                         visual->GLVisual->stencilBits > 0, /*software stencil buffer*/
                         visual->GLVisual->accumRedBits > 0,/*software accum buffer*/
                         GL_FALSE ); /*software alpha buffer*/

	if (!buffer->GLBuffer) {
		if (buffer->BackBuffer)
			destroy_bitmap(buffer->BackBuffer);
		if (buffer->DepthBuffer)
			destroy_zbuffer(buffer->DepthBuffer);
		free(buffer);
      		return NULL;
	}

	buffer->Width  = bmp->w;
	buffer->Height = bmp->h;

	return buffer;
}
Пример #16
0
/* Renders the next frame in a GIF animation to the specified bitmap and
 * the given position. You need to call this in order on the same
 * destination for frames [0..gif->frames_count - 1] to properly render all
 * the frames in the GIF.
 */
void
algif_render_frame (GIF_ANIMATION *gif, BITMAP *bitmap, int frame, int xpos,
                    int ypos)
{
    int x, y, w, h;
    GIF_FRAME *f = &gif->frames[frame];
    GIF_PALETTE *pal;
    if (frame == 0)
        rectfill (bitmap, xpos, ypos, xpos + gif->width - 1,
              ypos + gif->height - 1, bitmap_mask_color (bitmap));
    else
    {
        GIF_FRAME *p = &gif->frames[frame - 1];
        if (p->disposal_method == 2)
            rectfill (bitmap, xpos + p->xoff, ypos + p->yoff,
                xpos + p->xoff + p->bitmap_8_bit->w - 1,
                ypos + p->yoff + p->bitmap_8_bit->h - 1,
                bitmap_mask_color (bitmap));
        else if (p->disposal_method == 3 && gif->store)
        {
            blit (gif->store, bitmap, 0, 0, xpos + p->xoff, ypos + p->yoff,
                gif->store->w, gif->store->h);
            destroy_bitmap (gif->store);
            gif->store = NULL;
        }
    }
    w = f->bitmap_8_bit->w;
    h = f->bitmap_8_bit->h;
    if (f->disposal_method == 3)
    {
        if (gif->store)
            destroy_bitmap (gif->store);
        gif->store = create_bitmap_ex (bitmap_color_depth (bitmap), w, h);
        blit (bitmap, gif->store, xpos + f->xoff, ypos + f->yoff, 0, 0, w, h);
    }
    pal = &gif->frames[frame].palette;
    if (pal->colors_count == 0)
        pal = &gif->palette;

    //int i;
    //for (i = 0; i < pal->colors_count; i++)
    //    printf("%d: %d %d %d\n", i, pal->colors[i].r, pal->colors[i].g, pal->colors[i].b);

    for (y = 0; y < h; y++)
    {
        for (x = 0; x < w; x++)
        {
            int c = getpixel (f->bitmap_8_bit, x, y);
            if (c != f->transparent_index)
            {
                putpixel (bitmap, xpos + f->xoff + x, ypos + f->yoff + y,
                          get_rgbcolor (&pal->colors[c]));
            }
        }
    }
}
Пример #17
0
ZRadar::ZRadar(BITMAP *BlankSlate, Presence *target, double Size)
{
	STACKTRACE;
	Blank=BlankSlate;
	Painted = create_bitmap_ex(bitmap_color_depth(screen),Blank->w,Blank->h);
	t=target;
	size=Size;
	active=TRUE;
	set_depth(DEPTH_STARS + 0.1);
}
Пример #18
0
void BasicEditboxView::createStripBitmap(list<LineData>::iterator it, int width)
{
   //now create the bitmap
    int textheight = text_height(textfont);
  if(it->strip)
    destroy_bitmap(it->strip);
  it->strip = create_bitmap_ex(8,width,textheight);
  rectfill(it->strip, 0,0,width, textheight, bgcolor);
    Unicode::textout_ex_nonstupid(it->strip, textfont, (*it).line, 0, 0, fgcolor, bgcolor);
}
Пример #19
0
void    Init_Games (void)
{
    game_running = GAME_RUNNING_NONE;
    slow_down_game = 0;
    games_bmp = create_bitmap_ex(16, 256, 192);
    BreakOut_Init ();
    Tetris_Init ();
    BrainWash_Init ();
    Pong_Init ();
}
Пример #20
0
void masked_image::load(BITMAP* bmp)
{
  if (image) destroy_bitmap(image);
  
  if (bmp)
  {
    image = create_bitmap_ex(bitmap_color_depth(bmp), bmp->w, bmp->h);
    if (image) blit(bmp, image, 0, 0, 0, 0, bmp->w, bmp->h);
  }  
}
Пример #21
0
//Create the stream sample which will be used to call updates on the video
HRESULT InitRenderToSurface() {

    HRESULT hr;
    DDSURFACEDESC	ddsd;

    //Use the multimedia stream to get the primary video media stream
    hr = g_pMMStream->GetMediaStream(MSPID_PrimaryVideo, &g_pPrimaryVidStream);
    if (FAILED(hr)) {
        strcpy (lastError, "MMStream::GetMediaStream failed to create the primary video stream.");
        return E_FAIL;
    }

    //Use the media stream to get the IDirectDrawMediaStream
    hr = g_pPrimaryVidStream->QueryInterface(IID_IDirectDrawMediaStream, (void **)&g_pDDStream);
    if (FAILED(hr)) {
        strcpy(lastError, "The video stream does not support the IDirectDrawMediaStream interface; ensure you have the latest DirectX version installed.");
        return E_FAIL;
    }

    //Must set dwSize before calling GetFormat
    ddsd.dwSize = sizeof(ddsd);
    hr = g_pDDStream->GetFormat(&ddsd, NULL, NULL, NULL);
    if (FAILED(hr)) {
        strcpy(lastError, "IDirectDrawMediaStream::GetFormat failed");
        return E_FAIL;
    }

    RECT rect;
    rect.top = rect.left = 0;
    // these are the width and height of the video
    rect.bottom = ddsd.dwHeight;
    rect.right = ddsd.dwWidth;

    if (vscreen == NULL)
        vscreen = gfx_directx_create_system_bitmap(ddsd.dwWidth, ddsd.dwHeight);

    if (vscreen == NULL) {
        strcpy(lastError, "Unable to create the DX Video System Bitmap");
        return E_FAIL;
    }

    vsMemory = create_bitmap_ex(bitmap_color_depth(vscreen), vscreen->w, vscreen->h);

    IDirectDrawSurface *g_pDDSOffscreen;
    g_pDDSOffscreen = get_bitmap_surface (vscreen);

    //Create the stream sample
    hr = g_pDDStream->CreateSample(g_pDDSOffscreen, &rect, 0, &g_pSample);
    if (FAILED(hr)) {
        strcpy (lastError, "VideoStream::CreateSample failed");
        return E_FAIL;
    }

    return NOERROR;
}
Пример #22
0
void EditboxVScrollView::drawExtraComponents()
{
    int textheight = text_height(textfont);
    //draw the scrollbar
    draw_arrow_button(dbuf, toparrow_x-host->x, toparrow_y-host->y, 16, 16, true, toparrow_state*3);
    draw_arrow_button(dbuf, bottomarrow_x-host->x, bottomarrow_y-host->y, 16, 16, false, bottomarrow_state*3);
    
    if(!sbarpattern)
    {
        sbarpattern = create_bitmap_ex(bitmap_color_depth(screen),2,2);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
    }
    
    drawing_mode(DRAW_MODE_COPY_PATTERN, sbarpattern, 0, 0);
    int barstart = toparrow_y + 16 - host->y;
    int barend = bottomarrow_y - host->y-1;
    
    if(barstart < barend)
        rectfill(dbuf, toparrow_x-host->x, barstart, toparrow_x-host->x+15, barend, 0);
        
    solid_mode();
    //compute the bar button, based on view_y
    int totallen = (int)model->getLines().size()*textheight;
    int available = bottomarrow_y-(toparrow_y+16);
    
    if(available < 0)
    {
        baroff=barlen=0;
    }
    
    else
    {
        //area_height:totallen = barlen:available
        barlen = (available*area_height)/zc_max(totallen,area_height)+1;
        //clip to reasonable values
        barlen = zc_max(barlen, 8);
        baroff = zc_min(baroff, available-barlen);
        
        //view_y:(totallen-area_height) = baroff:(available-barlen)
        if(totallen <= area_height)
            baroff=0;
        else
            baroff = ((available-barlen)*view_y)/(totallen-area_height);
            
    }
    
    if(barlen > 0)
    {
        jwin_draw_button(dbuf, toparrow_x-host->x, toparrow_y+16-host->y+baroff, 16, barlen, false, 1);
    }
}
Пример #23
0
masked_image::masked_image(BITMAP* bmp)
: image(0)
{
  set_flag(sys_always_resize);

  if (bmp)
  {
    image = create_bitmap_ex(bitmap_color_depth(bmp), bmp->w, bmp->h);
    if (image) blit(bmp, image, 0, 0, 0, 0, bmp->w, bmp->h);
  }
}
Пример #24
0
/* import_bitmap_font_color:
 *  Helper for import_bitmap_font, below.
 */
static int import_bitmap_font_color(BITMAP** bits, int num)
{
  int w = 1, h = 1, i;

  for(i = 0; i < num; i++) {
    if(w > 0 && h > 0) datedit_find_character(import_bmp, &import_x, &import_y, &w, &h);
    if(w <= 0 || h <= 0) {
      bits[i] = create_bitmap_ex(8, 8, 8);
      if(!bits[i]) return -1;
      clear_to_color(bits[i], 255);
    } else {
      bits[i] = create_bitmap_ex(8, w, h);
      if(!bits[i]) return -1;
      blit(import_bmp, bits[i], import_x + 1, import_y + 1, 0, 0, w, h);
      import_x += w;
    }
  }

  return 0;
}
Пример #25
0
void window_master::pre_load()
{ 
  if (buffer_depth == 0) 
  {
    buffer = screen;
  } else
  {
    buffer = create_bitmap_ex(buffer_depth, w()+1, h()+1);
    clear(buffer);
  }
  theme.load();
}      
Пример #26
0
/* do_open_fli:
 *  Worker function used by open_fli() and open_memory_fli().
 */
static int do_open_fli(void)
{
   long speed;

   /* read the header */
   if (_fli_read_header(&fli_header) != 0) {
      close_fli();
      return FLI_ERROR;
   }

   /* check magic numbers */
   if (((fli_header.bits_a_pixel != 8) && (fli_header.bits_a_pixel != 0)) ||
       ((fli_header.type != FLI_MAGIC1) && (fli_header.type != FLI_MAGIC2))) {
      close_fli();
      return FLI_ERROR;
   }

   if (fli_header.width == 0)
      fli_header.width = 320;

   if (fli_header.height == 0)
      fli_header.height = 200;

   /* create the frame bitmap */
   fli_bitmap = create_bitmap_ex(8, fli_header.width, fli_header.height);
   if (!fli_bitmap) {
      close_fli();
      return FLI_ERROR;
   }

   reset_fli_variables();
   fli_frame = 0;
   fli_timer = 2;
   fli_status = FLI_OK;

   /* install the timer handler */
   LOCK_VARIABLE(fli_timer);
   LOCK_FUNCTION(fli_timer_callback);

   if (fli_header.type == FLI_MAGIC1)
      speed = BPS_TO_TIMER(70) * (long)fli_header.speed;
   else
      speed = MSEC_TO_TIMER((long)fli_header.speed);

   if (speed == 0)
      speed = BPS_TO_TIMER(70);

   install_int_ex(fli_timer_callback, speed);

   return fli_status;
}
Пример #27
0
BITMAP *clone_bitmap(int bpp, BITMAP *src, double scale, bool vidmem)
{
	BITMAP *dest, *convert;

	if ( !src )
		return 0;

	int W, H;

	W = iround( src->w * scale );
	H = iround( src->h * scale );

	dest = create_bitmap_ex(bpp, W, H);

	convert = create_bitmap_ex(bpp, src->w, src->h);
								 // use this to convert color depth
	blit(src, convert, 0, 0, 0, 0, src->w, src->h);

	if (W != src->w || H != src->h )
		stretch_blit(convert, dest, 0, 0, convert->w, convert->h, 0, 0, dest->w, dest->h);
	else
		blit(convert, dest, 0, 0, 0, 0, W, H);

	del_bitmap(&convert);

	// try to store this in memory, if there's enough room for it
	// cause the menu-bitmaps are pretty large, and take lotsa time to draw ...
	if (vidmem) {
		convert = create_video_bitmap(W, H);
		if (convert) {
			blit(dest, convert, 0, 0, 0, 0, W, H);
			del_bitmap(&dest);
			dest = convert;
		}
	}

	return dest;
}
Пример #28
0
bool Bitmap::Create(int width, int height, int color_depth)
{
    Destroy();
    if (color_depth)
    {
        _alBitmap = create_bitmap_ex(color_depth, width, height);
    }
    else
    {
        _alBitmap = create_bitmap(width, height);
    }
    _isDataOwner = true;
    return _alBitmap != nullptr;
}
Пример #29
0
AreaTablet::AreaTablet(TWindow *menu, const char *identbranch, int asciicode, bool akeepkey)
:
Area(menu, identbranch, asciicode, akeepkey)
{
	STACKTRACE;

	//init_pos_size(&backgr, "backgr");

	if (size.x != 0)
		drawarea = create_bitmap_ex(bitmap_color_depth(mainwindow->drawarea), iround(size.x), iround(size.y));
	else
		drawarea = 0;

}
Пример #30
0
void EditboxView::initialize(EditboxModel *new_model)
{
  model = new_model;
  //add a "ghost newline" to the buffer if necessary

  string nl = "";
  Unicode::insertAtIndex(nl,'\n',0);
  unsigned int nlsize = (unsigned int)nl.size();
  if(model->getBuffer().size() < nlsize || model->getBuffer().substr(model->getBuffer().size()-nlsize,nlsize) != nl)
    model->getBuffer() += nl;
  dbuf = create_bitmap_ex(8, host->w, host->h);
  init();
  update();
}