コード例 #1
0
ファイル: Dart.cpp プロジェクト: Azagthoth/KawaiiZombie
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;

}
コード例 #2
0
ファイル: ImageViewer.cpp プロジェクト: SciDev030/badaget
void
ImageViewer::SaveImage(void)
{
	if(savedPath.GetLength() != 0)
		return;						/*Already saved*/

	result res = E_SUCCESS;
	Image img;
	String fileName;
	int lastFileName = 0;
	String fileNameKey("AppLastSavedFileNum");
	AppRegistry *pAppRegistry = Application::GetInstance()->GetAppRegistry();

	res = pAppRegistry->Get(fileNameKey, lastFileName);
	if ( res == E_KEY_NOT_FOUND)
	{
		lastFileName = 1;
		pAppRegistry->Add(fileNameKey, lastFileName);
	}

	savedPath = L"/Media/Images/";
	savedPath += Application::GetInstance()->GetAppName();
	savedPath.Append(lastFileName);
	savedPath += ".jpg";

	img.Construct();
	res = img.EncodeToFile(*__pDisplayImage, IMG_FORMAT_JPG, savedPath, true);

	pAppRegistry->Set(fileNameKey, lastFileName + 1);

}
コード例 #3
0
ファイル: Utils.cpp プロジェクト: iRail/BeTrains.Bada
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;
}
コード例 #4
0
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;
}
コード例 #5
0
//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;
}
コード例 #6
0
ファイル: CropForm.cpp プロジェクト: CoCoTeam/TizenGameHub
void
CropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	if(actionId == ID_FOOTERITEMCROP)
	{

		__Croprectangle.x = __x_min ;
		__Croprectangle.y = __y_min ;
		__Croprectangle.width = __x_max - __x_min;
		__Croprectangle.height = __y_max - __y_min;

		if ((__Croprectangle.width <= 0) || (__Croprectangle.height <= 0))
		{
			MessageBox messageBox;
			messageBox.Construct(L"Noting to crop", L"Please select region using finger to crop.", MSGBOX_STYLE_OK, 3000);
			int modalResult = 0;
			messageBox.ShowAndWait(modalResult);
			return;
		}

		Bitmap *pBitmapCroped = new Bitmap();
		pBitmapCroped->Construct(*__pBitmapOriginal,__Croprectangle);
		Image img;
		result r = img.Construct();

		if(!IsFailed(r))
		{
			img.EncodeToFile(*pBitmapCroped, IMG_FORMAT_JPG, USER_CROPPED_FILE_PATH, true);

			AppLogDebug("Save_location : %S", USER_CROPPED_FILE_PATH.GetPointer());

			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
			if(pForm)
			{
				pFrame->SetCurrentForm(*pForm);
				pForm->SendUserEvent(CROPPING_COMPLETE, null);
				pForm->Draw();
				pForm->Show();
				pFrame->RemoveControl(*this);
			}
		}

		delete pBitmapCroped;
	}
}
コード例 #7
0
ファイル: CropForm.cpp プロジェクト: CoCoTeam/TizenGameHub
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();
}
コード例 #8
0
ファイル: JMChattControl.cpp プロジェクト: JunminLee/Winwin
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;
}