Ejemplo n.º 1
0
/* acha peso minimo para ordenacao */
int acha_peso_minimo(Permutacao *per,int tam_per,int superior,int peso){
    /* indices das transposicoes */
    int indice1,indice2;
    /* limitante inferior */
    int inferior;
    
    /* se ja estiver ordenada */
    if(ordenada(per,tam_per)){
        return 0;
    }else{
        /* encontra limitante inferior */
        inferior = acha_breakpoints(per, tam_per);
        /* se com essa permutacao puder chegar ao peso minimo */
        if(peso + inferior <= superior){
            /* gera todos os possiveis indices 2 */
            for(indice2 = 3; indice2 <= tam_per+1; indice2++){
                peso += indice2 - 1;
                /* verifica se o peso nao ultrapassa a limitante superior ou o 
                 * peso minimo*/
                if(peso <= superior)
                    /* gera todos os possiveis indices 1 para cada indice 2 */
                    for(indice1 = 2; indice1 < indice2; indice1++){
                        /* realisa trasposicao */
                        transp(per, indice1, indice2);
                        /* continua a ordenacao */
                        return indice2 + acha_peso_minimo(per,tam_per, 
                        superior,peso);
                        /* desfaz trasposicao */
                        transp(per, (indice2-indice1+1), indice2);
                    }
                peso -= indice2 - 1;
            }
        }
    }
}
Ejemplo n.º 2
0
int acha_superior(Permutacao *per,int tam_per){
    /* indices da transposicao que aumenta a strip com o proximo elemento */
    int t1_indice1,t1_indice2;
    /* indices da transposicao que aumenta a strip com o elemento anterior */
    int t2_indice1,t2_indice2;
    /* idica qual a transposicao mais leve */
    int remove;
    /* peso total de todas as transposicoes */
    int peso = 0;
    
    /* ateh a permutacao estar ordenada */
    while(!ordenada(per,tam_per)){
        /* acha transposicao de prefixo que removem breakpoint no caso onde: */
        
        /* aumenta a strip com o proximo elemento */
        acha_transp1(per,&t1_indice1,&t1_indice2);
        
        /* aumenta a strip com o elemento anterior */
        acha_transp2(per,tam_per,&t2_indice1,&t2_indice2);
        
        /* acha transposicao de perfixo mais leve */
        remove = acha_maisleve(t1_indice2,t2_indice2);

        /* se a primeira transposicao for a mais leve */
        if(remove == 1){
            /* indica que nao tem mais o breakpoint que sera removido */
            per[t1_indice1-1].breakpoint = 0;
        
            /* soma ao peso total o peso da transposicao que sera realizada */
            peso += t1_indice2 - 1;

            /* realiza transposicao de prefixo */
            transp(per, t1_indice1, t1_indice2);
            
        /* se a segunda transposicao for a mais leve */    
        }else{
            /* indica que nao tem mais o breakpoint que sera removido */
            per[t2_indice2-1].breakpoint = 0;
            /* se remover 2 breakpoints indica que nao tem o outro tambem */
            if(per[t2_indice1-1].elemento == per[t2_indice2].elemento-1)
                per[t2_indice1-1].breakpoint = 0;
            
            /* soma ao peso total o peso da transposicao que sera realizada */
            peso += t2_indice2 - 1;
            
            /* realiza transposicao de prefixo */
            transp(per, t2_indice1, t2_indice2);
        }
    }
    return peso;
}
Ejemplo n.º 3
0
/**
 * @internal
 * @param vbi Initialized vbi decoding context.
 * @param d Destination palette.
 * @param s Source palette.
 * @param entries Size of source and destination palette.
 *
 * Transposes the source palette by @a vbi->brightness and @a vbi->contrast.
 */
