Halp Please... BitmapShader with Clamp

56 views
Skip to first unread message

Corey Lucier

unread,
Mar 30, 2016, 6:29:22 PM3/30/16
to skia-discuss
I am filling a canvas with an image using a bitmap shader set to clamp mode.

It's clamping but only ever on a random selection of edges.

I'm clearing my bitmap with red erase color, then drawing an image in the center with:

SkShader* s = SkShader::CreateBitmapShader(src, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);

result->eraseARGB(255, 255, 0, 0);

paint.setShader(s)->unref();

canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft), SkIntToScalar(srcOffset.fY - bounds.fTop));

canvas.drawPaint(paint);


e.g. one pass might show this... (looks like left edge is clamping correctly).




Where another pass (just nudging one pix and re-rendering) will look like:  (looks like bottom edge is clamping correctly).




I'm just trying to draw the image in the center and have it clamp the edge pixels outwards to the edge of the total device.

Any idea what I might be doing wrong?



Corey Lucier

unread,
Mar 30, 2016, 7:41:06 PM3/30/16
to skia-discuss
Seems to be a bug with clamp mode, as other tile modes work great.


Corey Lucier

unread,
Mar 31, 2016, 6:58:27 AM3/31/16
to skia-discuss
Actually if you inspect the image it isn't actually working either, it's not mirroring and/or repeating properly.

Reply all
Reply to author
Forward
0 new messages