MCPcopy Create free account
hub / github.com/beefytech/Beef / SoftBlurInit

Function SoftBlurInit

BeefySysLib/img/ImgEffects.cpp:381–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381void SoftBlurInit(ImageData* inImage, ImageData* outImage, bool invert)
382{
383 uint32* in = inImage->mBits;
384 uint32* out = outImage->mBits;
385
386 int iw = inImage->mWidth;
387 int ih = inImage->mHeight;
388 int ow = outImage->mWidth;
389 int oh = outImage->mHeight;
390
391 int ox = inImage->mX - outImage->mX;
392 int oy = inImage->mY - outImage->mY;
393
394 if (!invert)
395 {
396 for (int y = 0; y < oh; y++)
397 for (int x = 0; x < ow; x++)
398 out[x+y*ow] = 0;
399
400 for (int y = 0; y < ih; y++)
401 {
402 for (int x = 0; x < iw; x++)
403 {
404 int anAlpha = in[x+y*iw]>>24;
405 out[(x+ox)+(y+oy)*ow] = anAlpha * 256;
406 }
407 }
408 }
409 else
410 {
411 for (int y = 0; y < oh; y++)
412 for (int x = 0; x < ow; x++)
413 out[x+y*ow] = 255*256;
414
415 for (int y = 0; y < ih; y++)
416 {
417 for (int x = 0; x < iw; x++)
418 {
419 int anAlpha = in[x+y*iw]>>24;
420 out[(x+ox)+(y+oy)*ow] = (255 - (anAlpha)) * 256;
421 }
422 }
423 }
424}
425
426void SoftBlur(uint32* data, int w, int h, float radius, uint32 defaultValue)
427{

Callers 1

ApplyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected