Exemplo n.º 1
0
main(int ac,char *av[])
{
    ImageData *img1,*img2;
    Pixel rgb1,rgb2,rgb3;
    int alpha;
    int rr,gg,bb,r1;
    int size;
    int xx,yy,mx,my;
    int i;
    int res;

	if(ac<5) return 4;
	res=readBMPfile(av[1],&img1);
	if(res<0) {
		printf("画像(1)が読めません");
		return;
	}
	res=readBMPfile(av[2],&img2);
	if(res<0) {
		printf("画像(2)が読めません");
		return;
	}
    alpha=atoi(av[3]);
    mx=img2->width;
    my=img2->height;
    if(mx>img1->width) mx=img1->width;
    if(my>img1->height) my=img1->height;
    for(yy=0;yy<my;yy++) {
	    for(xx=0;xx<mx;xx++) {
	    	getPixel(img1,xx,yy,&rgb1);
	    	getPixel(img2,xx,yy,&rgb2);
	    	rgb3.r=blend(rgb1.r,rgb2.r,alpha);
	    	rgb3.g=blend(rgb1.g,rgb2.g,alpha);
	    	rgb3.b=blend(rgb1.b,rgb2.b,alpha);
	    	setPixel(img1,xx,yy,&rgb3);
	    }
    }
	writeBMPfile(av[4],img1);
	disposeImage(img1);
	disposeImage(img2);
}
Exemplo n.º 2
0
 //------------------------------------------------------------------------
 void pixel_map::blend(HDC h_dc, int x, int y, double scale) const
 {
     if(m_bmp == 0 || m_buf == 0) return;
     unsigned width  = unsigned(m_bmp->bmiHeader.biWidth * scale);
     unsigned height = unsigned(m_bmp->bmiHeader.biHeight * scale);
     RECT rect;
     rect.left   = x;
     rect.top    = y;
     rect.right  = x + width;
     rect.bottom = y + height;
     blend(h_dc, &rect);
 }
