Esempio n. 1
0
bool GeometryAdapter::ConvertTextDef(MdfModel::TextSymbol* text, RS_TextDef& tdef)
{
    // foreground color
    bool cacheable = EvalColor(text->GetForegroundColor(), tdef.textcolor());

    // background style and color
    switch (text->GetBackgroundStyle())
    {
        case MdfModel::TextSymbol::Transparent :
            tdef.textbg() = RS_TextBackground_None;
            break;
        case MdfModel::TextSymbol::Ghosted :
            tdef.textbg() = RS_TextBackground_Ghosted;
            cacheable = EvalColor(text->GetBackgroundColor(), tdef.ghostcolor()) && cacheable;
            break;
        case MdfModel::TextSymbol::Opaque :
            tdef.textbg() = RS_TextBackground_Opaque;
            cacheable = EvalColor(text->GetBackgroundColor(), tdef.opaquecolor()) && cacheable;
            break;
    }

    // font style
    RS_FontStyle_Mask style = RS_FontStyle_Regular;

    bool setting = false;
    cacheable = EvalBoolean(text->GetBold(), setting) && cacheable;
    if (setting)
        style = (RS_FontStyle_Mask)(style | RS_FontStyle_Bold);

    cacheable = EvalBoolean(text->GetItalic(), setting) && cacheable;
    if (setting)
        style = (RS_FontStyle_Mask)(style | RS_FontStyle_Italic);

    cacheable = EvalBoolean(text->GetUnderlined(), setting) && cacheable;
    if (setting)
        style = (RS_FontStyle_Mask)(style | RS_FontStyle_Underline);

    tdef.font().style() = style;

    // font name
    tdef.font().name() = text->GetFontName();

    // font height
    double val;
    cacheable = EvalDouble(text->GetSizeY(), val) && cacheable;
    tdef.font().height() = MdfModel::LengthConverter::UnitToMeters(text->GetUnit(), val);

    // rotation
    cacheable = EvalDouble(text->GetRotation(), tdef.rotation()) && cacheable;
    tdef.rotation() = fmod(tdef.rotation(), 360.0);

    // units
    tdef.font().units() = (text->GetSizeContext() == MdfModel::MappingUnits)? RS_Units_Model : RS_Units_Device;

    // alignment
    cacheable = ConvertTextHAlign(text->GetHorizontalAlignment(), tdef.halign()) && cacheable;
    cacheable = ConvertTextVAlign(text->GetVerticalAlignment(), tdef.valign()) && cacheable;

    return cacheable;
}
Esempio n. 2
0
float plStaticEnvLayer::EvalMono(ShadeContext& sc)
{
    if (fBitmapPB->GetInt(kBmpMonoOutput) == 1)
        return EvalColor(sc).a;

    return Intens(EvalColor(sc));
}
Esempio n. 3
0
bool GeometryAdapter::ConvertFill(MdfModel::Fill* mdffill, RS_FillStyle& rsfill)
{
    bool const1 = true, const2 = true;

    if (mdffill != NULL)
    {
        const1 = EvalColor(mdffill->GetForegroundColor(), rsfill.color());
        const2 = EvalColor(mdffill->GetBackgroundColor(), rsfill.background());
        rsfill.pattern() = mdffill->GetFillPattern();
    }
    else
    {
        // no fill => set transparent fill color
        rsfill.color() = RS_Color(RS_Color::EMPTY_COLOR_RGBA);
        rsfill.background() = RS_Color(RS_Color::EMPTY_COLOR_RGBA);
    }

    return const1 && const2;
}
Esempio n. 4
0
bool GeometryAdapter::ConvertStroke(MdfModel::Stroke* stroke, RS_LineStroke& rsstroke)
{
    double val;

    if (stroke != NULL)
    {
        bool const1 = EvalDouble(stroke->GetThickness(), val);
        rsstroke.width() = MdfModel::LengthConverter::UnitToMeters(stroke->GetUnit(), val);
        rsstroke.style() = stroke->GetLineStyle();
        rsstroke.units() = (stroke->GetSizeContext() == MdfModel::MappingUnits)? RS_Units_Model : RS_Units_Device;
        bool const2 = EvalColor(stroke->GetColor(), rsstroke.color());

        // if all members are constant, the stroke is constant
        return const1 && const2;
    }
    else
    {
        // no stroke => set transparent outline
        rsstroke.color() = RS_Color(RS_Color::EMPTY_COLOR_RGBA);
        return true;
    }
}
Esempio n. 5
0
float SampleShaderPlugin::EvalMono(ShadeContext& sc)
{
	//TODO: Evaluate the map for a "mono" channel
	return Intens(EvalColor(sc));
}
Esempio n. 6
0
float plMAXCameraLayer::EvalMono(ShadeContext& sc)
{
    return Intens(EvalColor(sc));
}
Esempio n. 7
0
float Plate::EvalMono(ShadeContext& sc) {
	return Intens(EvalColor(sc));
	}
Esempio n. 8
0
float BerconNoise::EvalMono(ShadeContext& sc) {
	// TODO: Evaluate two maps with mono instead of color, slightly faster...
	return Intens(EvalColor(sc));
}
Esempio n. 9
0
float BerconTile::EvalMono(ShadeContext& sc) {
	return Intens(EvalColor(sc));
}
Esempio n. 10
0
float CrackVisualizer::EvalMono(ShadeContext& sc)
{
	//TODO: Evaluate the map for a "mono" channel
	return Intens(EvalColor(sc));
}
Esempio n. 11
0
float BerconGradient::EvalMono(ShadeContext& sc) {
	return Intens(EvalColor(sc));
}
Esempio n. 12
0
float PainterTextureSample::EvalMono(ShadeContext& sc)
{
	//TODO: Evaluate the map for a "mono" channel
	return Intens(EvalColor(sc));
}
Esempio n. 13
0
float CellTex::EvalMono(ShadeContext& sc)
	{
	return Intens(EvalColor(sc));
	}
