示例#1
0
void LLPanel::addBorder(LLViewBorder::Params p)
{
	removeBorder();
	p.rect = getLocalRect();

	mBorder = LLUICtrlFactory::create<LLViewBorder>(p);
	addChild( mBorder );
}
示例#2
0
void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
						LLViewBorder::EStyle border_style, S32 border_thickness)
{
	removeBorder();
	mBorder = new LLViewBorder( std::string("panel border"), 
								LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), 
								border_bevel, border_style, border_thickness );
	mBorder->setSaveToXML(false);
	addChild( mBorder );
}
示例#3
0
void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent)
{
	/////// Rect, follows, tool_tip, enabled, visible attributes ///////
	initFromXML(node, parent);

	/////// Border attributes ///////
	BOOL border = mBorder != NULL;
	node->getAttributeBOOL("border", border);
	if (border)
	{
		LLViewBorder::EBevel bevel_style = LLViewBorder::BEVEL_OUT;
		LLViewBorder::getBevelFromAttribute(node, bevel_style);

		LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE;
		std::string border_string;
		node->getAttributeString("border_style", border_string);
		LLStringUtil::toLower(border_string);

		if (border_string == "texture")
		{
			border_style = LLViewBorder::STYLE_TEXTURE;
		}

		S32 border_thickness = LLPANEL_BORDER_WIDTH;
		node->getAttributeS32("border_thickness", border_thickness);

		addBorder(bevel_style, border_style, border_thickness);
	}
	else
	{
		removeBorder();
	}

	/////// Background attributes ///////
	BOOL background_visible = mBgVisible;
	node->getAttributeBOOL("background_visible", background_visible);
	setBackgroundVisible(background_visible);
	
	BOOL background_opaque = mBgOpaque;
	node->getAttributeBOOL("background_opaque", background_opaque);
	setBackgroundOpaque(background_opaque);

	LLColor4 color;
	color = mBgColorOpaque;
	LLUICtrlFactory::getAttributeColor(node,"bg_opaque_color", color);
	setBackgroundColor(color);

	color = mBgColorAlpha;
	LLUICtrlFactory::getAttributeColor(node,"bg_alpha_color", color);
	setTransparentColor(color);

	std::string label = getLabel();
	node->getAttributeString("label", label);
	setLabel(label);
}
示例#4
0
void GameLayerMapBorder::suboutViewBorderCell()
{
    
    auto ip = _borderMap.begin();
    //auto end = _borderMap.end();
    while (ip!=_borderMap.end()) {
        GridCell cell = ip->first;
        ip++;
        if(cell._y < _mapGrid->_startHeight)removeBorder(cell);
    }
}
示例#5
0
文件: Window.cpp 项目: IMAN4K/QtPro
Window::Window(QApplication *app, const int &x, const int &y, const int &width, const int &height) {
	_hwnd =
		CreateWindow(
		registerWindow().c_str(),
		NULL,
		static_cast<DWORD>(Style::BorderLess),
		x, y, width, height,
		0, 0,
		(HINSTANCE)GetModuleHandle(0),
		NULL);
	if (!_hwnd) throw std::runtime_error("Failed To Create Window");

	SetWindowLongPtr(_hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));

	SetWindowPos(_hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);

	_app = app;

	setNcHeight(36);
	removeBorder();
	show();
}
示例#6
0
//Create a array of subrectangles (Mat) from each rectangle.
std::vector<std::vector<cv::Mat> > cutRect(const Image_data* src, const std::vector<Rect>& sq )
{    
    //Array to hold the solution
    std::vector<std::vector<cv::Mat> > subrect;
    subrect.clear();

    //Matrix's to extract the subrectangles
    cv::Mat rImage (src->rImage,false) , gImage (src->gImage,false) , bImage (src->bImage,false),img;
    if (DEBUG) img = cv::Mat(src->src,false);

    std::string file;

    //erode images
    //cv::erode(gImage, gImage, cv::Mat(), cv::Point(-1,-1),1); //standard call
    //cv::erode(bImage, bImage, cv::Mat(), cv::Point(-1,-1),1); //standard call

    //Cut and deskew squares
    for ( int i=0 ; i < sq.size() ; i++ ) 
    {
        //Submatrix to fill
        cv::Mat subimg_red, subimg_green , subimg_blue , subimg;

        //auxiliar vector to store the array of Mat
        std::vector<cv::Mat> aux;
        aux.clear();

        // get angle and size from the bounding box
        double angle = sq[i].bounding_box.angle;
        cv::Size box_size = sq[i].bounding_box.size;
        //adjust the angle from "http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/"
        if (angle < -45.) {
            angle += 90.;
            std::swap(box_size.width, box_size.height); // for cropping
        }

        //rotation
        if ( std::abs(angle) > LIMIT_ROTATION ) {
            
            // matrices we'll use
            cv::Mat rotatedR , rotatedG , rotatedB , rot_mat , rotated;
            
            //Rotation Matrix. Same rotation for all
            rot_mat = cv::getRotationMatrix2D(sq[i].bounding_box.center, angle, 1);
            
            //Apply transformation
            cv::warpAffine(rImage, rotatedR, rot_mat, rImage.size(), cv::INTER_LINEAR); // apply the geometric transformation
            cv::warpAffine(gImage, rotatedG, rot_mat, gImage.size(), cv::INTER_LINEAR);
            cv::warpAffine(bImage, rotatedB, rot_mat, bImage.size(), cv::INTER_LINEAR);//INTER_CUBIC
            if (DEBUG) cv::warpAffine(img   , rotated, rot_mat, img.size(), cv::INTER_LINEAR);
            
            //log
            if (DEBUG) {
                file = ANDROID_PATH + "cut_subimg_rot.jpeg";
                cv::imwrite(file,rotated);
            }

            //Cropped image
            cv::getRectSubPix(rotatedR, box_size, sq[i].bounding_box.center, subimg_red);
            cv::getRectSubPix(rotatedG, box_size, sq[i].bounding_box.center, subimg_green);
            cv::getRectSubPix(rotatedB, box_size, sq[i].bounding_box.center, subimg_blue);
            if (DEBUG) cv::getRectSubPix(rotated, box_size , sq[i].bounding_box.center, subimg);
            
            //log
            if (DEBUG) {
                file = ANDROID_PATH + "cut_subimg_crop.jpeg";
                cv::imwrite(file,subimg);
            }
            
        }
        else {//just cut it
            subimg_red   = rImage(sq[i].wrapper_box);
            subimg_green = gImage(sq[i].wrapper_box); 
            subimg_blue  = bImage(sq[i].wrapper_box);
            if (DEBUG) subimg       = img(sq[i].wrapper_box);
        }     
        
        //remove border of tag
        removeBorder(subimg_red);
        removeBorder(subimg_green);
        removeBorder(subimg_blue);
        if (DEBUG) removeBorder(subimg);

        //log
        if (DEBUG) {
            file = ANDROID_PATH + "cut_subimg_borderRemoved.jpeg";
            cv::imwrite(file,subimg);
        }

        //add subimages
        aux.push_back(subimg_red);//R
        aux.push_back(subimg_green);//G
        aux.push_back(subimg_blue);//B
        if (DEBUG) aux.push_back(subimg);//SRC

        subrect.push_back(aux);       
    }

    return subrect;
}