skia

Compiling Aseprite from source code. Problem with compiling skia library

ε祈祈猫儿з 提交于 2019-12-13 03:46:51
问题 Im trying to compile Aseprite from github's source code. When I type in console: gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false target_cpu=""x64"" cc=""clang"" cxx=""clang++"" clang_win=""c:\deps\llvm"" win_vc=""G:\Visual Studio\VC"``` I get an error: ERROR Need exactly one build directory to generate 回答1: You are missing two quotes at the

SKIA - Inaccurate value returned by measureText()

本小妞迷上赌 提交于 2019-12-12 10:04:20
问题 I have a problem measuring text using skia measureText() function. The value returned is inaccurate. SkPaint *skPaint = new SkPaint(); SkTypeface* myFont = SkTypeface::CreateFromName("Impact", SkTypeface::kNormal); skPaint->setTypeface(myFont); skPaint->setAntiAlias(true); skPaint->setTextAlign(SkPaint::kLeft_Align); skPaint->setTextEncoding(SkPaint::kUTF16_TextEncoding); skPaint->setTextSize(SkIntToScalar(120)); skPaint->setColor(0xff000001); canvas->drawText(text, length, SkIntToScalar(x) ,

How to enable skia with GPU backend on JB

ぐ巨炮叔叔 提交于 2019-12-12 05:29:34
问题 I heard Skia GPU acc was added in Android 3.0 but seems it was default disabled since Android 4.0 probably because of the shift to HWUI (openGL implementation of Canvas). How could I enable that again just for benchmark purpose. 回答1: I am unaware of any other method of hardware acceleration of Skia. Though for HWUI the developers documentation outlines this here: http://developer.android.com/guide/topics/graphics/hardware-accel.html Apologies if you are already aware of the implementation of

BitmapFactory.decodeByteArray() always returns null (manually-created byte array)

感情迁移 提交于 2019-12-08 04:41:00
问题 So i'm trying to port some C++ code from a colleague that grabs image data over a Bluetoth serial port (I'm using an Android phone). From the data I will need to generate a bitmap. Before testing the ported code, I wrote this quick function to suposedly generate a pure red rectangle. However, BitmapFactory.decodeByteArray() always fails and returns with a null bitmap. I've checked for both of the possible exeptions it can throw and neither one is thrown. byte[] pixelData = new byte[225*160*4]

How to draw rich text with Skia or SkiaSharp

此生再无相见时 提交于 2019-12-08 03:06:12
问题 I want to draw rich text like iOS's Attributed Text or Xamarin.Forms's FormattedString with SkiaSharp , but I can't find how to. I found the DrawText method, but it's for simple text rendering with one color and one font. No mixed colors and/or fonts and no styles like bold, italic, strike-through, or underline. Do I have to do it with my own rich text rendering logic? 回答1: This is doable using the SKPaint type. Basically, as you draw, you set the properties on the paint: var paint = new

Native window rendering issue on Samsung Galaxy S3

不问归期 提交于 2019-12-06 06:36:45
问题 I am using Skia (prebuilt) to draw in an android native window, that i get from a java surface. The code performs well on every device I could test it on, except for a Samsung Galaxy S3 (with android 4.0.4 on it). The first image is what I should see, and the second what appears on the Galaxy S3: The jni function that draws the rectangle is: JNIEXPORT void JNICALL Java_com_test_TestSkia_InitializeWindow(JNIEnv* env, jobject thiz, jobject surface) { ANativeWindow* window = ANativeWindow

How to draw rich text with Skia or SkiaSharp

萝らか妹 提交于 2019-12-06 05:28:15
I want to draw rich text like iOS's Attributed Text or Xamarin.Forms's FormattedString with SkiaSharp , but I can't find how to. I found the DrawText method, but it's for simple text rendering with one color and one font. No mixed colors and/or fonts and no styles like bold, italic, strike-through, or underline. Do I have to do it with my own rich text rendering logic? This is doable using the SKPaint type. Basically, as you draw, you set the properties on the paint: var paint = new SKPaint(); paint.StrikeThruText = true; paint.TextSize = 24; paint.Color = SKColors.Yellow; paint.UnderlineText

SKIA - Inaccurate value returned by measureText()

空扰寡人 提交于 2019-12-06 04:09:46
I have a problem measuring text using skia measureText() function. The value returned is inaccurate. SkPaint *skPaint = new SkPaint(); SkTypeface* myFont = SkTypeface::CreateFromName("Impact", SkTypeface::kNormal); skPaint->setTypeface(myFont); skPaint->setAntiAlias(true); skPaint->setTextAlign(SkPaint::kLeft_Align); skPaint->setTextEncoding(SkPaint::kUTF16_TextEncoding); skPaint->setTextSize(SkIntToScalar(120)); skPaint->setColor(0xff000001); canvas->drawText(text, length, SkIntToScalar(x) , SkIntToScalar(y) , *skPaint); SkScalar width = skPaint->measureText(text, length); The width returned

Draw rotated text in SkiaSharp

筅森魡賤 提交于 2019-12-05 09:27:40
How to draw rotated text in SkiaSharp . Currently I'm rotating the SKCanvas , drawing the text and then rotating it back. But I thought may be there is a more efficient way to do this. canvas.RotateDegrees(45, 20, 20); canvas.DrawText("Text", 20, 20, paint); canvas.RotateDegrees(-45, 20, 20); That is the correct way (the only way, I think). It is not that inefficient as you are not really rotating the canvas, but rather adjusting the drawing matrix (an int[9] array). Under the hood it is doing something like this: var m = SKMatrix.CreateRotation(45); // simple struct over int[9] canvas

Native window rendering issue on Samsung Galaxy S3

邮差的信 提交于 2019-12-04 12:43:06
I am using Skia (prebuilt) to draw in an android native window, that i get from a java surface. The code performs well on every device I could test it on, except for a Samsung Galaxy S3 (with android 4.0.4 on it). The first image is what I should see, and the second what appears on the Galaxy S3: The jni function that draws the rectangle is: JNIEXPORT void JNICALL Java_com_test_TestSkia_InitializeWindow(JNIEnv* env, jobject thiz, jobject surface) { ANativeWindow* window = ANativeWindow_fromSurface(env, surface); ANativeWindow_Buffer buffer; ANativeWindow_lock(window, &buffer, NULL); SkBitmap