Esempio n. 14
0
bool GeometryAdapter::ConvertSymbol(MdfModel::Symbol* symbol, RS_MarkerDef& mdef)
{
    SymbolVisitor::eSymbolType type = SymbolVisitor::DetermineSymbolType(symbol);

    mdef.units() = (symbol->GetSizeContext() == MdfModel::MappingUnits)? RS_Units_Model : RS_Units_Device;

    double val;
    bool cacheable = true;

    // width
    cacheable = EvalDouble(symbol->GetSizeX(), val) && cacheable;
    mdef.width() = MdfModel::LengthConverter::UnitToMeters(symbol->GetUnit(), val);
    if (mdef.width() < 0.0)
    {
        // should not get negative width and height
        _ASSERT(false);
        mdef.width() = -mdef.width();
    }

    // height
    cacheable = EvalDouble(symbol->GetSizeY(), val) && cacheable;
    mdef.height() = MdfModel::LengthConverter::UnitToMeters(symbol->GetUnit(), val);
    if (mdef.height() < 0.0)
    {
        // should not get negative width and height
        _ASSERT(false);
        mdef.height() = -mdef.height();
    }

    // rotation + insertion point
    cacheable = EvalDouble(symbol->GetRotation(), mdef.rotation()) && cacheable;
    cacheable = EvalDouble(symbol->GetInsertionPointX(), mdef.insx()) && cacheable;
    cacheable = EvalDouble(symbol->GetInsertionPointY(), mdef.insy()) && cacheable;
    mdef.rotation() = fmod(mdef.rotation(), 360.0);

    if (type == SymbolVisitor::stMark)
    {
        MdfModel::MarkSymbol* marksym = (MdfModel::MarkSymbol*)symbol;

        mdef.type() = RS_MarkerType_Marker;

        // shape
        MdfModel::MarkSymbol::Shape shape = marksym->GetShape();
        switch (shape)
        {
            case MdfModel::MarkSymbol::Square:   mdef.markernum() = SLDType_Square;   break;
            case MdfModel::MarkSymbol::Circle:   mdef.markernum() = SLDType_Circle;   break;
            case MdfModel::MarkSymbol::Triangle: mdef.markernum() = SLDType_Triangle; break;
            case MdfModel::MarkSymbol::Star:     mdef.markernum() = SLDType_Star;     break;
            case MdfModel::MarkSymbol::Cross:    mdef.markernum() = SLDType_Cross;    break;
            case MdfModel::MarkSymbol::X:        mdef.markernum() = SLDType_X;        break;
            default: break;
        }

        // fill and edge colors
        cacheable = ConvertFill(marksym->GetFill(), mdef.style()) && cacheable;
        cacheable = ConvertStroke(marksym->GetEdge(), mdef.style().outline()) && cacheable;
    }
    else if (type == SymbolVisitor::stBlock)
    {
        MdfModel::BlockSymbol* blocksym = (MdfModel::BlockSymbol*)symbol;

        mdef.type()    = RS_MarkerType_Block;
        mdef.library() = blocksym->GetDrawingName();
        mdef.name()    = blocksym->GetBlockName();

        // block and layer override colors
        cacheable = EvalColor(blocksym->GetBlockColor(), mdef.style().color()) && cacheable;
        cacheable = EvalColor(blocksym->GetLayerColor(), mdef.style().outline().color()) && cacheable;
    }
    else if (type == SymbolVisitor::stW2D)
    {
        MdfModel::W2DSymbol* w2dsym = (MdfModel::W2DSymbol*)symbol;

        mdef.type()    = RS_MarkerType_W2D;
        mdef.library() = w2dsym->GetSymbolLibrary();
        mdef.name()    = w2dsym->GetSymbolName();

        // fill, line, and text override colors
        cacheable = EvalColor(w2dsym->GetFillColor(), mdef.style().color()) && cacheable;
        cacheable = EvalColor(w2dsym->GetLineColor(), mdef.style().outline().color()) && cacheable;
        cacheable = EvalColor(w2dsym->GetTextColor(), mdef.style().background()) && cacheable;
    }
    else if (type == SymbolVisitor::stFont)
    {
        MdfModel::FontSymbol* fontSym = (MdfModel::FontSymbol*)symbol;

        mdef.type() = RS_MarkerType_Font;

        // store the font name as the library string
        mdef.library() = fontSym->GetFontName();

        // store the marker character as the symbol name
        mdef.name() = (wchar_t)fontSym->GetCharacter();

        // font style
        RS_FontStyle_Mask style = RS_FontStyle_Regular;

        bool setting = false;
        cacheable = EvalBoolean(fontSym->GetBold(), setting) && cacheable;
        if (setting)
            style = (RS_FontStyle_Mask)(style | RS_FontStyle_Bold);

        cacheable = EvalBoolean(fontSym->GetItalic(), setting) && cacheable;
        if (setting)
            style = (RS_FontStyle_Mask)(style | RS_FontStyle_Italic);

        cacheable = EvalBoolean(fontSym->GetUnderlined(), setting) && cacheable;
        if (setting)
            style = (RS_FontStyle_Mask)(style | RS_FontStyle_Underline);

        mdef.fontstyle() = style;

        // foreground color
        cacheable = EvalColor(fontSym->GetForegroundColor(), mdef.style().color()) && cacheable;
    }
    else if (type == SymbolVisitor::stImage)
    {
        // TODO: not currently supported
        _ASSERT(false);
    }

    return cacheable;
}