コード例 #1
0
void Builder::drawListItemBullet(Layout &l, float parentPosY) {
	Layout *parent = nullptr;
	if (_layoutStack.size() > 1) {
		parent = _layoutStack.at(_layoutStack.size() - 1);
	}

	const auto density = _media.density;
	auto origin = Vec2(roundf(l.position.x * density), roundf((parentPosY) * density));
	FontStyle fStyle = l.node->getStyle().compileFontStyle(this);
	ParagraphStyle pStyle = l.node->getStyle().compileParagraphLayout(this);
	pStyle.textIndent.value = 0.0f; pStyle.textIndent.metric = style::Size::Metric::Px;
	auto baseFont = _fontSet->getLayout(fStyle)->getData();

	Label label;
	Formatter reader(getFontSet(), &label._format, _media.density);
	reader.setOpticalAlignment(false);
	initFormatter(l, pStyle, parentPosY, reader, true);

	if (parent && parent->listItem != Layout::ListNone) {
		TextStyle textStyle = l.node->getStyle().compileTextLayout(this);
		WideString str = getListItemString(parent, l);
		reader.read(fStyle, textStyle, str, 0, 0);
	}

	reader.finalize();
	float offset = fixLabelPagination(l, label);
	float finalHeight = reader.getHeight() / density + offset;
	float finalWidth = reader.getMaxLineX() / density;

	float x = 0, w = _media.surfaceSize.width;
	std::tie(x, w) = getFloatBounds(&l, origin.y / density, finalHeight);

	l.postObjects.emplace_back(Rect(x - l.position.x - finalWidth - pStyle.listOffset.computeValue(l.size.width, baseFont->metrics.height),
			origin.y / density - l.position.y, finalWidth, finalHeight), std::move(label));
}
コード例 #2
0
bool PresentationEngineManager::startDocument( const std::string &file ) {
	LDEBUG( "PresentationEngineManager", "Start document: doc=%s", file.c_str() );

	if (formatter()) {
		_sys->enqueue( boost::bind( &PresentationEngineManager::stopDocument, this ) );
		{ //	Wait for compare
			boost::unique_lock<boost::mutex> lock( _stopMutex );
			while (!_stopped) {
				_stopWakeup.wait( lock );
			}
			_stopped = false;
		}

	}

	//	Init settings module
	player::settings::init();

	initFormatter( file );
	if (!formatter()->parseDocument()) {
		LWARN( "PresentationEngineManager", "parseDocument fail" );
		return false;
	}

	//	Play formatter
	_sys->enqueue( boost::bind( &FormatterMediator::play, formatter() ) );

	return true;
}
コード例 #3
0
ValueTabView::ValueTabView(const QString& name, QWidget * parent)
    : controller(parent), formatter(AbstractFormatter::getFormatter()),
      currentCell(nullptr)
{    
    initLayout();

    initKeyName();
    keyName->setText(name);

    initFormatter();
}
コード例 #4
0
ファイル: Camera.cpp プロジェクト: MadBiceps/gmsl_driver
Camera::Camera(dwSensorHandle_t &sensor, dwSensorParams salParams, dwSALHandle_t sal, dwContextHandle_t sdk, ProgramArguments arguments,  bool record)
{
	// Init dwHandles
	this->sensor     = DW_NULL_HANDLE;
	streamer   = DW_NULL_HANDLE;
	serializer = DW_NULL_HANDLE;
	

	// Are we recording the camera?
	this->record = false || record;
	
	//Initialize sensors
	dwStatus result = dwSAL_createSensor(&sensor, salParams, sal);

	// Initialize camera and image properties
	if (result == DW_SUCCESS) {

		this->sensor = sensor;

		dwImageProperties cameraImageProperties;
		dwSensorCamera_getImageProperties(&cameraImageProperties,
				DW_CAMERA_PROCESSED_IMAGE,
				this->sensor);

		dwCameraProperties cameraProperties;
		dwSensorCamera_getSensorProperties(&cameraProperties, this->sensor);

		width = cameraImageProperties.width;
		height = cameraImageProperties.height;
		imageType = cameraImageProperties.type;
		numSiblings = cameraProperties.siblings;
		std::cout << "Camera siblings: " << numSiblings <<  std::endl;
	}
	else {
		std::cerr << "Cannot create driver: " << salParams.protocol
		    << " with params: " << salParams.parameters << std::endl
		    << "Error: " << dwGetStatusName(result) << std::endl;
		if (result == DW_INVALID_ARGUMENT) {
		    std::cerr << "It is possible the given camera is not supported. " << std::endl;
		}
	}
	
	initImagePool(sdk);
	initFormatter(sdk);
	if (record)  initSerializer(arguments);
}