void LLDrawPoolGrass::render(S32 pass)
{
	LLGLDisable blend(GL_BLEND);

	{
		LLFastTimer t(FTM_RENDER_GRASS);
		LLGLEnable test(GL_ALPHA_TEST);
		gGL.setSceneBlendType(LLRender::BT_ALPHA);
		//render grass
		LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
	}			
}
Exemplo n.º 4
0
void Layer::renderCompositeLinear() {
  int trans;

  for(int pix = 0; pix < STRIP_PIXEL_COUNT; pix++) {
    effectPixel(effect)(meta, &scratch[0], pix, STRIP_PIXEL_COUNT);

    // calculate trans btwn 1-256 so we can do a shift devide
    transitionPixel(transititionIdx)(tmeta, &trans, pix, STRIP_PIXEL_COUNT);

    target[pix] = blend(target[pix], scratch[0], trans);
  }
}
Exemplo n.º 5
0
void LLDrawPoolGlow::render(S32 pass)
{
	S32 mode = gViewerWindow->getMaskMode();
	LLFastTimer t(FTM_RENDER_GLOW);
	LLGLEnable blend(GL_BLEND);
	LLGLDisable test(GL_ALPHA_TEST);
	gGL.flush();
	/// Get rid of z-fighting with non-glow pass.
	LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
	glPolygonOffset(-1.0f, -1.0f);
	gGL.setSceneBlendType(LLRender::BT_ADD);
	
	U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);

	if (shader_level > 0 && fullbright_shader)
	{
		fullbright_shader->bind();
	}
	else
	{
		gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
	}

	LLGLDepthTest depth(GL_TRUE, GL_FALSE);
	gGL.setColorMask(false, true);
	if (shader_level > 1)
	{
		pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
	}
	else
	{
		renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
	}
	
	if(mode == MASK_MODE_RIGHT)
	{
	gGL.setColorMask(false,true,true,false);
	}
	if(mode == MASK_MODE_LEFT)
	{
	gGL.setColorMask(true,false,false,false);
	}
	if(mode == MASK_MODE_NONE)
	{
	gGL.setColorMask(true, false);
	}
	gGL.setSceneBlendType(LLRender::BT_ALPHA);
	
	if (shader_level > 0 && fullbright_shader)
	{
		fullbright_shader->unbind();
	}
}
Exemplo n.º 6
0
Color Color::blendWithWhite() const
{
    // If the color contains alpha already, we leave it alone.
    if (hasAlpha())
        return *this;

    Color newColor;
    for (int alpha = cStartAlpha; alpha <= cEndAlpha; alpha += cAlphaIncrement) {
        // We have a solid color.  Convert to an equivalent color that looks the same when blended with white
        // at the current alpha.  Try using less transparency if the numbers end up being negative.
        int r = blend(red(), alpha);
        int g = blend(green(), alpha);
        int b = blend(blue(), alpha);
        
        newColor = Color(r, g, b, alpha);

        if (r >= 0 && g >= 0 && b >= 0)
            break;
    }
    return newColor;
}
Exemplo n.º 7
0
static void assRender(VSFrameRef *dst, VSFrameRef *alpha, const VSAPI *vsapi,
                      ASS_Image *img)
{
    uint8_t *planes[4];
    int strides[4], p;

    for(p = 0; p < 4; p++) {
        VSFrameRef *fr = p == 3 ? alpha : dst;

        planes[p] = vsapi->getWritePtr(fr, p % 3);
        strides[p] = vsapi->getStride(fr, p % 3);
        memset(planes[p], 0, strides[p] * vsapi->getFrameHeight(fr, p % 3));
    }

    while(img) {
        uint8_t *dstp, *alphap, *sp, color[4], outa;
        int x, y, k;

        if(img->w == 0 || img->h == 0) {
            img = img->next;
            continue;
        }

        color[0] = _r(img->color);
        color[1] = _g(img->color);
        color[2] = _b(img->color);
        color[3] = _a(img->color);

        for(p = 0; p < 4; p++) {
            dstp = planes[p] + (strides[p] * img->dst_y) + img->dst_x;
            alphap = planes[3] + (strides[3] * img->dst_y) + img->dst_x;
            sp = img->bitmap;

            for(y = 0; y < img->h; y++) {
                for(x = 0; x < img->w; x++) {
                    k = (sp[x] * color[3] + 255) >> 8;
                    outa = (k * 255 + (alphap[x] * (255 - k)) + 255) >> 8;

                    if(p == 3)
                        dstp[x] = outa;
                    else if(outa != 0)
                        dstp[x] = blend(k, color[p], alphap[x], dstp[x], outa);
                }

                dstp += strides[p];
                alphap += strides[3];
                sp += img->stride;
            }
        }

        img = img->next;
    }
}
Exemplo n.º 8
0
void
x_drawable_rep::clear (SI x1, SI y1, SI x2, SI y2) {
  x1= max (x1, cx1-ox); y1= max (y1, cy1-oy);
  x2= min (x2, cx2-ox); y2= min (y2, cy2-oy);
  // outer_round (x1, y1, x2, y2); might still be needed somewhere
  decode (x1, y1);
  decode (x2, y2);
  if ((x1>=x2) || (y1<=y2)) return;
  XSetForeground (dpy, gc, CONVERT (cur_bg));
  XFillRectangle (dpy, win, gc, x1, y2, x2-x1, y1-y2);
  XSetForeground (dpy, gc, CONVERT (blend (cur_fg, cur_bg)));
}
Exemplo n.º 9
0
void LDVector3Test::blendTest()
{
	LDVector3 vector1;
	LDVector3 vector2;
	LDVector3 actual;
	LDVector3 expected;
	//ld_float delta = 0.00001f;
	ld_float t1;
	ld_float t2;

	// Input : vector1{x = 0.0, y = 0.0, z = 0.0}
	//		   vector2{x = 0.0, y = 0.0, z = 0.0}, t1 = 0.0, t2 = 0.0 (ゼロベクトル)
	vector1.zero();
	vector2.zero();
	t1 = 0.0f;
	t2 = 0.0f;
	expected.zero();
	actual = blend( vector1, vector2, t1, t2 );
	QCOMPARE( expected.x, actual.x );
	QCOMPARE( expected.y, actual.y );
	QCOMPARE( expected.z, actual.z );

	// Input : vector1{x = 1.0, y = 2.0, z = 3.0}
	//		   vector2{x = 4.0, y = 5.0, z = 6.0}, t1 = 1.0, t2 = 2.0 (任意の値)
	vector1.x = 1.0f;
	vector1.y = 2.0f;
	vector1.z = 3.0f;
	vector2.x = 4.0f;
	vector2.y = 5.0f;
	vector2.z = 6.0f;
	t1 = 1.0f;
	t2 = 2.0f;
	expected.x = vector1.x * t1 + vector2.x * t2;
	expected.y = vector1.y * t1 + vector2.y * t2;
	expected.z = vector1.z * t1 + vector2.z * t2;
	actual = blend( vector1, vector2, t1, t2 );
	QCOMPARE( expected.x, actual.x );
	QCOMPARE( expected.y, actual.y );
	QCOMPARE( expected.z, actual.z );
}
Exemplo n.º 10
0
void Point::blend_comp(float u, float v, float alpha, float ea, float eb)
{

	this->x = cos(v)*cos(u)*blend(alpha) + aux_c(v, ea) * aux_c(u, eb) * (1-blend(alpha));
	this->y = cos(v)*sin(u)*blend(alpha) + aux_c(v, ea) * aux_s(u, eb) * (1-blend(alpha));
	this->z = sin(v)*blend(alpha) + aux_s(v, ea) * (1-blend(alpha));
}
Exemplo n.º 11
0
void InterpolationEffect::addInterpolationsFromKeyframes(CSSPropertyID property, Element* element, const ComputedStyle* baseStyle, Keyframe::PropertySpecificKeyframe& keyframeA, Keyframe::PropertySpecificKeyframe& keyframeB, double applyFrom, double applyTo)
{
    RefPtrWillBeRawPtr<Interpolation> interpolation = keyframeA.maybeCreateInterpolation(property, keyframeB, element, baseStyle);

    if (interpolation) {
        addInterpolation(interpolation, &keyframeA.easing(), keyframeA.offset(), keyframeB.offset(), applyFrom, applyTo);
    } else {
        RefPtrWillBeRawPtr<Interpolation> interpolationA = keyframeA.maybeCreateInterpolation(property, keyframeA, element, baseStyle);
        RefPtrWillBeRawPtr<Interpolation> interpolationB = keyframeB.maybeCreateInterpolation(property, keyframeB, element, baseStyle);

        ASSERT(interpolationA);
        ASSERT(interpolationB);

        Vector<TimingFunction::PartitionRegion> regions = Vector<TimingFunction::PartitionRegion>();
        keyframeA.easing().partition(regions);

        size_t regionIndex = 0;
        for (const auto& region : regions) {
            double regionStart = blend(keyframeA.offset(), keyframeB.offset(), region.start);
            double regionEnd = blend(keyframeA.offset(), keyframeB.offset(), region.end);

            double regionApplyFrom = regionIndex == 0 ? applyFrom : regionStart;
            double regionApplyTo = regionIndex == regions.size() - 1 ? applyTo : regionEnd;

            if (region.half == TimingFunction::RangeHalf::Lower) {
                interpolation = interpolationA;
            } else if (region.half == TimingFunction::RangeHalf::Upper) {
                interpolation = interpolationB;
            } else {
                ASSERT_NOT_REACHED();
                continue;
            }

            addInterpolation(interpolation.release(),
                &keyframeA.easing(), regionStart, regionEnd, regionApplyFrom, regionApplyTo);

            regionIndex++;
        }
    }
}
Exemplo n.º 12
0
void LLDrawPoolWLSky::renderStars(void) const
{
	LLGLSPipelineSkyBox gls_sky;
	LLGLEnable blend(GL_BLEND);
	gGL.setSceneBlendType(LLRender::BT_ALPHA);
	
	// *NOTE: have to have bound the cloud noise texture already since register
	// combiners blending below requires something to be bound
	// and we might as well only bind once.
	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
	
	gPipeline.disableLights();
	
	// *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid
	// clamping and allow the star_alpha param to brighten the stars.
	bool error;
	LLColor4 star_alpha(LLColor4::black);
	star_alpha.mV[3] = LLWLParamManager::getInstance()->mCurParams.getFloat("star_brightness", error) / 2.f;
	llassert_always(!error);

	gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());

	gGL.pushMatrix();
	gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
	// gl_FragColor.rgb = gl_Color.rgb;
	// gl_FragColor.a = gl_Color.a * star_alpha.a;
	if (LLGLSLShader::sNoFixedFunction)
	{
		gCustomAlphaProgram.bind();
		gCustomAlphaProgram.uniform1f("custom_alpha", star_alpha.mV[3]);
	}
	else
	{
		gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
		gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_CONST_ALPHA, LLTexUnit::TBS_TEX_ALPHA);
		glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV);
	}

	gSky.mVOWLSkyp->drawStars();

	gGL.popMatrix();

	if (LLGLSLShader::sNoFixedFunction)
	{
		gCustomAlphaProgram.unbind();
	}
	else
	{
		// and disable the combiner states
		gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
	}
}
Exemplo n.º 13
0
void BSpline::computePoint(BSPoint *control, BSPoint *output, double v)
{
	double temp;
	// initialize the variables that will hold our outputted point
	output->x=0;
	output->y=0;
	for (size_t k = 0; k <= n_control_points; k++)
        {
            temp = blend(k, n_degree, v);
            output->x += (control[k]).x * temp;
            output->y += (control[k]).y * temp;
        }
}
Exemplo n.º 14
0
double BSpline::blend(int k, int t, double v)
{
	double value;
	if (t == 0)
        ((v >= knots[k]) && (v<knots[k+1]))? value = 1 : value = 0;
    else{
        if((knots[k+t] == knots[k]) && (knots[k+t+1] == knots[k+1])) value = 0;
        else if(knots[k+t] == knots[k]) value = (knots[k+t+1] -v )/(knots[k+t+1] -knots[k+1])*blend(k+1,t -1 ,v );
        else if(knots[k+t+1] == knots[k+1]) value = (v - knots[k])/(knots[k+t] - knots[k]) * blend(k,t-1, v);
        else value = (v - knots[k])/(knots[k+t] - knots[k]) * blend(k,t-1, v) + (knots[k+t+1] -v )/(knots[k+t+1] -knots[k+1])*blend(k+1,t -1 ,v );
    }
	return value;
}
Exemplo n.º 15
0
void Layer::mapFloorToLinear() {
  int f,l;
  CRGB pixel;
  for(l = 0; l < STRIP_PIXEL_COUNT; l++) {
    f = floorMap(l);

    pixel = scratch[f];
    if (f < FLOOR_PIXEL_COUNT-1) {
      pixel = blend(pixel, scratch[f+1], ORIENTATION_INTERPOLATION);
    }
    target[l] = pixel;
  }
}
Exemplo n.º 16
0
PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableLength::interpolateTo(const AnimatableValue* value, double fraction) const
{
    const AnimatableLength* length = toAnimatableLength(value);
    CSSPrimitiveValue::LengthUnitType type = commonUnitType(length);
    if (!isCalc(type))
        return AnimatableLength::create(blend(m_lengthValue, length->m_lengthValue, fraction), type);

    // FIXME(crbug.com/168840): Support for viewport units in calc needs to be added before we can blend them with other units.
    if (isViewportUnit() || length->isViewportUnit())
        return defaultInterpolateTo(this, value, fraction);

    return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fraction).get());
}
void RenderState::resumeFromFunctorInvoke() {
    glViewport(0, 0, mViewportWidth, mViewportHeight);
    glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
    debugOverdraw(false, false);

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    scissor().invalidate();
    blend().invalidate();

    mCaches->textureState().activateTexture(0);
    mCaches->textureState().resetBoundTextures();
}
Exemplo n.º 18
0
  void VisitCircle(const AirspaceCircle &airspace) {
    RasterPoint screen_center = projection.GeoToScreen(airspace.GetCenter());
    unsigned screen_radius = projection.GeoToScreenDistance(airspace.GetRadius());

    if (!warning_manager.IsAcked(airspace) && SetupInterior(airspace)) {
      GLEnable blend(GL_BLEND);
      canvas.DrawCircle(screen_center.x, screen_center.y, screen_radius);
    }

    // draw outline
    if (SetupOutline(airspace))
      canvas.DrawCircle(screen_center.x, screen_center.y, screen_radius);
  }
