Esempio n. 1
0
void CSSselector::attribute(std::string name1, std::string comparision, std::string name2) {
	int group = 0;
	int connected = 0;

	// Check previous tag to see if it applies to this one.
	if (tagContainer.size() != 0){
		group = tagContainer.back().getTagGroup() + 1;
		connected = tagContainer.back().getTagType();
	}

	// Open attribute
	CSStag::setTag(4, group, connected, "");
	CSStag::setTagExtend(1);
	insertSelector();
	clearTag();

	// Create combinator element
	combinator(name1, comparision, name2);

	// Close attribute
	CSStag::setTag(5, group, connected, "");
	CSStag::setTagExtend(1);
	insertSelector();
	clearTag();
}
/**
 * \brief Combine image, mask and center into a color image
 */
ImagePtr	VCurveFocusWork::combine(ImagePtr image, FWHMInfo& fwhminfo) {
	// first build the red channel from the mask
	Image<unsigned char>	*red
		= dynamic_cast<Image<unsigned char> *>(&*fwhminfo.mask);
	if (NULL == red) {
		throw std::logic_error("internal error, mask has not 8bit pixel type");
	}

	// then build the green channel from the original image
	Image<unsigned char>	*green = FocusWork::green(image);
	ImagePtr	greenptr(green);

	// create the blue image
	CrosshairAdapter<unsigned char>	crosshair(image->size(), fwhminfo.maxpoint, 20);
	CircleAdapter<unsigned char>	circle(image->size(), fwhminfo.center,
						fwhminfo.radius);
	MaxAdapter<unsigned char>	blue(crosshair, circle);

	// now use a combination adapter to put all these images together
	// into a single color image
	CombinationAdapter<unsigned char>	combinator(*red, *green, blue);
	Image<RGB<unsigned char> >	*result
		= new Image<RGB<unsigned char> >(combinator);

	return ImagePtr(result);
}