image not found

31 views
Skip to first unread message

Mike

unread,
Apr 16, 2020, 5:41:22 AM4/16/20
to skia-discuss
Hi
first:

struct ShaderView : public Sample {
sk_sp<SkShader> fShader;
sk_sp<SkShader> fShaderFade;
SkBitmap        fBitmap;

void onOnceBeforeDraw() override {
decode_file(GetResourceAsData("Images/baby_tux.bmp"), &fBitmap);
fShader = make_blend_shader();
fShaderFade = make_bitmapfade(fBitmap);
}

ShaderView TestClass;



then in init:
TestClass.onOnceBeforeDraw();



later in my draw function I do:

TestClass.onDrawContent(canvas);


it compiles but at runtime it never finds any image: resource not found. Tried all kind of images/paths. What could be my fault?
Many thanks

Mike Reed

unread,
Apr 16, 2020, 5:57:41 AM4/16/20
to skia-d...@googlegroups.com
Have you stepped into GetResourceAsData() in the debugger, to see what file name it actually uses? Try that.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/d2dbef96-f10e-4f99-9146-4f671e1c5f8f%40googlegroups.com.

Mike

unread,
Apr 16, 2020, 10:36:07 AM4/16/20
to skia-d...@googlegroups.com
Yes, in debugger:
resource = 0x00007ffff28a6368 "Images/baby_tux.bmp"
output:
Resource "resources\Images/baby_tux.bmp" not found.
Looks like I need to remove resources\ somehow? Or on Win10 / looks weird.
Thanks


Mike Reed

unread,
Apr 16, 2020, 10:42:12 AM4/16/20
to skia-d...@googlegroups.com
If you're writing code for your own app, don't use our Resources helpers (e.g. GetResourceAsImage). Those are intimately tied to our testing apps, and not meant to be used outside of there (and may change at any time).

Greg Daniel

unread,
Apr 16, 2020, 10:44:21 AM4/16/20
to skia-discuss
Are you trying to run one of skia's testing tools? If so you may need to set the resource path to point to the resources directory. This can be done with -i <path to skia root dir>/resources.

On Thu, Apr 16, 2020 at 10:36 AM Mike <mcyb...@gmail.com> wrote:

Mike

unread,
Apr 16, 2020, 10:54:49 AM4/16/20
to skia-d...@googlegroups.com
ps: added resources folder and changed to \ but still:

Resource "resources\Images\baby_tux.png" not found.


Robert Phillips

unread,
Apr 16, 2020, 11:00:15 AM4/16/20
to skia-d...@googlegroups.com
Have you tried making the 'I' lower case?

Reply all
Reply to author
Forward
0 new messages