android-canvas

Are Android Views backed by OpenGL?

♀尐吖头ヾ 提交于 2020-06-17 09:10:47
问题 Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...) , use OpenGL under the hood? If not, are there any advantages to using OpenGL to the average Android Developer as opposed to using the regular views for custom UI components? 回答1: Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...), use OpenGL under the hood? Basically yes, OpenGL ES is the API used by the display hardware system to draw

Are Android Views backed by OpenGL?

随声附和 提交于 2020-06-17 09:10:46
问题 Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...) , use OpenGL under the hood? If not, are there any advantages to using OpenGL to the average Android Developer as opposed to using the regular views for custom UI components? 回答1: Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...), use OpenGL under the hood? Basically yes, OpenGL ES is the API used by the display hardware system to draw

What does top, left, right and bottom mean in Android Rect object

↘锁芯ラ 提交于 2020-04-07 10:49:46
问题 I have an Android project where I should make Apples fall. The apples are painted in a Rect. So I created a function that change the Rect position and repaint. Here's my function : private void updateApplesPosition() { for(Rect rect:fallingDownFruitsList) rect.set(rect.left, rect.top +10, rect.right, rect.bottom +10); } I have a problem : the Apples don't fall but go from right to left. To make the apples fall I changed the code by this : private void updateApplesPosition() { for(Rect rect

How to rotate text drawn in a straight line (without radius) when using drawTextOnPath?

一个人想着一个人 提交于 2020-03-03 10:10:32
问题 I want to rotate the numbers in canvas, This is what I have tried: override fun onDraw(canvas: Canvas) { var i = 0 while (i < rulerHeightInInch) { val markingPositionYaxis = screenHeightInPx - (ydpinch * i + topThreshold) paint.textSize = getPixelValueForDp(18.0f) val path = Path() path.reset() path.moveTo( (getPixelValueForDp(30f) + paint.textSize), markingPositionYaxis +17 ) path.lineTo( (getPixelValueForDp(30f) + paint.textSize), markingPositionYaxis - (paint.textSize) ) canvas

2D Array grid on drawing canvas

寵の児 提交于 2020-02-12 10:49:55
问题 I am writing an pixel art app that paints images the user draws on the screen to pixel look. There are two ways to approach it. Either pixelate the image after saving or have a grid before hand so the user draws the pixel image. I don't find anything on the later method. So my issue with the first is drawing a grid where if a cell is touched I would change the color of it. I tried drawing rectangles on a canvas but that was pointless because i couldn't control the cells. I was thinking about

2D Array grid on drawing canvas

让人想犯罪 __ 提交于 2020-02-12 10:49:25
问题 I am writing an pixel art app that paints images the user draws on the screen to pixel look. There are two ways to approach it. Either pixelate the image after saving or have a grid before hand so the user draws the pixel image. I don't find anything on the later method. So my issue with the first is drawing a grid where if a cell is touched I would change the color of it. I tried drawing rectangles on a canvas but that was pointless because i couldn't control the cells. I was thinking about

Android View Canvas onDraw not performed

丶灬走出姿态 提交于 2020-01-24 08:55:06
问题 I am currently working on a custom View which draws some tiles on the canvas. Those tiles are loaded from several files and will be loaded when needed. They will be loaded by an AsyncTask. If they are already loaded they will just be painted on the canvas. This is working properly! If those pictures are loaded the AsyncTask is firing view.postInvalidate() The problem is that my custom View is not firing onDraw(Canvas canvas) everytime I fire view.postInvalidate(). The view.postInvalidate only

Android View Canvas onDraw not performed

徘徊边缘 提交于 2020-01-24 08:55:05
问题 I am currently working on a custom View which draws some tiles on the canvas. Those tiles are loaded from several files and will be loaded when needed. They will be loaded by an AsyncTask. If they are already loaded they will just be painted on the canvas. This is working properly! If those pictures are loaded the AsyncTask is firing view.postInvalidate() The problem is that my custom View is not firing onDraw(Canvas canvas) everytime I fire view.postInvalidate(). The view.postInvalidate only

Android - Draw Picture over ImageView

人走茶凉 提交于 2020-01-17 05:27:24
问题 I have pretty complex custom ImageView and on the other hand I have Picture object that I want to draw it on the ImageView's canvas? Is this possible? The Picture object is not to be converted in any other type since then it'll lose quality and staff, that's why I go with Picture.. Thanks 回答1: You have at least 2 options: 1 - Retriev bitmap from ImageView. Create canvas from it: Canvas canvas = new Canvas(mImage); Draw on that canvas. 2 - Put transparent custom View/SurfaceView over ImageView

Android - Draw Picture over ImageView

不问归期 提交于 2020-01-17 05:26:13
问题 I have pretty complex custom ImageView and on the other hand I have Picture object that I want to draw it on the ImageView's canvas? Is this possible? The Picture object is not to be converted in any other type since then it'll lose quality and staff, that's why I go with Picture.. Thanks 回答1: You have at least 2 options: 1 - Retriev bitmap from ImageView. Create canvas from it: Canvas canvas = new Canvas(mImage); Draw on that canvas. 2 - Put transparent custom View/SurfaceView over ImageView