Beispiel #1
0
void CurvesWidget::saveCurve(KConfigGroup& group, const QString& prefix)
{
    kDebug() << "Storing curves";

    for (int channel = 0; channel < ImageCurves::NUM_CHANNELS; ++channel)
    {

        group.writeEntry(CurvesWidgetPriv::getChannelTypeOption(prefix, channel),
                         (int) curves()->getCurveType(channel));

        for (int point = 0; point <= ImageCurves::NUM_POINTS; ++point)
        {
            QPoint p = curves()->getCurvePoint(channel, point);

            if (!isSixteenBits() && p != ImageCurves::getDisabledValue())
            {
                // Store point as 16 bits depth.
                p.setX(p.x() * ImageCurves::MULTIPLIER_16BIT);
                p.setY(p.y() * ImageCurves::MULTIPLIER_16BIT);
            }

            group.writeEntry(CurvesWidgetPriv::getPointOption(prefix, channel, point), p);
        }
    }
}
Beispiel #2
0
void CurvesWidget::restoreCurve(KConfigGroup& group, const QString& prefix)
{
    kDebug() << "Restoring curves";

    reset();

    kDebug() << "curves " << curves() << " isSixteenBits = " << isSixteenBits();

    for (int channel = 0; channel < ImageCurves::NUM_CHANNELS; ++channel)
    {

        curves()->setCurveType(channel, (ImageCurves::CurveType) group.readEntry(
                                   CurvesWidgetPriv::getChannelTypeOption(
                                       prefix, channel), 0));

        for (int point = 0; point <= ImageCurves::NUM_POINTS; ++point)
        {
            QPoint p = group.readEntry(CurvesWidgetPriv::getPointOption(prefix,
                                       channel, point), ImageCurves::getDisabledValue());

            // always load a 16 bit curve and stretch it to 8 bit if necessary
            if (!isSixteenBits() && p != ImageCurves::getDisabledValue())
            {
                p.setX(p.x() / ImageCurves::MULTIPLIER_16BIT);
                p.setY(p.y() / ImageCurves::MULTIPLIER_16BIT);
            }

            curves()->setCurvePoint(channel, point, p);
        }

        curves()->curvesCalculateCurve(channel);
    }
}
Beispiel #3
0
void animated_param_t::copy( const param_t& other, float offset, float start, float end)
{
    param_t::copy( other);
    const animated_param_t *other_ = dynamic_cast<const animated_param_t*>( &other);

    for( int i = 0; i < curves().size(); ++i)
        curves()[i].copy( other_->curves()[i], offset, start, end);
}
Beispiel #4
0
float animated_param_t::get_key_time( int nth) const
{
    if( curves().size() == 1)
        return curves()[0][nth].time();

    Loki::AssocVector<float, adobe::empty_t> key_times;
    fill_key_times_assoc_vector( key_times);
    return ( key_times.begin())[nth].first;
}
Beispiel #5
0
int animated_param_t::get_num_keys() const
{
    if( curves().size() == 1)
        return curves()[0].size();

    // this is not very efficient.
    Loki::AssocVector<float, adobe::empty_t> key_times;
    fill_key_times_assoc_vector( key_times);
    return key_times.size();
}
Beispiel #6
0
adobe::any_regular_t float2_param_t::do_get_value_at_time( float time) const
{
    Imath::V2f v( get_value<Imath::V2f>( *this));

    if( !curves()[0].empty())
	v.x = curves()[0].evaluate( time);

    if( !curves()[1].empty())
	v.y = curves()[1].evaluate( time);

    return adobe::any_regular_t( v);
}
Beispiel #7
0
Imath::V2f float2_param_t::derive( float time) const
{
    Imath::V2f result( 0.0f, 0.0f);

    if( !curves()[0].empty())
	result.x    = curves()[0].derive( time);

    if( !curves()[1].empty())
	result.y   = curves()[1].derive( time);

    return result;
}
Beispiel #8
0
void float2_param_t::do_create_tracks( anim::track_t *parent)
{
    std::auto_ptr<anim::track_t> t( new anim::track_t( name()));

    std::auto_ptr<anim::track_t> tx( new anim::track_t( "X", &( curves()[0])));
    tx->changed.connect( boost::bind( &animated_param_t::anim_curve_changed, this, _1));
    t->add_child( tx);
    
    std::auto_ptr<anim::track_t> ty( new anim::track_t( "Y", &( curves()[1])));
    ty->changed.connect( boost::bind( &animated_param_t::anim_curve_changed, this, _1));
    t->add_child( ty);

    parent->add_child( t);
}
Beispiel #9
0
Imath::V2f float2_param_t::integrate( float time1, float time2) const
{
    Imath::V2f result = get_value<Imath::V2f>( *this);
    result.x  = (time2 - time1) * result.x;
    result.y  = (time2 - time1) * result.y;

    if( !curves()[0].empty())
	result.x    = curves()[0].integrate( time1, time2);

    if( !curves()[1].empty())
	result.y   = curves()[1].integrate( time1, time2);

    return result;
}
Beispiel #10
0
void float2_param_t::set_value_at_time( const Imath::V2f& x, float time)
{
    if( can_undo())
	param_set()->add_command( this);

    value().assign( x);

    if( !is_static() && ( param_set()->autokey() || !curves()[0].empty()))
	curves()[0].insert( time, x.x);

    if( !is_static() && ( param_set()->autokey() || !curves()[1].empty()))
	curves()[1].insert( time, x.y);

    evaluate( time);
    param_set()->param_changed( this);
}
Beispiel #11
0
bool BWConvert::toolOperations()
{
    if (!loadToDImg())
    {
        return false;
    }

    BWSepiaContainer prm;

    prm.filmType                     = settings()[QLatin1String("filmType")].toInt();
    prm.filterType                   = settings()[QLatin1String("filterType")].toInt();
    prm.toneType                     = settings()[QLatin1String("toneType")].toInt();
    prm.bcgPrm.contrast              = settings()[QLatin1String("contrast")].toDouble();
    prm.strength                     = settings()[QLatin1String("strength")].toDouble();

    CurvesContainer curves((ImageCurves::CurveType)settings()[QLatin1String("curvesType")].toInt(), true);
    curves.initialize();
    curves.values[LuminosityChannel] = settings()[QLatin1String("curves")].value<QPolygon>();
    prm.curvesPrm                    = curves;

    BWSepiaFilter bw(&image(), 0L, prm);
    applyFilter(&bw);

    return (savefromDImg());
}
void AdaptiveStretchCurveGraphInterface::__Click( Button& sender, bool checked )
{
   if ( sender == GUI->Render_ToolButton )
   {
      ImageWindow window( m_width, m_height,
                          3,      // numberOfChannels
                          8,      // bitsPerSample
                          false,  // floating point
                          true ); // color
      if ( !m_gridBitmap.IsNull() )
      {
         View mainView = window.MainView();
         ImageVariant v = mainView.Image();
         static_cast<UInt8Image&>( *v ).Blend( m_gridBitmap );
         if ( !m_curveBitmap.IsNull() )
            static_cast<UInt8Image&>( *v ).Blend( m_curveBitmap );
      }

      window.BringToFront();
      window.Show();
      window.ZoomToFit( false/*allowMagnification*/ );
   }
   else if ( sender == GUI->Edit_ToolButton )
   {
      CurvesTransformationInstance curves( TheCurvesTransformationProcess );
      float ux = 1.0/(m_curve.Length() - 1);
      float m0 = 0;
      for ( int i = 0, j = 1; j < m_curve.Length(); ++j )
      {
         float dy = Abs( m_curve[j] - m_curve[i] );
         if ( dy > 0.01 )
         {
            float dx = ux*(j - i);
            float m = dy/dx;
            if ( Abs( m - m0 )/m > 0.05 )
            {
               m0 = m;
               i = j;
               curves[CurveIndex::RGBK].Add( ux*i, m_curve[i] );
            }
         }
         else if ( 1 + dy == 1 )
         {
            for ( ; ++j < m_curve.Length(); ++j )
            {
               dy = Abs( m_curve[j] - m_curve[i] );
               if ( 1 + dy > 1 )
               {
                  m0 = 0;
                  i = j-1;
                  curves[CurveIndex::RGBK].Add( ux*i, m_curve[i] );
                  break;
               }
            }
         }
      }
      curves.LaunchInterface();
   }
}
Beispiel #13
0
bool ON_Hatch::GetTightBoundingBox( ON_BoundingBox& tight_bbox, int bGrowBox, const ON_Xform* xform) const
{
  int i;
  int count = m_loops.Count();
  ON_CurveArray curves(count);
  for( i = 0; i < count; i++)
  {
    curves.Append( LoopCurve3d(i) );
  }
  return curves.GetTightBoundingBox(tight_bbox,bGrowBox,xform);
}
Beispiel #14
0
AlembicCurves::AlembicCurves(SceneNodePtr eNode, AlembicWriteJob * in_Job, Abc::OObject oParent)
: AlembicObject(eNode, in_Job, oParent)
{
    std::string xformName = EC_MCHAR_to_UTF8( mMaxNode->GetName() );
	std::string curveName = xformName + "Shape";

   AbcG::OCurves curves(GetOParent(),curveName,GetCurrentJob()->GetAnimatedTs());
   mCurvesSchema = curves.getSchema();

   // create all properties
   //mInTangentProperty = OV3fArrayProperty(mCurvesSchema.getArbGeomParams(), ".inTangent", mCurvesSchema.getMetaData(), GetCurrentJob()->GetAnimatedTs() );
   //mOutTangentProperty = OV3fArrayProperty(mCurvesSchema.getArbGeomParams(), ".outTangent", mCurvesSchema.getMetaData(), GetCurrentJob()->GetAnimatedTs() );
   //mRadiusProperty = OFloatArrayProperty(mCurvesSchema.getArbGeomParams(), ".radius", mCurvesSchema.getMetaData(), GetCurrentJob()->GetAnimatedTs() );
   //mColorProperty = OC4fArrayProperty(mCurvesSchema.getArbGeomParams(), ".color", mCurvesSchema.getMetaData(), GetCurrentJob()->GetAnimatedTs() );
}
Beispiel #15
0
void BWSepiaFilter::filterImage()
{
    if (d->settings.preview)
    {
        m_destImage = getThumbnailForEffect(m_orgImage);
    }
    else
    {
        m_destImage = m_orgImage;
        postProgress(10);

        // Apply black and white filter.

        blackAndWhiteConversion(m_destImage, d->settings.filterType);
        postProgress(20);

        // Apply black and white film type.

        blackAndWhiteConversion(m_destImage, d->settings.filmType);
        postProgress(30);

        // Apply color tone filter.

        blackAndWhiteConversion(m_destImage, d->settings.toneType);
        postProgress(40);

        // Calculate and apply the luminosity curve on image.

        CurvesFilter curves(&m_destImage, 0L, d->settings.curvesPrm);
        postProgress(50);
        curves.startFilterDirectly();
        postProgress(60);
        m_destImage.putImageData(curves.getTargetImage().bits());
        postProgress(70);

        // Adjust contrast.

        BCGFilter bcg(&m_destImage, 0L, d->settings.bcgPrm);
        postProgress(80);
        bcg.startFilterDirectly();
        postProgress(90);
        m_destImage.putImageData(bcg.getTargetImage().bits());
        postProgress(100);
    }
}
Beispiel #16
0
void Controller::displayDensityCurves(int x, int y)
{
	SteerableViewMap * svm = _Canvas->getSteerableViewMap();
	if (!svm)
		return;

	unsigned int i, j;
	typedef vector<Vec3r> densityCurve;
	vector<densityCurve> curves(svm->getNumberOfOrientations() + 1);
	vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels());

	// collect the curves values
	unsigned nbCurves = svm->getNumberOfOrientations() + 1;
	unsigned nbPoints = svm->getNumberOfPyramidLevels();
	if (!nbPoints)
		return;

	// build the density/nbLevels curves for each orientation
	for (i = 0; i < nbCurves; ++i) {
		for (j = 0; j < nbPoints; ++j) {
			curves[i].push_back(Vec3r(j, svm->readSteerableViewMapPixel(i, j, x, y), 0));
		}
	}
	// build the density/nbOrientations curves for each level
	for (i = 0; i < nbPoints; ++i) {
		for (j = 0; j < nbCurves; ++j) {
			curvesDirection[i].push_back(Vec3r(j, svm->readSteerableViewMapPixel(j, i, x, y), 0));
		}
	}

	// display the curves