Exemplo n.º 19
0
void
ThermalAssistantWindow::PaintPoints(Canvas &canvas) const
{
#ifdef ENABLE_OPENGL
  GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#elif defined(USE_GDI)
  canvas.SetMixMask();
#endif /* GDI */

  canvas.Select(look.polygon_brush);
  canvas.Select(look.polygon_pen);
  canvas.DrawPolygon(lift_points, 36);
}
Exemplo n.º 20
0
void LLDrawPoolSimple::render(S32 pass)
{
	LLGLDisable blend(GL_BLEND);
	LLGLState alpha_test(GL_ALPHA_TEST, gPipeline.canUseWindLightShadersOnObjects());
	gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);

	{ //render simple
		LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
		gPipeline.enableLightsDynamic();
		renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask());
	}

	{
		LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS);
		LLGLEnable test(GL_ALPHA_TEST);
		LLGLEnable blend(GL_BLEND);
		gGL.setSceneBlendType(LLRender::BT_ALPHA);
		//render grass
		LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
	}			

	{ //render fullbright
		if (mVertexShaderLevel > 0)
		{
			fullbright_shader->bind();
			fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f);
		}
		else
		{
			gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
		}
		LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT);
		U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR;
		renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
	}

	gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
Exemplo n.º 21
0
void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
{
	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
	{
		LLGLDisable blend(GL_BLEND);

		sky_shader->bind();

		/// Render the skydome
		renderDome(camHeightLocal, sky_shader);	

		sky_shader->unbind();
	}
}
Exemplo n.º 22
0
float SVGPathBlender::blendAnimatedDimensonalFloat(float from, float to, FloatBlendMode blendMode)
{
    if (m_addTypesCount) {
        ASSERT(m_fromMode == m_toMode);
        return from + to * m_addTypesCount;
    }

    if (m_fromMode == m_toMode)
        return blend(from, to, m_progress);
    
    float fromValue = blendMode == BlendHorizontal ? m_fromCurrentPoint.x() : m_fromCurrentPoint.y();
    float toValue = blendMode == BlendHorizontal ? m_toCurrentPoint.x() : m_toCurrentPoint.y();

    // Transform toY to the coordinate mode of fromY
    float animValue = blend(from, m_fromMode == AbsoluteCoordinates ? to + toValue : to - toValue, m_progress);
    
    if (m_isInFirstHalfOfAnimation)
        return animValue;
    
    // Transform the animated point to the coordinate mode, needed for the current progress.
    float currentValue = blend(fromValue, toValue, m_progress);
    return m_toMode == AbsoluteCoordinates ? animValue + currentValue : animValue - currentValue;
}
Exemplo n.º 23
0
  void VisitPolygon(const AirspacePolygon &airspace) {
    if (!PreparePolygon(airspace.GetPoints()))
      return;

    if (!warning_manager.IsAcked(airspace) && SetupInterior(airspace)) {
      // fill interior without overpainting any previous outlines
      GLEnable blend(GL_BLEND);
      DrawPrepared();
    }

    // draw outline
    if (SetupOutline(airspace))
      DrawPrepared();
  }
