Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pdata-op "+" "c" with float and pdata(float) - for gray-scale addition

  • Loading branch information...
commit b6c9e30208888fc0278a2e2f61d9c721f7f6c47b 1 parent cf2500d
ARocherVj tedr56 authored
22 libfluxus/src/PDataArithmetic.cpp
View
@@ -79,6 +79,28 @@ PData *AddOperator::Operate(TypedPData<dVector> *a, TypedPData<dVector> *b)
return NULL;
}
template <>
+PData *AddOperator::Operate(TypedPData<dColour> *a, float b)
+{
+ for (vector<dColour,FLX_ALLOC(dColour) >::iterator i=a->m_Data.begin(); i!=a->m_Data.end(); i++)
+ {
+ i->r+=b;
+ i->g+=b;
+ i->b+=b;
+ }
+ return NULL;
+}
+template <>
+PData *AddOperator::Operate(TypedPData<dColour> *c, TypedPData<float> *d)
+{
+ for (unsigned int i=0; i<c->Size(); i++)
+ {
+ c->m_Data[i].r+=d->m_Data[i];
+ c->m_Data[i].g+=d->m_Data[i];
+ c->m_Data[i].b+=d->m_Data[i];
+ }
+ return NULL;
+}
+template <>
PData *AddOperator::Operate(TypedPData<dColour> *a, dVector b)
{
for (vector<dColour,FLX_ALLOC(dColour) >::iterator i=a->m_Data.begin(); i!=a->m_Data.end(); i++)
4 libfluxus/src/PDataArithmetic.h
View
@@ -63,6 +63,10 @@ PData *AddOperator::Operate(TypedPData<dVector> *a, TypedPData<float> *b);
template<>
PData *AddOperator::Operate(TypedPData<dVector> *a, TypedPData<dVector> *b);
template<>
+PData *AddOperator::Operate(TypedPData<dColour> *a, float b);
+template<>
+PData *AddOperator::Operate(TypedPData<dColour> *c, TypedPData<float> *d);
+template<>
PData *AddOperator::Operate(TypedPData<dColour> *a, dVector b);
template<>
PData *AddOperator::Operate(TypedPData<dColour> *c, dColour d);
Please sign in to comment.
Something went wrong with that request. Please try again.