Very low quality circle with Setpixels32() method

I have a flipbook that working with Canvas(UGUI). I drawing with pencil but circle is too pixel not high quality. Is there a way of solving at Setpixels32() method?

Thanks

Make your texture bigger and then scale it down.

I tried that but which line? I couldn’t find it. I took the method properly. I scaled many things but did not work. Still same. Do you know where do i change it? Also there is one texture. It is background texture too

Probably line 13. But I can’t be sure. It could be line 163.

If you post your code, I can give you a more accurate answer.

this is drawPencil Method

public void DrawPencil(Vector2 from, Vector2 to, int radius, Color32 color, bool eraserMode)
    {

        //cache the pixels forming the circle in an array, so we don't have to compute it every time
        Color32[] circlePixels = GetCirclePixels(radius * Scale, color);
     
        DrawCircleFillInternal((int)from.x * Scale, (int)from.y * Scale, radius * Scale, circlePixels, color, eraserMode);
        DrawCircleFillInternal((int)to.x * Scale, (int)to.y * Scale, radius * Scale, circlePixels, color, eraserMode);

        int centerX = Mathf.RoundToInt((from.x + to.x) / 2f);
        int centerY = Mathf.RoundToInt((from.y + to.y) / 2f);
        Vector2 dir = from - to;
        if (to.y < from.y)
        {
            dir = to - from;
        }
        else
        {
            dir = from - to;
        }
        int width = Mathf.RoundToInt(dir.magnitude);
        float angle = Vector2.Angle(dir, Vector2.left) * Mathf.Deg2Rad + Mathf.PI / 2;

        Vector2[] shape =
        {
            new Vector2 (from.x* Scale+radius* Scale*Mathf.Cos(angle),from.y* Scale+radius* Scale*Mathf.Sin(angle)),
            new Vector2 (from.x* Scale-radius* Scale*Mathf.Cos(angle),from.y* Scale-radius* Scale*Mathf.Sin(angle)),
            new Vector2 (to.x* Scale-radius* Scale*Mathf.Cos(angle),to.y* Scale-radius* Scale*Mathf.Sin(angle)),
            new Vector2 (to.x* Scale+radius* Scale*Mathf.Cos(angle),to.y* Scale+radius* Scale*Mathf.Sin(angle)),
        };
        DrawPolygonInternal(shape, color, eraserMode);

        //set the pixels in the texture and apply
        texture.SetPixels32(pixels);
        texture.Apply();
    }

and this is DrawCircleFillInternal method. DrawPencil method using it

private void DrawCircleFillInternal(int x, int y, int radius, Color color, bool eraserMode)
    {
        Color32[] circlePixels = GetCirclePixels(radius, color);
        DrawCircleFillInternal(x, y, radius, circlePixels, color, eraserMode);
    }

this is OnPointerDown and OnPointerDrag methods

public void OnPointerDown(BaseEventData eventData)
    {
        PointerEventData pointerData = eventData as PointerEventData;
        //calculate the coordinates of the cursor on the texture
        Vector2 localCursor;
        if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(imageCanvas.rectTransform, pointerData.position, pointerData.pressEventCamera, out localCursor))
            return;
        localCursor.x += imageCanvas.rectTransform.pivot.x * imageCanvas.rectTransform.rect.width;
        localCursor.y += imageCanvas.rectTransform.pivot.y * imageCanvas.rectTransform.rect.height;

        if (mode == Mode.Sticker)
        {
            if (stickerTexture == null)
            {
                Debug.LogError("Sticker texture not set!");
                return;
            }
            textureDrawingAux.DrawTexture(Mathf.RoundToInt(localCursor.x)-stickerTexture.width/2, Mathf.RoundToInt(localCursor.y) - stickerTexture.height / 2, stickerTexture);
            return;
        }
        //if it's eraser, set the color to white, else use drawing color
        Color color = mode == Mode.Eraser ? eraseColor : drawingColor;
        //draw a single circle where we touched the image
        textureDrawingAux.DrawCircleFill(Mathf.RoundToInt(localCursor.x), Mathf.RoundToInt(localCursor.y), drawingSize, color, mode == Mode.Eraser);
    }

    //Callback. Traces a pencil line between the 2 points
    public void OnPointerDrag(BaseEventData eventData)
    {
        if (mode == Mode.Sticker)
        {
            return;
        }
        PointerEventData pointerData = eventData as PointerEventData;

        //calculate the coordinates of the cursor on the texture, both when we begin the drag and end it
        Vector2 crtPos;
        if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(imageCanvas.rectTransform, pointerData.position, pointerData.pressEventCamera, out crtPos))
            return;
        Vector2 prevPos;
        if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(imageCanvas.rectTransform, pointerData.position - pointerData.delta, pointerData.pressEventCamera, out prevPos))
            return;

        //if all went ok, set to draw the line on the next frame
        pencilFrom = prevPos;
        pencilTo = crtPos;

        pencilFrom.x += imageCanvas.rectTransform.pivot.x * imageCanvas.rectTransform.rect.width;
        pencilFrom.y += imageCanvas.rectTransform.pivot.y * imageCanvas.rectTransform.rect.height;

        pencilTo.x += imageCanvas.rectTransform.pivot.x * imageCanvas.rectTransform.rect.width;
        pencilTo.y += imageCanvas.rectTransform.pivot.y * imageCanvas.rectTransform.rect.height;

        drawPencil = true;
    }

anyone help? which one is scaling circle? I have to rise the quality. the circle is too low. I tried change values on many code line but did not work