Exemplo n.º 24
0
  void Visit(const AirspaceCircle& airspace) {
    RasterPoint screen_center = projection.GeoToScreen(airspace.GetCenter());
    unsigned screen_radius = projection.GeoToScreenDistance(airspace.GetRadius());

    {
      GLEnable blend(GL_BLEND);
      setup_interior(airspace);
      canvas.circle(screen_center.x, screen_center.y, screen_radius);
    }

    // draw outline
    setup_outline(airspace);
    canvas.circle(screen_center.x, screen_center.y, screen_radius);
  }
JSBool facInt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
  uint32_t tog=0;
   diaElemUInteger blend(&tog,QT_TR_NOOP("Uinteger"),0,255);
    diaElem *elems[]={&blend   };
    
  if(diaFactoryRun(QT_TR_NOOP("Test uinteger"),1,elems))
  {
    *rval = BOOLEAN_TO_JSVAL(1);
    printf("Value : %u\n",tog);
  }else
    *rval = BOOLEAN_TO_JSVAL(0);
  
  return JS_TRUE;
}
Exemplo n.º 26
0
 void doCell(PIXEL *cellBuffer, const PIXEL &cellColor, const PIXEL &bgColor,
             int x0, int y0, int x1, int y1) {
   // Apply the mask to the cell. 0 pixels are bgColored, GRAY::maxChannelValue
   // ones are cellColored.
   PIXEL *pix, *line    = cellBuffer, *lineEnd;
   GRAY *grPix, *grLine = m_mask->pixels(y0) + x0, *grLineEnd;
   int x, y, grWrap = m_mask->getWrap(), lx = x1 - x0;
   for (y = y0; y < y1; ++y, line += this->m_wrap, grLine += grWrap) {
     lineEnd   = line + lx;
     grLineEnd = grLine + lx;
     for (x = x0, pix = line, grPix = grLine; x < x1; ++x, ++pix, ++grPix)
       *pix = blend(bgColor, cellColor,
                    grPix->value / (double)GRAY::maxChannelValue);
   }
 }
