本文整理汇总了C++中NodeOperation::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeOperation::getWidth方法的具体用法?C++ NodeOperation::getWidth怎么用?C++ NodeOperation::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeOperation
的用法示例。
在下文中一共展示了NodeOperation::getWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: determineDependingAreaOfInterest
bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti colorInput;
NodeOperation *operation = NULL;
/* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */
/* image */
operation = getInputOperation(0);
colorInput.xmax = operation->getWidth();
colorInput.xmin = 0;
colorInput.ymax = operation->getHeight();
colorInput.ymin = 0;
if (operation->determineDependingAreaOfInterest(&colorInput, readOperation, output)) {
return true;
}
/* vector */
if (operation->determineDependingAreaOfInterest(input, readOperation, output)) {
return true;
}
/* scale x */
operation = getInputOperation(2);
if (operation->determineDependingAreaOfInterest(input, readOperation, output) ) {
return true;
}
/* scale y */
operation = getInputOperation(3);
if (operation->determineDependingAreaOfInterest(input, readOperation, output) ) {
return true;
}
return false;
}
示例2: determineResolution
void ExecutionGroup::determineResolution(unsigned int resolution[2])
{
NodeOperation *operation = this->getOutputOperation();
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
this->setResolution(resolution);
BLI_rcti_init(&this->m_viewerBorder, 0, this->m_width, 0, this->m_height);
}
示例3: determineDependingAreaOfInterest
bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input,
ReadBufferOperation *readOperation,
rcti *output)
{
rcti newInput;
rcti bokehInput;
const float max_dim = max(this->getWidth(), this->getHeight());
if (this->m_sizeavailable) {
newInput.xmax = input->xmax + (this->m_size * max_dim / 100.0f);
newInput.xmin = input->xmin - (this->m_size * max_dim / 100.0f);
newInput.ymax = input->ymax + (this->m_size * max_dim / 100.0f);
newInput.ymin = input->ymin - (this->m_size * max_dim / 100.0f);
}
else {
newInput.xmax = input->xmax + (10.0f * max_dim / 100.0f);
newInput.xmin = input->xmin - (10.0f * max_dim / 100.0f);
newInput.ymax = input->ymax + (10.0f * max_dim / 100.0f);
newInput.ymin = input->ymin - (10.0f * max_dim / 100.0f);
}
NodeOperation *operation = getInputOperation(1);
bokehInput.xmax = operation->getWidth();
bokehInput.xmin = 0;
bokehInput.ymax = operation->getHeight();
bokehInput.ymin = 0;
if (operation->determineDependingAreaOfInterest(&bokehInput, readOperation, output)) {
return true;
}
operation = getInputOperation(0);
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) {
return true;
}
operation = getInputOperation(2);
if (operation->determineDependingAreaOfInterest(input, readOperation, output)) {
return true;
}
if (!this->m_sizeavailable) {
rcti sizeInput;
sizeInput.xmin = 0;
sizeInput.ymin = 0;
sizeInput.xmax = 5;
sizeInput.ymax = 5;
operation = getInputOperation(3);
if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
return true;
}
}
return false;
}
示例4: determineResolution
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
NodeBase *node = this->getNode();
if (node->isOperation()) {
NodeOperation *operation = (NodeOperation *)node;
if (operation->isResolutionSet()) {
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
}
else {
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
}
}
示例5: determineDependingAreaOfInterest
bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti imageInput;
if (this->m_buffer) {
return false;
}
else {
NodeOperation *operation = getInputOperation(0);
imageInput.xmax = operation->getWidth();
imageInput.xmin = 0;
imageInput.ymax = operation->getHeight();
imageInput.ymin = 0;
if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output) ) {
return true;
}
}
return false;
}
示例6: determineDependingAreaOfInterest
bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInputValue;
newInputValue.xmin = 0;
newInputValue.ymin = 0;
newInputValue.xmax = 2;
newInputValue.ymax = 2;
NodeOperation *operation = getInputOperation(1);
if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) {
return true;
}
operation = getInputOperation(2);
if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) {
return true;
}
/* XXX the original method of estimating the area-of-interest does not work
* it assumes a linear increase/decrease of mapped coordinates, which does not
* yield correct results for the area and leaves uninitialized buffer areas.
* So now just use the full image area, which may not be as efficient but works at least ...
*/
#if 1
rcti imageInput;
operation = getInputOperation(0);
imageInput.xmax = operation->getWidth();
imageInput.xmin = 0;
imageInput.ymax = operation->getHeight();
imageInput.ymin = 0;
if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output) ) {
return true;
}
return false;
#else
rcti newInput;
const float margin = 2;
BLI_rcti_init_minmax(&newInput);
if (m_dispersion_const && m_distortion_const) {
/* update from fixed distortion/dispersion */
#define UPDATE_INPUT(x, y) \
{ \
float coords[6]; \
determineUV(coords, x, y); \
newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \
newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \
newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \
newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \
} (void)0
UPDATE_INPUT(input->xmin, input->xmax);
UPDATE_INPUT(input->xmin, input->ymax);
UPDATE_INPUT(input->xmax, input->ymax);
UPDATE_INPUT(input->xmax, input->ymin);
#undef UPDATE_INPUT
}
else {
/* use maximum dispersion 1.0 if not const */
float dispersion = m_dispersion_const ? m_dispersion : 1.0f;
#define UPDATE_INPUT(x, y, distortion) \
{ \
float coords[6]; \
updateVariables(distortion, dispersion); \
determineUV(coords, x, y); \
newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \
newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \
newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \
newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \
} (void)0
if (m_distortion_const) {
/* update from fixed distortion */
UPDATE_INPUT(input->xmin, input->xmax, m_distortion);
UPDATE_INPUT(input->xmin, input->ymax, m_distortion);
UPDATE_INPUT(input->xmax, input->ymax, m_distortion);
UPDATE_INPUT(input->xmax, input->ymin, m_distortion);
}
else {
/* update from min/max distortion (-1..1) */
UPDATE_INPUT(input->xmin, input->xmax, -1.0f);
UPDATE_INPUT(input->xmin, input->ymax, -1.0f);
UPDATE_INPUT(input->xmax, input->ymax, -1.0f);
UPDATE_INPUT(input->xmax, input->ymin, -1.0f);
UPDATE_INPUT(input->xmin, input->xmax, 1.0f);
UPDATE_INPUT(input->xmin, input->ymax, 1.0f);
UPDATE_INPUT(input->xmax, input->ymax, 1.0f);
UPDATE_INPUT(input->xmax, input->ymin, 1.0f);
#undef UPDATE_INPUT
}
}
newInput.xmin -= margin;
//.........这里部分代码省略.........
示例7: convertResolution
void Converter::convertResolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket)
{
InputResizeMode mode = toSocket->getResizeMode();
NodeOperation *toOperation = &toSocket->getOperation();
const float toWidth = toOperation->getWidth();
const float toHeight = toOperation->getHeight();
NodeOperation *fromOperation = &fromSocket->getOperation();
const float fromWidth = fromOperation->getWidth();
const float fromHeight = fromOperation->getHeight();
bool doCenter = false;
bool doScale = false;
float addX = (toWidth - fromWidth) / 2.0f;
float addY = (toHeight - fromHeight) / 2.0f;
float scaleX = 0;
float scaleY = 0;
switch (mode) {
case COM_SC_NO_RESIZE:
break;
case COM_SC_CENTER:
doCenter = true;
break;
case COM_SC_FIT_WIDTH:
doCenter = true;
doScale = true;
scaleX = scaleY = toWidth / fromWidth;
break;
case COM_SC_FIT_HEIGHT:
doCenter = true;
doScale = true;
scaleX = scaleY = toHeight / fromHeight;
break;
case COM_SC_FIT:
doCenter = true;
doScale = true;
scaleX = toWidth / fromWidth;
scaleY = toHeight / fromHeight;
if (scaleX < scaleY) {
scaleX = scaleY;
}
else {
scaleY = scaleX;
}
break;
case COM_SC_STRETCH:
doCenter = true;
doScale = true;
scaleX = toWidth / fromWidth;
scaleY = toHeight / fromHeight;
break;
}
if (doCenter) {
NodeOperation *first = NULL;
ScaleOperation *scaleOperation = NULL;
if (doScale) {
scaleOperation = new ScaleOperation();
scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
scaleOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
first = scaleOperation;
SetValueOperation *sxop = new SetValueOperation();
sxop->setValue(scaleX);
builder.addLink(sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
SetValueOperation *syop = new SetValueOperation();
syop->setValue(scaleY);
builder.addLink(syop->getOutputSocket(), scaleOperation->getInputSocket(2));
builder.addOperation(sxop);
builder.addOperation(syop);
unsigned int resolution[2] = {fromOperation->getWidth(),
fromOperation->getHeight()};
scaleOperation->setResolution(resolution);
sxop->setResolution(resolution);
syop->setResolution(resolution);
builder.addOperation(scaleOperation);
}
TranslateOperation *translateOperation = new TranslateOperation();
translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
if (!first) first = translateOperation;
SetValueOperation *xop = new SetValueOperation();
xop->setValue(addX);
builder.addLink(xop->getOutputSocket(), translateOperation->getInputSocket(1));
SetValueOperation *yop = new SetValueOperation();
yop->setValue(addY);
builder.addLink(yop->getOutputSocket(), translateOperation->getInputSocket(2));
builder.addOperation(xop);
builder.addOperation(yop);
unsigned int resolution[2] = {toOperation->getWidth(),
toOperation->getHeight()};
translateOperation->setResolution(resolution);
xop->setResolution(resolution);
yop->setResolution(resolution);
builder.addOperation(translateOperation);
if (doScale) {
//.........这里部分代码省略.........
示例8: readResolutionFromInputSocket
void WriteBufferOperation::readResolutionFromInputSocket()
{
NodeOperation *inputOperation = this->getInputOperation(0);
this->setWidth(inputOperation->getWidth());
this->setHeight(inputOperation->getHeight());
}