> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Drawing.new

> สร้าง Drawing object ใหม่ตามชนิดที่ร้องขอและเพิ่มเข้าไปใน Real tracked Drawing object list ค่า type string ต้องเป็นหนึ่งในชื่อที่รองรับแบบตรงตัว: "Line", "Text", "Circle", "Square", "Quad", "Triangle", "Image" ค่าที่หายไป, non-string หรือ type values ที่ไม่รองรับจะทำให้เกิด Lua error the Drawing API ลงทะเบียน API นี้เฉพาะเมื่อ the required rendering environment is active เป็น true หากการตรวจสอบนี้เป็น false initializer จะกลับก่อนสร้าง globals เหล่านี้

<div className="real-function-page">
  ```lua theme={null}
  Drawing.new(objectType: "Image" | "Line" | "Text" | "Circle" | "Square" | "Quad" | "Triangle"): DrawingObject
  ```

  ## Arguments

  <ParamField path={"objectType"} type={"\"Image\" | \"Line\" | \"Text\" | \"Circle\" | \"Square\" | \"Quad\" | \"Triangle\""} required>
    ชื่อ Drawing type แบบตรงตัวที่จะสร้าง ค่าที่รองรับคือ "Line", "Text", "Circle", "Square", "Quad", "Triangle", "Image"
  </ParamField>

  ## Returns

  <ResponseField name={"object"} type={"DrawingObject"}>
    Drawing object ที่สร้างขึ้นพร้อม Drawing object type
  </ResponseField>

  ## ตัวอย่าง

  สร้างสี่เหลี่ยมจัตุรัสที่มองเห็นได้และกำหนดค่าคุณสมบัติการวาดขั้นพื้นฐาน

  ```lua theme={null}
  local square = Drawing.new("Square")
  square.Position = Vector2.new(120, 120)
  square.Size = Vector2.new(220, 120)
  square.Color = Color3.fromRGB(120, 170, 255)
  square.Filled = true
  square.Visible = true
  ```
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.