Exemplo n.º 27
0
void BackgroundLayer::draw(Mat& colorMap, Mat& heightMap, LayerStyle& style, bool simple)
{
    if (simple)
        return;

    Mat fg_c = Mat::zeros(colorMap.rows, colorMap.cols, CV_64FC3);
    Mat fg_a = Mat::zeros(colorMap.rows, colorMap.cols, CV_64FC3);
    Mat fg_h = Mat::zeros(colorMap.rows, colorMap.cols, CV_64FC3);
    fg_a.setTo(1);

    tileTexture(style.texImage, fg_h);
    fg_h.copyTo(fg_c);

    blend(colorMap, heightMap, fg_c, fg_a, fg_h, style.opacity);
}
Exemplo n.º 28
0
float SVGPathBlender::BlendState::blendAnimatedDimensonalFloat(float from, float to, FloatBlendMode blendMode)
{
    if (m_addTypesCount) {
        ASSERT(m_typesAreEqual);
        return from + to * m_addTypesCount;
    }

    if (m_typesAreEqual)
        return blend(from, to, m_progress);

    float fromValue = blendMode == BlendHorizontal ? m_fromCurrentPoint.x() : m_fromCurrentPoint.y();
    float toValue = blendMode == BlendHorizontal ? m_toCurrentPoint.x() : m_toCurrentPoint.y();

    // Transform toY to the coordinate mode of fromY
    float animValue = blend(from, m_fromIsAbsolute ? to + toValue : to - toValue, m_progress);

    // If we're in the first half of the animation, we should use the type of the from segment.
    if (m_isInFirstHalfOfAnimation)
        return animValue;

    // Transform the animated point to the coordinate mode, needed for the current progress.
    float currentValue = blend(fromValue, toValue, m_progress);
    return !m_fromIsAbsolute ? animValue + currentValue : animValue - currentValue;
}
Exemplo n.º 29
0
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p)
{
	int devicetype;
	
	if( diskIsCDROM(device) )
		devicetype = iDeviceCDROM;				// Use CDROM icon
	else
	{	
		switch (device->part_type)
		{
			case kPartitionTypeHFS:

				// TODO: add apple raid icon choices
				
				devicetype = iDeviceHFS;		// Use HFS icon
				break;
				
			case kPartitionTypeHPFS:
				devicetype = iDeviceNTFS;		// Use HPFS / NTFS icon
				break;
				
			case kPartitionTypeFAT16:
				devicetype = iDeviceFAT16;		// Use FAT16 icon
				break;
				
			case kPartitionTypeFAT32:
				devicetype = iDeviceFAT32;		// Use FAT32 icon
				break;
				
			case kPartitionTypeEXT3:
				devicetype = iDeviceEXT3;		// Use EXT2/3 icon
				break;
				
			default:
				devicetype = iDeviceGeneric;	// Use Generic icon
				break;
		}
	}
	
	// draw icon
	blend( images[devicetype].image, buffer, centeredAt( images[devicetype].image, p ));
	
	p.y += (images[iSelection].image->height / 2) + font_console.chars[0]->height;
	
	// draw volume label 
	drawStrCenteredAt( device->label, &font_small, buffer, p);	

}
Exemplo n.º 30
0
void motion(
	int x, int y, Time t,
	unsigned int kb_mask
) {
	static uint8_t old_alpha = 255;

	alpha = (255*x/width);
	if (alpha != old_alpha) {
		uint32_t t1, t2;

		t1 = getTime();
		switch (function) {
			case 0:
				printf("%s", function_name[function]);
				blend();
				break;
			case 1:
				printf("%s", function_name[function]);
				SSE4_blend();
				break;
			case 2:
				printf("%s", function_name[function]);
				SSE42_blend();
				break;
			case 3:
				printf("%s", function_name[function]);
				swar_64bit_blend();
				break;
			case 4:
				printf("%s", function_name[function]);
				blend_sse_1();
				break;
			case 5:
				printf("%s", function_name[function]);
				blend_sse_2();
				break;
			default:
				return;
		}
		t2 = getTime();
		printf(" = %d us\n", t2-t1);
		Xscr_redraw();
		old_alpha = alpha;

		frequency[function].n   += 1;
		frequency[function].sum += (t2 - t1);
	}
}