Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Draw Library (for QB64PE v4.4 up)
#1
DRAW LIBRARY
============
A high‑performance 2D drawing library for QB64‑PE, providing fast routines for shapes, lines, images, text rendering, and geometric transformations.

FEATURES
  • Fast filled shapes using scanline algorithms
  • Thick lines, triangles, quads, and rounded rectangles
  • Rotated and scaled image rendering
  • Rotated and filled ellipses
  • Arc and ring‑arc support
  • Text‑to‑image rendering
  • Clean naming conventions
  • No dependencies beyond QB64‑PE

INSTALLATION

  1. Place the library file in your project folder.
  2. Add this line at the top of your program:
    '$INCLUDE:'Draw Library.QLB'
  3. Compile and run.

COMMAND INDEX

CIRCLES & ELLIPSES
  • Draw.Circle.Fill
  • Draw.Circle.Thick
  • Draw.Ellipse.Filled
  • Draw.Ellipse.Arc.Fill
  • Draw.Ellipse.Ring.Arc.Fill
  • Draw.Ellipse.Tilt
  • Draw.Ellipse.Tilt.Fill
  • Draw.Ring.Arc.Fill
  • Draw.Arc.Fill
LINES
  • Draw.Line.Angle
  • Draw.Line.Thick
TRIANGLES
  • Draw.Triangle
  • Draw.Triangle.Fill
  • Draw.Triangle.Thick
QUADRILATERALS
  • Draw.Quad
  • Draw.Quad.Fill
  • Draw.Quad.Thick
RECTANGLES
  • Draw.Rect.Rounded
  • Draw.Rect.Rounded.Fill
IMAGES & TEXT
  • Draw.Image
  • Draw.Text.To.Image&


Philosophy
The Draw Library is built around a few core principles:
  • 1. Consistency
    • Every command follows the same naming pattern:
      Code: (Select All)
      Draw.<Shape>.<Variant>
  • 2. Performance
    • Wherever possible, routines use:
      _MAPTRIANGLE for fast GPU‑accelerated fills
      _MEM for direct pixel writes
      Integer math for speed and stability
  • 3. Compatibility
    • All routines work in:
      Any 32‑bit screen mode
      Any resolution
      Any aspect ratio
  • 4. Simplicity
    • The API is designed to be intuitive:
      No global state
      No hidden dependencies
      No required initialization

EXAMPLE
Code: (Select All)

'$INCLUDE:'Draw Library.QLB'

SCREEN _NEWIMAGE(800, 600, 32)

Draw.Circle.Fill 400, 300, 100, _RGB32(255, 140, 0)

img& = _LOADIMAGE("ship.png", 32)
Draw.Image img&, 400, 300, 1, 1, 45, 0

LICENSE

This library is free to use, modify, and distribute in any QB64PE project.
Attribution is appreciated but not required.

AUTHOR

Created by Steve, with a focus on clarity, performance, and developer‑friendly design.


Attached Files
.7z   Draw Library.7z (Size: 13.8 KB / Downloads: 32)
Reply


Messages In This Thread
Draw Library (for QB64PE v4.4 up) - by SMcNeill - 05-16-2025, 12:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Input Devices Library SMcNeill 2 164 02-01-2026, 10:36 PM
Last Post: SMcNeill
  KeyBoard Library (for QB64PE v 4.4.0 up) SMcNeill 3 607 02-01-2026, 09:40 PM
Last Post: SMcNeill
  Date Library (v 4.4.0 up) SMcNeill 4 249 02-01-2026, 09:37 PM
Last Post: SMcNeill
  Screen Library SMcNeill 0 573 05-09-2025, 02:41 PM
Last Post: SMcNeill
  Text to Speech Library (Windows only) SMcNeill 11 4,023 07-01-2023, 07:58 PM
Last Post: mnrvovrfc

Forum Jump:


Users browsing this thread: 1 Guest(s)