Пример #1
0
      // construction based on clip instance
      ImageBase::ImageBase(ClipInstance& instance,
                   double renderScaleX, 
                   double renderScaleY,
                   const OfxRectI &bounds,
                   const OfxRectI &rod,
                   int rowBytes,
                   std::string field,
                   std::string uniqueIdentifier) 
        : Property::Set(imageBaseStuffs)
        , _referenceCount(1)
      {
        getClipBits(instance);

        // set other data
        setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleX, 0);    
        setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleY, 1);        
        setIntProperty(kOfxImagePropBounds,bounds.x1, 0);
        setIntProperty(kOfxImagePropBounds,bounds.y1, 1);
        setIntProperty(kOfxImagePropBounds,bounds.x2, 2);
        setIntProperty(kOfxImagePropBounds,bounds.y2, 3);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.x1, 0);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.y1, 1);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.x2, 2);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.y2, 3);        
        setIntProperty(kOfxImagePropRowBytes,rowBytes);
        
        setStringProperty(kOfxImagePropField,field);
        setStringProperty(kOfxImageClipPropFieldOrder,field);
        setStringProperty(kOfxImagePropUniqueIdentifier,uniqueIdentifier);
      }
Edge* setEdgeTrustProperties(int startNodeID, int endNodeID, double trust) {
    Properties* propEdge = createProperties(TRUST_GRAPH_REL_PROPERTIES_NUM);
    setDoubleProperty(trust, 0, propEdge);


    Edge* e = createEdge(startNodeID, endNodeID, propEdge);
    return e;
}
Пример #3
0
void KWM::setMiniIcon(Window w, const QPixmap &pm){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "KWM_WIN_ICON", False);
  QPixmap *p = new QPixmap;
  *p = pm;
  setDoubleProperty(w, a, (long) p->handle(),
		    (long) (p->mask()?p->mask()->handle():None));
  delete p;
}
Пример #4
0
Edge* setEdgeDoubleProperties(int startNodeID, int endNodeID,double prop){
    Properties* propEdge = createProperties(1);

	setDoubleProperty(prop,0,propEdge);

    /*create an edge*/
    Edge* e = createEdge(startNodeID, endNodeID, propEdge);
    return e	;
	
}
Edge* setEdgeProperties(int startNodeID, int endNodeID, char* type, double weight) {

    /*create edge properties*/
    Properties* propEdge = createProperties(PERSON_REL_PROPERTIES_NUM);
    setStringProperty(type, 0, propEdge);
    setDoubleProperty(weight, 1, propEdge);

    /*create an edge*/
    Edge* e = createEdge(startNodeID, endNodeID, propEdge);
    return e;
}
void SetTagProperties(Node* node,int id){

    setDoubleProperty(id,7,node->properties);

}
  /// images are always SD PAL progressive full res images for the purpose of this example only
  MyImage::MyImage(MyClipInstance &clip, OfxTime time, int view)
    : OFX::Host::ImageEffect::Image(clip) /// this ctor will set basic props on the image
    , _data(NULL)
  {
    // make some memory
    _data = new OfxRGBAColourB[kPalSizeXPixels * kPalSizeYPixels] ; /// PAL SD RGBA
    
    int fillValue = (int)(floor(255.0 * (time/OFXHOSTDEMOCLIPLENGTH))) & 0xff;
    OfxRGBAColourB color;
#ifdef OFX_EXTENSIONS_VEGAS
    color.r = view == 0 ? fillValue : 0;
    color.g = view == 1 ? fillValue : 0;
    color.b = view == 1 ? fillValue : 0;
#else
    color.r = color.g = color.b = fillValue;
#endif
    color.a = 255;

    std::fill(_data, _data + kPalSizeXPixels * kPalSizeYPixels, color);
    // draw the time and the view number in reverse color
    const int scale = 5;
    const int charwidth = 4*scale;
#ifdef OFX_EXTENSIONS_VEGAS
    color.r = view == 0 ? 255-fillValue : 0;
    color.g = view == 1 ? 255-fillValue : 0;
    color.b = view == 1 ? 255-fillValue : 0;
#else
    color.r = color.g = color.b = 255-fillValue;
#endif
    int xx = 50;
    int yy = 50;
    int d;
    d = (int(time)/10)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = int(time)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = 10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = int(time*10)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx = 50;
    yy += 8*scale;
    d = int(view)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);

    // render scale x and y of 1.0
    setDoubleProperty(kOfxImageEffectPropRenderScale, 1.0, 0);
    setDoubleProperty(kOfxImageEffectPropRenderScale, 1.0, 1); 

    // data ptr
    setPointerProperty(kOfxImagePropData,_data);

    // bounds and rod
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.x1, 0);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.y1, 1);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.x2, 2);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.y2, 3);
    
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.x1, 0);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.y1, 1);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.x2, 2);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.y2, 3);        

    // row bytes
    setIntProperty(kOfxImagePropRowBytes, kPalSizeXPixels * sizeof(OfxRGBAColourB));
  }
bool FractalConfiguration::open(string filename)
{
	if(invalidID())
		return true;

	m_dirty = false;

	XMLDocument doc;

	// Parse file
	doc.LoadFile(filename.c_str());

	if(doc.Error())
	{
		m_last_error = doc.GetErrorStr1();
		return true;
	}

	// Get data
	XMLElement *root = doc.RootElement();

	string name = string(root->Name());

	if(name != "fractal")
	{
		m_last_error = "Configuration file is invalid!";
		return true;
	}

	if(root->Attribute("id", m_id.c_str()))
	{
		XMLNode *node = root->FirstChild();

		// Loop over all properties
		while(node != NULL)
		{
			XMLElement *element = node->ToElement();

			if(element == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			// Get name and type (attributes)
			const char* tmp_name = element->Attribute("name");
			const char* tmp_type = element->Attribute("type");

			if(tmp_name == NULL || tmp_type == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			string name(tmp_name);
			string type(tmp_type);

			// Get text
			const char* tmp_text = element->GetText();
			string text = "";

			if(tmp_text != NULL)
				text = tmp_text;

			// Set property
			if(type == "string")
			{
				if(setStringProperty(name, text))
					return true;
			}
			else if(type == "int")
			{
				int value;
				if(stringToInt(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be an integer";
					return true;
				}

				if(setIntProperty(name, value))
					return true;
			}
			else if(type == "double")
			{
				double value;
				if(stringToDouble(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be a double";
					return true;
				}

				if(setDoubleProperty(name, value))
					return true;
			}
			else if(type == "bool")
			{
				bool value;
				if(text == "1")
					value = true;
				else if(text == "0")
					value = false;
				else
				{
					m_last_error = "Error in configuration: " + text + " should be boolean (0 or 1)";
					return true;
				}

				if(setBoolProperty(name, value))
					return true;
			}
			else
			{
				m_last_error = "Error in configuration: " + type + " is not a valid type";
				return true;
			}

			// Next node
			node = node->NextSibling();
		}
	}
	else
	{
		m_last_error = "File contains not the configuration of a fractal with ID " + m_id;
		return true;
	}

	resetDirty();

	return false;
}