Ejemplo n.º 1
0
BImage::BImage(const BImage &other)
{
    myWidth = other.width();
    myHeight = other.height();
    pixels = new std::vector<bool>(*other.pixels);
//    for (int x=0; x<myWidth; x++)
//    {
////        (*pixels)[x] = new bPixel[myHeight];
//        for (int y=0; y<myHeight; y++)
//        {
//            (*pixels)[x+y*myWidth]= other.pixel(x,y);
//        }
//    }
    ownership=NULL;
}
BImage* BResourceManager::loadImage(const BString& name, const BString& path)
{
	if (this->_images.find(name) != _images.end())
	{
		return _images[name];
	}

	if (path == "")
		return NULL;

	BImage* image;

	image = BImage::create(name, path);
	_images[name] = image;
	image->load(path);
	return image;
}
Ejemplo n.º 3
0
void BImage::blt(BImage& source, int x_src, int y_src,
		 int x_dst, int y_dst, int x_size, int y_size){
  if(_data==NULL)
    return;

   int sx,sy,dx,dy ;
   int w = source.width() ;
   int h = source.height() ;
     
  for(int x=0;x<x_size;x++){
    for(int y=0;y<y_size;y++){
       sx = x_dst+x ;
       sy = y_dst+y ;
       dx = x_src+x ;
       dy = y_src+y ;
       
       if(sx < 0 || sy < 0 || sx >= _width || sy >= _height || dx < 0 || dy < 0 || dx >= w || dy >= h)
	 continue ;
       
      operator()(x_dst+x,y_dst+y)=source(x_src+x,y_src+y);
    }
  }
}