Exemplo n.º 1
0
result RoundedAvatar::OnDraw(void) {
	result r = E_SUCCESS;
	Canvas * pCanvas = GetCanvasN();

	if (pCanvas != null) {

		if (pAvatar != null) {
			r = pCanvas->DrawBitmap(pCanvas->GetBounds(), *pAvatar);
		} else {
			r = pCanvas->DrawBitmap(pCanvas->GetBounds(), *pAvatarPlaceholder);
		}

		r = pCanvas->DrawBitmap(pCanvas->GetBounds(), *pAvatarRounding);

		TryCatch(r == E_SUCCESS, , "Failed DrawBitmap pAvatarRounding");

		delete pCanvas;
	}

	return r;

CATCH:
    AppLogException("$${Function:OnDraw} is failed.", GetErrorMessage(r));
    delete pCanvas;
    return r;
}
result ItemForm::OnDraw(void) {
	result r = E_SUCCESS;

	Canvas* pCanvas = GetCanvasN();
	Rectangle rt = pCanvas->GetBounds();

	Application * app = Application::GetInstance();
	AppResource * res = app->GetAppResource();
	Bitmap * pBitmap = res->GetBitmapN(L"form_bg.png", BITMAP_PIXEL_FORMAT_ARGB8888);
	pCanvas->DrawBitmap(rt, *pBitmap);
	delete pBitmap;
	delete pCanvas;

	return r;

}
result
CameraOverlayPanel::OnDraw(void) {
	Canvas * pCanvas = GetCanvasN();
	pCanvas->Clear();

	if (bgbmp != null) {
		pCanvas->DrawBitmap(bgbmpsizedest, *bgbmp, bgbmpsizesrc);
	}

	pCanvas->FillRectangle(Color(0,0,0,100), Rectangle(0, 420, 800, 60));
	if (ftype == LEFTCAP) {
		drawingclass_->FDrawTextToCanvas(pCanvas, Rectangle(0,420,800,60), L"Left eye capture", 28, Osp::Graphics::FONT_STYLE_BOLD, false, Color::COLOR_RED, Osp::Graphics::TEXT_ALIGNMENT_CENTER, Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
		pCanvas->SetForegroundColor(Color::COLOR_RED);
	} else if (ftype == RIGHTCAP) {
		drawingclass_->FDrawTextToCanvas(pCanvas, Rectangle(0,420,800,60), L"Right eye capture", 28, Osp::Graphics::FONT_STYLE_BOLD, false, Color::COLOR_BLUE, Osp::Graphics::TEXT_ALIGNMENT_CENTER, Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
		pCanvas->SetForegroundColor(Color::COLOR_BLUE);
	} else if (ftype == ALIGN) {
		drawingclass_->FDrawTextToCanvas(pCanvas, Rectangle(0,420,800,60), L"Alignment", 28, Osp::Graphics::FONT_STYLE_BOLD, false, Color::COLOR_GREEN, Osp::Graphics::TEXT_ALIGNMENT_CENTER, Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
		pCanvas->SetForegroundColor(Color::COLOR_GREEN);
	} else if (ftype == PAUSE) {
		drawingclass_->FDrawTextToCanvas(pCanvas, Rectangle(0,420,800,60), L"Paused [resume in 2 sec]", 28, Osp::Graphics::FONT_STYLE_BOLD, false, Color::COLOR_GREEN, Osp::Graphics::TEXT_ALIGNMENT_CENTER, Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
		pCanvas->SetForegroundColor(Color::COLOR_RED);
	}
	if ((ftype == LEFTCAP) || (ftype == RIGHTCAP)) {
	pCanvas->SetLineWidth(2);
	/*int boxw = 200;
	int boxh = 120;*/
	int boxw2 = 100;
	int boxh2 = 60;
	int gapw = 50;
	int gaph = 30;
	//top left corner
	pCanvas->DrawLine(Point(400-boxw2,240-boxh2), Point(400-boxw2+gapw, 240-boxh2));
	pCanvas->DrawLine(Point(400-boxw2,240-boxh2), Point(400-boxw2, 240-boxh2+gaph));
	//top right corner
	pCanvas->DrawLine(Point(400+boxw2-gapw,240-boxh2), Point(400+boxw2, 240-boxh2));
	pCanvas->DrawLine(Point(400+boxw2,240-boxh2), Point(400+boxw2, 240-boxh2+gaph));
	//bottom left corner
	pCanvas->DrawLine(Point(400-boxw2,240+boxh2), Point(400-boxw2+gapw, 240+boxh2));
	pCanvas->DrawLine(Point(400-boxw2,240+boxh2), Point(400-boxw2, 240+boxh2-gaph));
	//bottom right corner
	pCanvas->DrawLine(Point(400+boxw2-gapw,240+boxh2), Point(400+boxw2, 240+boxh2));
	pCanvas->DrawLine(Point(400+boxw2,240+boxh2), Point(400+boxw2, 240+boxh2-gaph));
	}
	delete pCanvas;
	return E_SUCCESS;
}
Exemplo n.º 4
0
result
CropForm::OnDraw(void)
{
	Canvas *pCanvas = null;
	pCanvas = GetCanvasN();
	if(!pCanvas)
		return GetLastResult();

	if (__pBitmapOriginal)
	{
		pCanvas->Clear();
		pCanvas->DrawBitmap(GetClientAreaBounds(), *__pBitmapOriginal);

		pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_BLACK));
		pCanvas->SetLineWidth(5);
		pCanvas->SetLineStyle(LINE_STYLE_SOLID);
		if(__Croprectangle.width > 0)
			pCanvas->DrawRectangle(__Croprectangle);
	}

	delete pCanvas;
	return E_SUCCESS;
}
Exemplo n.º 5
0
result BaseWordForm::OnDraw(void)
{
	result r = Form::OnDraw();
	Rectangle bound = GetBounds();
	Canvas * canvas = GetCanvasN(bound);

	if (!__pBGLogo)
		__pBGLogo = Utils::GetBitmapN("bg_logo.png");

	int x = bound.width / 2 - (__pBGLogo->GetWidth() / 2);
	int y = bound.height - __pBGLogo->GetHeight() - 15;

	Footer * footer = GetFooter();
	if (footer)
	{
		y -= footer->GetHeight();
	}

	canvas->DrawBitmap(Point(x, y), *__pBGLogo);

	delete canvas;

	return r;
}
Exemplo n.º 6
0
result
EditPanel::OnDraw()
{
	int i;
	Rectangle *tmp_rect;
	Rectangle *tmp_rect2;
	String	  *tmp_string;
	Boolean	  *tmp_highlight;
	Integer	  *tmp_int;
	String	  *tmp_insert_str;
	Integer   *tmp_check;
	Point	*tmp_point;
	Font font;
	String	  *tmp_string2;


    font.Construct(FONT_STYLE_PLAIN, 30);

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();

	Canvas *pCanvas = this->GetCanvasN();
	pCanvas->SetFont(font);


	//pCanvas->DrawBitmap(Rectangle(0,0,this->GetWidth(), 855), *(pAppResource->GetBitmapN(L"EditPanel_background.png")));
	//pCanvas->FillRectangle(Color(246,246,246,255), Rectangle(0,0,this->GetWidth(), tmp_client_rect.height-497));
	//pCanvas->FillRectangle(Color(255,255,255,255), Rectangle(0,0,this->GetWidth()-60, tmp_client_rect.height));

	for(i=0; i<arr_text_element.GetCount(); i++)
	{
		tmp_rect = static_cast< Rectangle* > (arr_text_element_rect.GetAt(i));
		tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
		tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i));
		tmp_int = static_cast< Integer *> (arr_text_element_editing_mark.GetAt(i));
		tmp_check = static_cast< Integer *> (arr_insert_check.GetAt(i));
		tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i));
		tmp_point = static_cast< Point *> (arr_binding_start_and_end.GetAt(i));
		tmp_rect2 = static_cast< Rectangle* > (arr_memo_rect.GetAt(i));
		tmp_string2 = static_cast< String *> (arr_memo.GetAt(i));
/*		if(tmp_rect->height < 0 || tmp_rect->y > tmp_client_rect.height-497)
		{

		}
		else*/
		{
			if(tmp_point->x < 1000)
			{
				pCanvas->FillRectangle(Color(255,248,209,255),Rectangle(*tmp_rect));
				if(tmp_string2->GetLength() > 1)
				{

					pCanvas->FillRectangle(Color(240,200,209,255),Rectangle(*tmp_rect2));
				}
			}

			if(tmp_highlight->ToBool() == true)
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string, Color(0,255,0,150));
			}
			else
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string);
			}



			if(tmp_int->value == 2)
			{

				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,187,237,255));

			}
			if(tmp_int->value == 3)
			{
				pCanvas->FillRectangle(Color(0,187,237,200), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				//pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,0));
			}
			else if(tmp_int->value == 1)
			{
				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
			}
			else if(tmp_check->value == 1)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 2)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 3)
			{
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			pCanvas->DrawRectangle(*tmp_rect);
		}
	}

	if(onHighlightStart == true)
	{
		pCanvas->FillRectangle(Color(100,100,255,255), cur_start_rect);
		pCanvas->FillRectangle(Color(100,100,255,255), cur_end_rect);
	}


}