canvas

  1. Mark Read

    B4J Question [Solved] How do I erase the red dot on the canvas?

    I feel pretty stupid asking but this is my first attempt with graphics. I have two canvas views on top of each other. The lower one has a grid, the upper a red dot. With the mouse I move the red dot around but it whites out the grid underneath. I tried to make the "old" dot transparent but then...
  2. M

    Android Question B4A to B4X Draw Function

    I have been trying to convert the following into B4X code today which I found on the forum in a project (sorry can't remember the original author), but with little success. I have only just started with the drawing canvas/rect functions, so still learning! Private Sub DrawValue2(View As View...
  3. carlos7000

    Spanish Como hacer un sencillo dibujo en B4xPages? [Solucionado]

    Deseo hacer un dibujo parecido al que se ve a continuación. Pero no encuentro el canvas. Alguien me puede, por favor, ayudar?
  4. A

    Android Question Canvas issue resolved

    In my "Strange behavior of Canvas" post, which is now closed: https://www.b4x.com/android/forum/threads/strange-behavior-of-canvas.147779/ a problem with the operation of Canvas has been described. My project was created without using B4XPages. Mr. Erel advised me to move on to building the...
  5. A

    Android Question Strange behavior of Canvas

    I need to make a background for the views so that only part of the image is visible. For example, the top half. Standard code. imvForeground is already built into the Activity. Dim cvs As Canvas Dim img As Bitmap Dim Rect1 As Rect Dim Rect2 As Rect cvs.Initialize(imvForeground)...
  6. james_sgp

    iOS Question PDF in Canvas Disappears

    Hi, I`m loading a PDF into a Cavas in a WebView; however, the PDF opens (page appears) ...but then immediately disappears! I have attached a sample showing the issue. I can`t find the issue, can someone pls advise? James
  7. yo3ggx

    Android Question webview - get a bitmap with javascript

    I want to extract the image in a bitmap using a webview and javascript commands. The code on the web page looks like that: <canvas class="mypic" id="mpcanvas0" width="1024" height="100" >test</canvas> The image is dynamically changed. If I try: Dim js As String js = $"B4A.CallSub('pic_cb'...
  8. R

    Android Question Black edges of label after canvas ClearRect

    Drawing progressbar at the bottom of a label. After that I need to clear this progressbar: Dim i As Int Dim cvs1 As B4XCanvas For i = 1 to 100 cvs1.DrawLine(0, lbl.Height - 1, lbl.Width * i/100, lbl.Height - 1, Colors.Red, 1dip) cvs1.Invalidate Next 'then after a while (user will press a...
  9. AmirMK82

    Android Question Make sun graph view :/

    Hello, I don't know what is this view's name? :/ excuse me! But I want to know if we can make it with B4Xcanvas & how to make it Excuse me for my bad English :) Thanks
  10. Pedro Caldeira

    Android Question save two images side to side in one single image

    Hello All, I need to grab a pre existing image, generate a qrcode as a second image, set up a canvas, set them side by side and save the canvas as a single image. What am I doing wrong since I always get an empty image in the right area. I have tried to set both as the first existing image and...
  11. kimstudio

    Share My Creation Generative art

    Remake of some eyecandy generative art that I am interesetd from openprocessing to B4A. Tried additional libs to reinforce canvas drawing: ABExtDrawing: very nice complete graphics lib AcceleratedSurface: amazing hw accelerated lib with lots of demos to learn Will try BitmapCreator for image...
  12. R

    B4J Question Canvas Snapshot Size Limit

    When using Canvas methods Snapshot or Snapshot2 to convert the contents of a Canvas to an Image, it throws the following exception when the size of the Canvas is too large. Does anyone know how I can determine what is the maximum WIDTH * HEIGHT, and how this upper limit can be changed? Thanks...
  13. D

    B4J Question [Solved] Need help with Canvas.DrawText.

    I'm at a loss here. I need to dynamically draw text with Canvas.DrawText, and while it works the first time around, when the text is changed it overlaps. I've tried: Canvas.ClearRect() Canvas.DrawRect() - with fx.Colors.Transparent Setting views invisible and visible again Adding and removing...
  14. Mashiane

    B4J Library [BANanoCanvas] A HTML5 Canvas Library

    Ola Download Using the BANanoElement & BANanoObject, one is able to script the HTML canvas to draw images etc. Here we follow the same methodology used to create canvas structures. To be able to do this, one uses the BANanoElement to create the <CANVAS> tab, then from that gets the 2d context...
  15. moster67

    B4J Code Snippet [B4X] Canvas - ensure free mouse drawing without gaps (smooth continuous drawing)

    EDIT: see posts #2 and #4 for better solutions thanks to Erel. There might be better ways but I have used DrawRect() method of the Canvas in the past when I want to do free mouse/hand drawing on the screen. However, very often DrawRect() skips some points, i.e., leaves gaps if one tries to draw...
  16. saeed10051

    Android Question How to draw on a canvas in Android

    Hi all i have seen on code from Erel where following code is executed on B4J side to draw on a canvas Sub cvs_MouseDragged (EventData As MouseEvent) cvs.DrawCircle(EventData.X, EventData.Y, 30dip, fx.Colors.From32Bit(Rnd(0xFF000000, -1)), True, 0) End Sub Here as we see that MouseDragged...
  17. TelKel81

    Android Question Clip / Crop with bitmapcreator ?

    Hi, is there a way to clip / crop with bitmapcreator ? Similar to canvas.ClipPath / canvas.RemoveClip. I would like to try using BitmapCreator instead of B4XCanvas, I'm trying to maximize performance gains.
  18. MitchBu

    Android Question Load picture into canvas

    I tried to search, but could not find any example to do what I want. I want to select a picture in the device, and load it into a canvas How should I proceed ? TIA :)
  19. LucaMs

    Android Question [Solved by Klaus] 9Patch and MeasureStringWidth

    If there a "conflict" between 9Patch and canvas MeasureStringWidth or, as always :D, I'm doing something wrong? If I use canvas MeasureStringWidth after applying the 9 patch I get a strange result (see the attached project, please).
  20. Alexander Stolte

    Android Question AnimatedCounter and Canvas, numbers are not in the middle

    Hello, i have a question about the canvas.drawtext function for this code: Private Sub CreateBitmap (lbl As B4XView) As B4XBitmap Dim p As B4XView = xui.CreatePanel("") p.SetLayoutAnimated(0, 0, 0, DigitWidth, DigitHeight * 10) Dim cvs As B4XCanvas cvs.Initialize(p) Dim...
Top