void
vbi_transp_colormap(vbi_decoder *vbi, vbi_rgba *d, vbi_rgba *s, int entries)
{
	int brig, cont;

	brig = SATURATE(vbi->brightness, 0, 255);
	cont = SATURATE(vbi->contrast, -128, +127);

	while (entries--) {
		*d++ = VBI_RGBA(transp(VBI_R(*s), brig, cont),
				transp(VBI_G(*s), brig, cont),
				transp(VBI_B(*s), brig, cont));
		s++;
	}
}
void PlatformsCharacterRbDemo::cameraHandling()
{
	const hkReal height = .7f;
	hkVector4 forward;
	forward.set(1,0,0);
	forward.setRotatedDir( m_currentOrient, forward );

	hkVector4 from, to;
	to = m_characterRigidBody->getPosition();
	to.addMul4(height, UP );

	hkVector4 dir;
	dir.setMul4( height, UP );
	dir.addMul4( -8.f, forward);

	from.setAdd4(to, dir);

	// Make object in line of sight transparent
	{
		// Cast down to landscape to get an accurate position
		hkpWorldRayCastInput raycastIn;

		// Reverse direction for collision detection
		raycastIn.m_from = to;
		raycastIn.m_to = from;
		raycastIn.m_filterInfo = hkpGroupFilter::calcFilterInfo(0);

		hkpAllRayHitCollector collector;

		m_world->castRay( raycastIn, collector);

		hkLocalArray<hkUlong>	transp(5);

		// Loop over all collected objects
		for(int i=0; i < collector.getHits().getSize();i++)
		{
			hkpWorldRayCastOutput raycastOut = collector.getHits()[i];

			transp.pushBack(hkUlong(raycastOut.m_rootCollidable));
		}

		// loop over display ids
		for(int i=0; i < m_objectIds.getSize();i++)
		{
			if(transp.indexOf(m_objectIds[i]) != -1)
			{
				HK_SET_OBJECT_COLOR(m_objectIds[i], TRANSPARENT_GREY);
			}
			else
			{
				HK_SET_OBJECT_COLOR(m_objectIds[i],NORMAL_GRAY);
			}
		}

	}

	setupDefaultCameras(m_env, from , to, UP, 1.0f);
}
Ejemplo n.º 5
0
// ====================================================================== 
Operator GetTranspose(const Operator& A, const bool byrow = true) 
{
  ML_Operator* ML_transp;
  ML_transp = ML_Operator_Create(GetML_Comm());
  if (byrow)
    ML_Operator_Transpose_byrow(A.GetML_Operator(),ML_transp);
  else
    ML_Operator_Transpose(A.GetML_Operator(),ML_transp);

  Operator transp(A.GetRangeSpace(),A.GetDomainSpace(), ML_transp,true);
  return(transp);
}
Ejemplo n.º 6
0
void transposeToBackward(plint sizeOfCell, Box2D const& domain, std::vector<char>& data) {
    plint nx = domain.getNx();
    plint ny = domain.getNy();
    std::vector<char> transp(data.size());

    for (plint iX=0; iX<nx; ++iX) {
        for (plint iY=0; iY<ny; ++iY) {
            plint iForward = sizeOfCell*(iY + ny*iX);
            plint iBackward = sizeOfCell*(iX + nx*iY);
            for (plint iByte=0; iByte<sizeOfCell; ++iByte) {
                transp[iBackward+iByte] = data[iForward+iByte];
            }
        }
    }
    transp.swap(data);
}
Ejemplo n.º 7
0
void transpose_test()
{
    int w = 5, h = 7;
    std::vector<ScalarType> s_normal(2 * w * h);
    viennacl::matrix<ScalarType> normal(w, 2 * h);
    viennacl::matrix<ScalarType> transp(h, 2 * w);

    for (unsigned int i = 0; i < s_normal.size(); i+=2) {
        s_normal[i] = i;
        s_normal[i+1] = i;
    }
    viennacl::fast_copy(&s_normal[0], &s_normal[0] + s_normal.size(), normal);
    std::cout << normal << std::endl;
    viennacl::linalg::transpose(normal);
    std::cout << normal << std::endl;
}
Ejemplo n.º 8
0
long double trace_lin(float** a,float ** b,int m1,int n1){
    long double c=0;
    float **temp_mult= new float*[m1];
    for(int i=0;i<m1;i++) temp_mult[i] = new float[m1];
    float **temp_transp= new float*[n1];
    for(int i=0;i<n1;i++) temp_transp[i] = new float[m1];

    transp(b,temp_transp,m1,n1);
    mmultiply(a,temp_transp,temp_mult,m1,n1,n1,m1);
    c=trace(temp_mult,m1);

    for(int i=0;i<n1;i++) delete temp_transp[i];
    delete[] temp_transp;
    for(int i=0;i<m1;i++) delete temp_mult[i];
    delete[] temp_mult;
    return c;
}
Ejemplo n.º 9
0
void nuiDrawContext::DrawShade(const nuiRect& rSourceRect, const nuiRect& rShadeRect, const nuiColor& rTint)
{
  bool texturing = mCurrentState.mTexturing;
  bool blending = mCurrentState.mBlending;
  nuiBlendFunc blendfunc;
  blendfunc = mCurrentState.mBlendFunc;

  if (!blending)
    EnableBlending(true);
  if (blendfunc != nuiBlendTransp)
    SetBlendFunc(nuiBlendTransp);

  nuiSize ShadeSize = rSourceRect.mLeft - rShadeRect.mLeft;

  nuiTexture* pShade = ::nuiTexture::GetTexture(nglString(_T("NUI_Shade_LUT")));

  if (!pShade)
  {
    // Left shadow
    const uint32 size = 16;
    uint8 pLUT[size * 4];
    uint i;
    for (i = 0; i<size; i++)
    {
      pLUT[0+(i*4)] = 0;
      pLUT[1+(i*4)] = 0;
      pLUT[2+(i*4)] = 0;
      float p = (float)i * (255.0f / (float)size);
      pLUT[3+(i*4)] = ToBelow(p);
    }

    nglImageInfo info(false);
    info.mBitDepth = 32;
    info.mBufferFormat = eImageFormatRaw;
    info.mBytesPerLine = size * 4;
    info.mBytesPerPixel = 4;
    info.mHeight = 1;
    info.mWidth = size;
    info.mpBuffer = (char*)pLUT;
    info.mPixelFormat = eImagePixelRGBA;

    pShade = nuiTexture::GetTexture(info, true);
    pShade->SetSource(_T("NUI_Shade_LUT"));

    NGL_ASSERT(pShade);

    pShade->SetMinFilter(GL_LINEAR);
    pShade->SetMagFilter(GL_LINEAR);
#ifndef _OPENGL_ES_
    pShade->SetWrapS(GL_CLAMP);
    pShade->SetWrapT(GL_CLAMP);
#else
    pShade->SetWrapS(GL_CLAMP_TO_EDGE);
    pShade->SetWrapT(GL_CLAMP_TO_EDGE);  
#endif
    pShade->SetEnvMode(GL_MODULATE);
  }

  nuiColor transp(rTint);
  nuiColor opaque(rTint);
  transp.Multiply(0.0f);
  opaque.Multiply(SHADE_ALPHA);

  if (!texturing)
    EnableTexturing(true);
  
  SetTexture(pShade);

  nuiRenderArray* pArray = new nuiRenderArray(GL_TRIANGLES);
  pArray->EnableArray(nuiRenderArray::eVertex);
  pArray->EnableArray(nuiRenderArray::eColor);
  pArray->EnableArray(nuiRenderArray::eTexCoord);
  pArray->Reserve(42);

  // Top Left:
  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  ///
  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetTexCoords(0, 0);
  pArray->SetColor(opaque);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  // Left
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom);
  pArray->PushVertex();

  ///
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  // Left Corner:
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  ///
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft-ShadeSize,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  // bottom shadow
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  ///
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mLeft,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  // Right Corner
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  ///
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom+ShadeSize);
  pArray->PushVertex();

  // Right
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();
  
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();
  
  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  ///
  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mBottom);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mBottom);
  pArray->PushVertex();

  // Top Right
  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(transp);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  ///
  pArray->SetColor(transp);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mTop);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(0, 0);
  pArray->SetVertex(rSourceRect.mRight+ShadeSize,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();

  pArray->SetColor(opaque);
  pArray->SetTexCoords(1, 0);
  pArray->SetVertex(rSourceRect.mRight,rSourceRect.mTop+ShadeSize);
  pArray->PushVertex();


  DrawArray(pArray);

  if (!texturing)
    EnableTexturing(false);

  if (!blending)
    EnableBlending(blending);
  
  if (blendfunc != nuiBlendTransp)
    SetBlendFunc(blendfunc);
}
Ejemplo n.º 10
0
void Panel::Draw() 
{
	//Draw panel
	KrRGBA *pixels = getCanvasResource()->Pixels();
	ColorScheme* cs = get_color_scheme();
	int width = Width(), height = Height();

	if(flags.IsSet(FLAG_HASSHADOWS))
	{
		  width -= SHADOW_THICKNESS;
		  height -= SHADOW_THICKNESS;
	}

	if(bInvertBevel)
	{
		KrRGBA aux;
		aux = colorUp;
		colorUp = colorDown;
		colorDown = aux;
	}
		

	//Fill background
	int i, j;
	
	for(j = 0; j < height; j++)
	{
		KrRGBA color(SlowCanvas::MixColors(Panel::getColorUp(), Panel::getColorDown(), j/(double)height));
		for(i = 0; i < width; i++)
		{
			pixels[ j*Width() + i ] = color;
		}
	}

	
	//Glass effect
	if(height < 55)
	{
		KrRGBA glass(cs->editor_glass_r, cs->editor_glass_g, cs->editor_glass_b);
		int hm = height/2;
		for(j = 0; j < hm; j++)
		{
			for(i = 0; i < width; i++)
			{
				pixels[ j*Width() + i ] = SlowCanvas::MixColors(pixels[ j*Width() + i ], glass, .8*j/(double)hm);
			}
		}
	}

	KrRGBA colorBorder(cs->editor_border_r, cs->editor_border_g, cs->editor_border_b);	

		//Horizontal lines
		for(i = 0; i < width; i++)
		{
			pixels[  i ] = colorBorder;	
			pixels[ (height-1)*Width() + i ] = colorBorder;
		}
		
		//Vertical lines
		for(j = 0; j < height; j++)
		{
			pixels[ j*Width() ] = colorBorder;		
			pixels[ j*Width() + (width-1) ] = colorBorder;
		}

	//Corner pixels
	pixels[ 1 + 1*Width() ] = colorBorder;
	pixels[ (width - 2) + 1*Width() ] = colorBorder;
	pixels[ (width - 2) + (height - 2)*Width() ] = colorBorder;
	pixels[ 1 + (height - 2)*Width() ] = colorBorder;


	

	//Restore colors
	if(bInvertBevel)
	{
		KrRGBA aux;
		aux = colorUp;
		colorUp = colorDown;
		colorDown = aux;
	}

	//Make trasparent corners
	KrRGBA transp(0, 0, 0, 0);

	pixels[ 0 + 0*Width() ] = transp;
	pixels[ 1 + 0*Width() ] = transp;
	pixels[ 0 + 1*Width() ] = transp;

	pixels[ (width - 1) + 0*Width() ] = transp;
	pixels[ (width - 2) + 0*Width() ] = transp;
	pixels[ (width - 1) + 1*Width() ] = transp;

	if(!flags.IsSet(FLAG_HASSHADOWS))
	{
		pixels[ (width - 1) + (height - 1)*Width() ] = transp;
		pixels[ (width - 2) + (height - 1)*Width() ] = transp;
		pixels[ (width - 1) + (height - 2)*Width() ] = transp;
	}

	pixels[ 0 + (height - 1)*Width() ] = transp;
	pixels[ 1 + (height - 1)*Width() ] = transp;
	pixels[ 0 + (height - 2)*Width() ] = transp;

	if(flags.IsSet(FLAG_HASSHADOWS))
	{
		KrRGBA colorShadow;	
		double shadowFactor;
			
		colorShadow.c.red	= cs->editor_shadow_r;
		colorShadow.c.green	= cs->editor_shadow_g;
		colorShadow.c.blue	= cs->editor_shadow_b;
		colorShadow.c.alpha	= SHADOW_MAX;

		//Corner
		pixels[ (width - 1) + (height - 1)*Width() ] = colorShadow;
		pixels[ (width - 2) + (height - 1)*Width() ] = colorShadow;
		pixels[ (width - 1) + (height - 2)*Width() ] = colorShadow;
		
		//Vertical shadow
		for(i = width; i < Width(); i++)
		{
			for(int j = SHADOW_THICKNESS; j < Height(); j++)
			{
				shadowFactor = 1.0 - (i - width)/(double)SHADOW_THICKNESS;
				shadowFactor *= (j >= height)?(1.0 - (j - height)/(double)SHADOW_THICKNESS):1.0;
				shadowFactor *= (j - SHADOW_THICKNESS < SHADOW_FADE)?(j - SHADOW_THICKNESS)/(double)SHADOW_FADE:1.0;

				colorShadow.c.alpha	= SHADOW_MAX*shadowFactor;

				pixels[ j*Width() + i ] = colorShadow;
			}
		}
		
		//Horizontal shadow
		for(i = SHADOW_THICKNESS; i < Width() - SHADOW_THICKNESS; i++)
		{
			for(int j = height; j < Height(); j++)
			{
				shadowFactor = 1.0 - (j - height)/(double)SHADOW_THICKNESS;
				shadowFactor *= (i - SHADOW_THICKNESS < SHADOW_FADE)?(i - SHADOW_THICKNESS)/(double)SHADOW_FADE:1.0;

				colorShadow.c.alpha	= SHADOW_MAX*shadowFactor;

				pixels[ j*Width() + i ] = colorShadow;
			}
		}
	}

	

	getCanvasResource()->Refresh();
}