Beispiel #1
0
void ButtonView::_createItem() {
    AppLog("ButtonView::_createItem");
    if (myAction.isNull()) {
        return;
    }
  //  Bitmap *pBmp = myTab->form()->buttonBmp;
    Bitmap *pBmp = new Bitmap;
//    pBmp->Construct(Dimension(70,90), BITMAP_PIXEL_FORMAT_ARGB8888);
    pBmp->Construct(*myTab->form()->buttonBmp, Tizen::Graphics::Rectangle(0,0,300,52));
	ZLButtonOptionEntry &entry = (ZLButtonOptionEntry&)*myOption;
	//String str;// = "   Download Demo";
	//str.Format(25, L"Value %d ",entry.initialValue());
	//myAction->text()
	std::string text = myAction->text(ZLResource::resource("networkView")["bookNode"]);
	AppLog("Button text %s", text.c_str());
	String str;
	Tizen::Base::Utility::StringUtil::Utf8ToString(( const char *)text.c_str(), str);
	OptionListItem* pItem = new OptionListItem(this);
	pItem->Construct(75);
	pItem->SetItemFormat(*myTab->form()->__pButtonViewListItemFormat);
	pItem->SetElement(ID_LIST_BITMAP, *pBmp, pBmp);
	//pItem->SetElement(ID_LIST_TEXT_TITLE,String((ZLOptionView::name()).c_str()));
	pItem->SetElement(ID_LIST_TEXT_TITLE,String(text.c_str()));
	pItem->SetElement(ID_LIST_TEXT_SUBTITLE, String("Bay"));

	//pItem->SetCheckBox(ID_LIST_CHECKBOX);
	//pItem->SetElement(ID_FORMAT_CUSTOM, *(static_cast<ICustomListElement *>(__pListElement)));
	myTab->form()->__pCustomList->AddItem(myTab->form()->GroupCount-1, *pItem, ID_LIST_ITEM);
	AppLog("PictureView::_createItem() end");
}
Tizen::Ui::Controls::ListItemBase* AttackHelperProvider::CreateItem(int index, int itemWidth)
{
	int width = 0, height = 0;
	Tizen::Ui::Controls::CustomItem* pItem = new Tizen::Ui::Controls::CustomItem();
	AppAssert(pItem);
	pItem->Construct(Dimension(itemWidth, 150), Tizen::Ui::Controls::LIST_ANNEX_STYLE_NORMAL);
	pItem->SetBackgroundColor(Tizen::Ui::Controls::LIST_ITEM_DRAWING_STATUS_NORMAL, Color(0xDD, 0xDD, 0xDD));

	GHAttackhelperData *ahData = (GHAttackhelperData*)(list.GetAt(index));

	ByteBuffer *pBuffer = null;
	Bitmap *pBitmap = null;
	Tizen::Media::Image *pImage = new (std::nothrow) Tizen::Media::Image();
	pImage->Construct();
	pBuffer = pImage->DecodeToBufferN(Tizen::App::App::GetInstance()->GetAppRootPath()+L"res/profile_default.png", BITMAP_PIXEL_FORMAT_RGB565,width,height);
	pBitmap = new (std::nothrow) Bitmap();
	pBitmap->Construct(*pBuffer, Dimension(width, height),BITMAP_PIXEL_FORMAT_RGB565 );

	Color cBlack(0x00, 0x00, 0x00);
	String text(ahData->getSenderName() +"님이 " + ahData->getItemName());
	String text2(Integer::ToString(ahData->getQuantity()) +"개를 보냈습니다");

	pItem->AddElement(Rectangle(10, 15, 120, 120), 0, *pBitmap);
	pItem->AddElement(Rectangle(140, 10, 300, 70), 1, text, 40, cBlack, cBlack, cBlack);
	pItem->AddElement(Rectangle(140, 60, 300, 70), 2, text2, 40, cBlack, cBlack, cBlack);

	return pItem;
}
Osp::Graphics::Bitmap* DrawingClass::FDrawTextToBmpN(Osp::Graphics::Rectangle dim, Osp::Base::String text, int fontsize, Osp::Graphics::Color fontcolor) {
	Bitmap* pBitmap = new Bitmap;
	Canvas * pcanvas_ = new Canvas;
	pcanvas_->Construct(dim);
	this->FDrawTextToCanvas(pcanvas_, dim, text, fontsize, FONT_STYLE_PLAIN, true, fontcolor, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_MIDDLE);
	pBitmap->Construct(*pcanvas_, pcanvas_->GetBounds());
	delete pcanvas_;
	return pBitmap;
}
Osp::Graphics::Bitmap* DrawingClass::FDrawSpriteToBmpN(Osp::Graphics::Rectangle srcdim) {
	Bitmap* pBitmap = new Bitmap;
	Canvas * pcanvas_ = new Canvas;
	pcanvas_->Construct(Rectangle(0,0,srcdim.width,srcdim.height));
	this->FDrawSpriteToCanvas(pcanvas_, Rectangle(0,0,srcdim.width,srcdim.height), srcdim);
	pBitmap->Construct(*pcanvas_, pcanvas_->GetBounds());
	delete pcanvas_;
	return pBitmap;
}
Bitmap* TreeViewForm::makeIcon(Bitmap* srcBmp){
	Bitmap *pBmp = new Bitmap;
	pBmp->Construct(Dimension(iconRect.width, iconRect.height), BITMAP_PIXEL_FORMAT_ARGB8888);
	int imageWidth = srcBmp->GetWidth();
	int imageHeight = srcBmp->GetHeight();
	AppLog("makeIcon image w = %d, h = %d", imageWidth, imageHeight);
	int dy = (iconRect.height - imageHeight) / 2;
	int dx = (iconRect.width - imageWidth) / 2;
	if ((dy<0)||(dx<0)) {
		srcBmp->Scale(Dimension(iconRect.width, iconRect.height));
		pBmp->Merge(Point(0,0), *srcBmp, Rectangle(0,0,iconRect.width,iconRect.height));
	}
	else
		pBmp->Merge(Point(dx,dy), *srcBmp, Rectangle(0,0,imageWidth,imageHeight));
	return pBmp;
}
Beispiel #6
0
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;
	}
}
Beispiel #7
0
Osp::Graphics::Bitmap* FPlayer::CreateSpeedBtnBmp(int width, Osp::Base::String caption, bool selected) {
	Bitmap* pBitmap = new Bitmap;
	Canvas * pcanvas_ = new Canvas;
	pcanvas_->Construct(Rectangle(0,0,width,64));
	pcanvas_->FillRoundRectangle(Color(0,0,0,125),Rectangle(0,0,width,64),Dimension(32,32));
	drawingclass_->FDrawTextToCanvas(pcanvas_, Rectangle(10, 10, width - 20 - 64, 64 - 20), caption, 28, Osp::Graphics::FONT_STYLE_PLAIN, true, Color::COLOR_WHITE, Osp::Graphics::TEXT_ALIGNMENT_CENTER, Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
	if (selected == true) {
		drawingclass_->FDrawSpriteToCanvas(pcanvas_, Rectangle(width - 64, 0, 64, 64), Rectangle(866,196+64,64,64));
	} else {
		drawingclass_->FDrawSpriteToCanvas(pcanvas_, Rectangle(width - 64, 0, 64, 64), Rectangle(866,196,64,64));
	}
	drawingclass_->FDrawSpriteToCanvas(pcanvas_, Rectangle(width - 64 + 12, 12, 40, 40), Rectangle(1109,(9*40),40,40));

	pBitmap->Construct(*pcanvas_, pcanvas_->GetBounds());
	delete pcanvas_;
	return pBitmap;
}