#if 0
	for (i = 0; i < nbCurves; ++i)
		_pDensityCurvesWindow->setOrientationCurve(i, Vec2d(0, 0), Vec2d(nbPoints, 1), curves[i], "scale", "density");
	for (i = 1; i <= 8; ++i)
		_pDensityCurvesWindow->setLevelCurve(i, Vec2d(0, 0), Vec2d(nbCurves, 1), curvesDirection[i],
		                                     "orientation", "density");
	_pDensityCurvesWindow->show();
#endif
}
Beispiel #17
0
void RawProcessingFilter::filterImage()
{
    m_destImage = m_orgImage;

    // emulate LibRaw custom output profile
    if (!m_customOutputProfile.isNull())
    {
        // Note the m_destImage is not yet ready in load()!
        IccTransform trans;
        trans.setIntent(IccTransform::Perceptual);
        trans.setEmbeddedProfile(m_destImage);
        trans.setOutputProfile(m_customOutputProfile);
        trans.apply(m_orgImage, m_observer);
        m_destImage.setIccProfile(m_customOutputProfile);
    }

    postProgress(20);

    if (!m_settings.wb.isDefault())
    {
        WBFilter wb(m_settings.wb, this, m_orgImage, m_destImage, 20, 40);
    }

    postProgress(40);

    if (!m_settings.bcg.isDefault())
    {
        BCGFilter bcg(m_settings.bcg, this, m_orgImage, m_destImage, 40, 70);
    }

    postProgress(70);

    if (!m_settings.curvesAdjust.isEmpty())
    {
        CurvesFilter curves(m_settings.curvesAdjust, this, m_orgImage, m_destImage, 70, 100);
    }

    postProgress(100);
}
//-*****************************************************************************
IObjectDrw::IObjectDrw( IObject &iObj, bool iResetIfNoChildren )
  : m_object( iObj )
  , m_minTime( ( chrono_t )FLT_MAX )
  , m_maxTime( ( chrono_t )-FLT_MAX )
{
    // If not valid, just bail.
    if ( !m_object ) { return; }

    // IObject has no explicit time sampling, but its children may.
    size_t numChildren = m_object.getNumChildren();
    for ( size_t i = 0; i < numChildren; ++i )
    {
        const ObjectHeader &ohead = m_object.getChildHeader( i );

        // Decide what to make.
        DrawablePtr dptr;
        if ( IPolyMesh::matches( ohead ) )
        {
            IPolyMesh pmesh( m_object, ohead.getName() );
            if ( pmesh )
            {
                dptr.reset( new IPolyMeshDrw( pmesh ) );
            }
        }
        else if ( IPoints::matches( ohead ) )
        {
            IPoints points( m_object, ohead.getName() );
            if ( points )
            {
                dptr.reset( new IPointsDrw( points ) );
            }
        }
        else if ( ICurves::matches( ohead ) )
        {
            ICurves curves( m_object, ohead.getName() );
            if ( curves )
            {
                dptr.reset( new ICurvesDrw( curves ) );
            }
        }
        else if ( INuPatch::matches( ohead ) )
        {
            INuPatch nuPatch( m_object, ohead.getName() );
            if ( nuPatch )
            {
                dptr.reset( new INuPatchDrw( nuPatch ) );
            }
        }
        else if ( IXform::matches( ohead ) )
        {
            IXform xform( m_object, ohead.getName() );
            if ( xform )
            {
                dptr.reset( new IXformDrw( xform ) );
            }
        }
        else if ( ISubD::matches( ohead ) )
        {
            ISubD subd( m_object, ohead.getName() );
            if ( subd )
            {
                dptr.reset( new ISubDDrw( subd ) );
            }
        }
        else
        {
            IObject object( m_object, ohead.getName() );
            if ( object )
            {
                dptr.reset( new IObjectDrw( object, true ) );
            }
        }

        if ( dptr && dptr->valid() )
        {
            m_children.push_back( dptr );
            m_minTime = std::min( m_minTime, dptr->getMinTime() );
            m_maxTime = std::max( m_maxTime, dptr->getMaxTime() );
        }
    }

    // Make the bounds empty to start
    m_bounds.makeEmpty();

    // If we have no children, just leave.
    if ( m_children.size() == 0 && iResetIfNoChildren )
    {
        m_object.reset();
    }
}
void tst_QPainterPath::closing()
{
    // lineto's
    {
        QPainterPath triangle(QPoint(100, 100));

        triangle.lineTo(200, 100);
        triangle.lineTo(200, 200);
        QCOMPARE(triangle.elementCount(), 3);

        triangle.closeSubpath();
        QCOMPARE(triangle.elementCount(), 4);
        QCOMPARE(triangle.elementAt(3).type, QPainterPath::LineToElement);

        triangle.moveTo(300, 300);
        QCOMPARE(triangle.elementCount(), 5);
        QCOMPARE(triangle.elementAt(4).type, QPainterPath::MoveToElement);

        triangle.lineTo(400, 300);
        triangle.lineTo(400, 400);
        QCOMPARE(triangle.elementCount(), 7);

        triangle.closeSubpath();
        QCOMPARE(triangle.elementCount(), 8);

        // this will should trigger implicit moveto...
        triangle.lineTo(600, 300);
        QCOMPARE(triangle.elementCount(), 10);
        QCOMPARE(triangle.elementAt(8).type, QPainterPath::MoveToElement);
        QCOMPARE(triangle.elementAt(9).type, QPainterPath::LineToElement);

        triangle.lineTo(600, 700);
        QCOMPARE(triangle.elementCount(), 11);
    }

    // curveto's
    {
        QPainterPath curves(QPoint(100, 100));

        curves.cubicTo(200, 100, 100, 200, 200, 200);
        QCOMPARE(curves.elementCount(), 4);

        curves.closeSubpath();
        QCOMPARE(curves.elementCount(), 5);
        QCOMPARE(curves.elementAt(4).type, QPainterPath::LineToElement);

        curves.moveTo(300, 300);
        QCOMPARE(curves.elementCount(), 6);
        QCOMPARE(curves.elementAt(5).type, QPainterPath::MoveToElement);

        curves.cubicTo(400, 300, 300, 400, 400, 400);
        QCOMPARE(curves.elementCount(), 9);

        curves.closeSubpath();
        QCOMPARE(curves.elementCount(), 10);

        // should trigger implicit moveto..
        curves.cubicTo(100, 800, 800, 100, 800, 800);
        QCOMPARE(curves.elementCount(), 14);
        QCOMPARE(curves.elementAt(10).type, QPainterPath::MoveToElement);
        QCOMPARE(curves.elementAt(11).type, QPainterPath::CurveToElement);
    }

    {
        QPainterPath rects;
        rects.addRect(100, 100, 100, 100);

        QCOMPARE(rects.elementCount(), 5);
        QCOMPARE(rects.elementAt(0).type, QPainterPath::MoveToElement);
        QCOMPARE(rects.elementAt(4).type, QPainterPath::LineToElement);

        rects.addRect(300, 100, 100,100);
        QCOMPARE(rects.elementCount(), 10);
        QCOMPARE(rects.elementAt(5).type, QPainterPath::MoveToElement);
        QCOMPARE(rects.elementAt(9).type, QPainterPath::LineToElement);

        rects.lineTo(0, 0);
        QCOMPARE(rects.elementCount(), 12);
        QCOMPARE(rects.elementAt(10).type, QPainterPath::MoveToElement);
        QCOMPARE(rects.elementAt(11).type, QPainterPath::LineToElement);
    }

    {
        QPainterPath ellipses;
        ellipses.addEllipse(100, 100, 100, 100);

        QCOMPARE(ellipses.elementCount(), 13);
        QCOMPARE(ellipses.elementAt(0).type, QPainterPath::MoveToElement);
        QCOMPARE(ellipses.elementAt(10).type, QPainterPath::CurveToElement);

        ellipses.addEllipse(300, 100, 100,100);
        QCOMPARE(ellipses.elementCount(), 26);
        QCOMPARE(ellipses.elementAt(13).type, QPainterPath::MoveToElement);
        QCOMPARE(ellipses.elementAt(23).type, QPainterPath::CurveToElement);

        ellipses.lineTo(0, 0);
        QCOMPARE(ellipses.elementCount(), 28);
        QCOMPARE(ellipses.elementAt(26).type, QPainterPath::MoveToElement);
        QCOMPARE(ellipses.elementAt(27).type, QPainterPath::LineToElement);
    }

    {
        QPainterPath path;
        path.moveTo(10, 10);
        path.lineTo(40, 10);
        path.lineTo(25, 20);
        path.lineTo(10 + 1e-13, 10 + 1e-13);
        QCOMPARE(path.elementCount(), 4);
        path.closeSubpath();
        QCOMPARE(path.elementCount(), 4);
    }
}
bool gfx_font_adapter::prepare_glyph(unsigned int code)
{
    if (m_impl->font) {
        m_impl->cur_glyph_index = FT_Get_Char_Index(m_impl->font, code);

        int error = FT_Load_Glyph(m_impl->font, m_impl->cur_glyph_index,
                                 m_impl->hinting ? FT_LOAD_DEFAULT : FT_LOAD_NO_HINTING);

        bool is_sys_bitmap = false;
        if (m_impl->font->glyph->format == FT_GLYPH_FORMAT_BITMAP)
            is_sys_bitmap = true;

        if (error == 0) {
            if (m_impl->antialias && !is_sys_bitmap) {
                if (m_impl->weight == 500) {
                    int strength = 1 << 5;
                    FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                } else if (m_impl->weight == 700) {
                    int strength = 1 << 6;
                    FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                } else if (m_impl->weight == 900) {
                    int strength = 1 << 7;
                    FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                }
                // outline text
                m_impl->cur_data_type = glyph_type_outline;
                m_impl->cur_font_path.remove_all();

                if (decompose_ft_outline(m_impl->font->glyph->outline,
                            m_impl->flip_y, m_impl->matrix, m_impl->cur_font_path))
                {
                    m_impl->cur_bound_rect = get_bounding_rect(m_impl->cur_font_path);
                    m_impl->cur_data_size = m_impl->cur_font_path.total_byte_size()+sizeof(unsigned int);//count data
                    m_impl->cur_advance_x = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.x));
                    m_impl->cur_advance_y = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.y));
                    m_impl->matrix.transform(&m_impl->cur_advance_x, &m_impl->cur_advance_y);
                    return true;
                }
            } else {
                m_impl->cur_data_type = glyph_type_mono;
                if (is_sys_bitmap || !FT_IS_SCALABLE(m_impl->font) || m_impl->matrix.is_identity()) {
                    gfx_scanline_bin sl;
                    error = FT_Render_Glyph(m_impl->font->glyph, FT_RENDER_MODE_MONO);
                    if (error == 0) {
                        decompose_ft_bitmap_mono(m_impl->font->glyph->bitmap,
                           m_impl->font->glyph->bitmap_left, m_impl->flip_y ? -m_impl->font->glyph->bitmap_top :
                           m_impl->font->glyph->bitmap_top, m_impl->flip_y, sl, m_impl->cur_font_scanlines_bin);

                        m_impl->cur_bound_rect = rect(m_impl->cur_font_scanlines_bin.min_x(),
                                m_impl->cur_font_scanlines_bin.min_y(),
                                m_impl->cur_font_scanlines_bin.max_x() + 1,
                                m_impl->cur_font_scanlines_bin.max_y() + 1);
                        m_impl->cur_data_size = m_impl->cur_font_scanlines_bin.byte_size();
                        m_impl->cur_advance_x = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.x));
                        m_impl->cur_advance_y = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.y));
                        return true;
                    }
                } else {
                    if (m_impl->weight == 500) {
                        int strength = 1 << 5;
                        FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                    } else if (m_impl->weight == 700) {
                        int strength = 1 << 6;
                        FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                    } else if (m_impl->weight == 900) {
                        int strength = 1 << 7;
                        FT_Outline_Embolden(&(m_impl->font->glyph->outline), strength);
                    }

                    m_impl->cur_font_path.remove_all();
                    if (decompose_ft_outline(m_impl->font->glyph->outline,
                                m_impl->flip_y, m_impl->matrix, m_impl->cur_font_path))
                    {
                        gfx_rasterizer_scanline_aa<> rasterizer;
                        picasso::conv_curve curves(m_impl->cur_font_path);
                        curves.approximation_scale(4.0);
                        rasterizer.add_path(curves);

                        gfx_scanline_bin sl;
                        m_impl->cur_font_scanlines_bin.prepare(); // Remove all
                        gfx_render_scanlines(rasterizer, sl, m_impl->cur_font_scanlines_bin);
                        m_impl->cur_bound_rect = rect(m_impl->cur_font_scanlines_bin.min_x(),
                                m_impl->cur_font_scanlines_bin.min_y(),
                                m_impl->cur_font_scanlines_bin.max_x() + 1,
                                m_impl->cur_font_scanlines_bin.max_y() + 1);
                        m_impl->cur_data_size = m_impl->cur_font_scanlines_bin.byte_size();
                        m_impl->cur_advance_x = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.x));
                        m_impl->cur_advance_y = FLT_TO_SCALAR(int26p6_to_flt(m_impl->font->glyph->advance.y));
                        m_impl->matrix.transform(&m_impl->cur_advance_x, &m_impl->cur_advance_y);
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Beispiel #21
0
bool CurvesWidget::isSixteenBits()
{
    return curves()->isSixteenBits();
}
Beispiel #22
0
void animated_param_t::set_min( float lo)
{
    adobe::for_each( curves(), boost::bind( &anim::curve_t::set_min, _1, lo));
}
Beispiel #23
0
void animated_param_t::set_max( float hi)
{
    adobe::for_each( curves(), boost::bind( &anim::curve_t::set_max, _1, hi));
}
Beispiel #24
0
void animated_param_t::set_range( float lo, float hi)
{
    adobe::for_each( curves(), boost::bind( &anim::curve_t::set_range, _1, lo, hi));
}