Example #1
0
Osp::Graphics::Bitmap* Utils::GetBitmapN(const Osp::Base::String& name)
{
	Bitmap* pBitmap = null;
	Image* pImage = new Image();

	String fullname(L"/Res/");
	fullname.Append(name);

	pImage->Construct();
	//AppLogDebug("%S",fullname.GetPointer());
	if(fullname.EndsWith(L"jpg"))
	{
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_RGB565);
	}
	else if(fullname.EndsWith(L"bmp"))
	{
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_RGB565);
	}
	else if(fullname.EndsWith(L"png"))
	{
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_ARGB8888);
	}
	else if (fullname.EndsWith(L"gif"))
	{
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_RGB565);
	}
	delete pImage;

	return pBitmap;
}
Example #2
0
void Dart::Update(int delta)
{
	float distance = sqrt(pow(movementOffset.x, 2) + pow(movementOffset.y, 2));
	position->SetPosition(Point(position->x + movementOffset.x / distance * delta * DART_SPEED,
								position->y + movementOffset.y / distance * delta * DART_SPEED));
	ArrayList* zombies = WorldManager::Instance()->GetImagesByNameN(ZOMBIE);
	IEnumerator* pEnum = zombies->GetEnumeratorN();
	Zombie* zombie = null;
	bool found = false;
	while (pEnum->MoveNext() == E_SUCCESS && !found)
	{
		zombie = (Zombie*)pEnum->GetCurrent();
		Point offset = Point(position->x + ressource->GetWidth()/2 - zombie->position->x - zombie->ressource->GetWidth()/2, position->y + ressource->GetHeight()/2 - zombie->position->y - zombie->ressource->GetHeight()/2);
		float distance = sqrt(pow(offset.x, 2) + pow(offset.y, 2));
		if(distance < 50)
		{
			Image* bitmapDecoder = new Image();
			bitmapDecoder->Construct();
			WorldManager::Instance()->AddImage(new KImage(bitmapDecoder->DecodeN(L"/Home/Res/zombie_dead.png", BITMAP_PIXEL_FORMAT_ARGB8888), new Point(*(zombie->position)), ZOMBIE_DEAD));
			WorldManager::Instance()->DeleteImage(zombie);
			WorldManager::Instance()->DeleteImage(this);
			delete bitmapDecoder;
			found = true;
		}
	}

	delete pEnum;
	delete zombies;

}
Example #3
0
Tizen::Graphics::Bitmap*
JMChattControl::GetBitmapN(const Tizen::Base::String& name)
{
	Bitmap* pBitmap = null;
	Image* pImage = new Image();
	pImage->Construct();

	String fullname(L"");
	fullname.Append(name);

	if(fullname.EndsWith(L"png")) {
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_ARGB8888);
	}
	else {
		pBitmap = pImage->DecodeN(fullname, BITMAP_PIXEL_FORMAT_RGB565);
	}
	delete pImage;

	return pBitmap;
}
void BitmapLoader::OnUserEventReceivedN(RequestId requestId, IList *pArgs) {
	ICacheEntry *cacheEntry = static_cast<ICacheEntry *>(pArgs->GetAt(0));

	Image image;
	image.Construct();

	Bitmap *bitmap = image.DecodeN(cacheEntry->GetFile(), BITMAP_PIXEL_FORMAT_RGB565);
	if(GetLastResult() == E_SUCCESS) {
		cacheEntry->OnLoadingSuccess(bitmap);
	} else {
		cacheEntry->OnLoadingError();
	}

	delete pArgs;
}
//IGalleryItemProvider
Osp::Ui::Controls::GalleryItem* GalleryForm::CreateItem(int index) {

	String *imagePath = static_cast<String *>(pImagesPaths->GetAt(index));

	Image* pImage = new Image();
	pImage->Construct();
	Bitmap * pBitmap = pImage->DecodeN(*imagePath, BITMAP_PIXEL_FORMAT_ARGB8888);
	delete pImage;

	GalleryItem* pGalleryItem = new GalleryItem();
	pGalleryItem->Construct(*pBitmap, *imagePath);

	delete pBitmap;

	return pGalleryItem;
}
Example #6
0
void
CropForm::LoadImage(String *filename)
{
	__Croprectangle.x = __x_min ;
	__Croprectangle.y = __y_min ;
	__Croprectangle.width = __x_max-__x_min;
	__Croprectangle.height = __y_max-__y_min;

	int width = GetClientAreaBounds().width;
	int height = GetClientAreaBounds().height;

	Image img;
	img.Construct();

	__pBitmapOriginal = img.DecodeN(*filename, BITMAP_PIXEL_FORMAT_ARGB8888 , width, height);
	__pBitmapOriginal->Scale(Dimension(width, height));
	RequestRedraw();
}