Drawing Geometric Shapes in PDF Documents Using Java
When working with PDF documents programmatically, you often need to add geometric elements such as rectangles, ellipses, polygons, or curved lines. This tutorial demonstrates how to use Java to create various shapes in PDF files and customize their appearance with different stroke colors and fill effects.
Dependency Configuration
To incorporate ...
Posted on Tue, 22 Sep 2026 16:14:25 +0000 by eshban
Drawing with Python's Turtle Graphics Module
import turtle
Canvas Configuration
Turtle graphics operate on a canvas, which defines the drawing area. Its dimensions and initial placement can be customized.
screensize() Method
turtle.screensize(canvwidth=None, canvheight=None, bg=None)
canvwidth: Width in pixels.
canvheight: Height in pixels.
bg: Background color as a string or RGB tup ...
Posted on Tue, 01 Sep 2026 16:09:09 +0000 by drranch
Drawing Rectangles with the rect() Function in p5.js
The rect() function in p5.js is used to draw rectangles. It can create standard rectangles, rectangles with rounded corners, and, in WebGL mode, rectagnles with additional 3D detail.
Basic Parameters
Four fundamental parameters define a rectangle's position and dimensions:
x: The x-coordinate of the rectangle's top-left corner.
y: The y-coordi ...
Posted on Tue, 18 Aug 2026 16:11:10 +0000 by horsleyaa
Creating Transparent Bitmaps in Android
Android applications often require transparent bitmaps for features like custom graphics rendering or adding watermarks. This guide demonstrates how to create a transparent Bitmap in Android with code examples.
Bitmap Fundamentals
In Android development, Bitmap represents an image and is used for loading, displaying, and manipulating pictures. ...
Posted on Mon, 17 Aug 2026 16:10:44 +0000 by renojim
Detecting Object Overlap in Fabric.js with intersectsWithObject
The intersectsWithObject() method in Fabric.js checks whether one graphical object overlaps with another on the canvas. This functionality supports features like collision prevention and automatic alignmnet in interactive applications.
In a practical example, create a canvas and add multiple shapes—such as rectangles, circles, and triangles. At ...
Posted on Wed, 29 Jul 2026 16:10:41 +0000 by klevis miho
Setting Up OpenGL with GLFW, GLAD, and CMake
Integrating GLFW with CMake
To incorporate GLFW into your project:
Download the GLFW source code and place it in a third_party directory.
Add the following configuration to your main CMakeLists.txt file, adapted from GLFW's official documentation:
cmake_minimum_required(VERSION 3.14)
project(opengl_project)
find_package(OpenGL REQUIRED)
...
Posted on Fri, 10 Jul 2026 17:01:16 +0000 by cunoodle2
Java 2D Graphics Programming Fundamentals
Coordinate Systems
The Java 2D API maintains two distinct coordinate spaces:
User space – The logical coordinate system where graphical primitives are specified
Device space – The coordinate system of the output device (screen, window, or printer)
User space represents a device-independent logical coordinate system used by your program. All g ...
Posted on Sun, 05 Jul 2026 16:25:03 +0000 by javier
Implementing Texture Brush Functionality in Fabric.js
Fabric.js provides a texture brush (PatternBrush) functionality for drawing with image-based patterns. The following outlines the core implementation steps and configuration.
Core Implementation Steps
1. Enable Drawing Mode
Initialize a canvas with isDrawingMode set to true.
const canvas = new fabric.Canvas('canvasElementId', {
width: 400,
...
Posted on Thu, 02 Jul 2026 16:15:00 +0000 by Xeon
Pyglet-Based Sokoban Level Editor with Mouse-Driven Sprite Tracking
This implementation builds a Sokoban level editor using Pyglet, featuring real-time sprite movement synchronized to mouse psoition, grid-based layout, and interactive tile placement.
Mouse-Driven Sprite Movement
A sprite follows the mouse cursor continuously. On mouse press, a tile is placed at the current grid-aligned position. The core logic ...
Posted on Mon, 08 Jun 2026 17:45:26 +0000 by jeancharles
Drawing Triangles with p5.js: A Practical Guide to the triangle() Function
If you're new to p5.js and want to draw a triangle, the triangle() function is your go-to tool!
What is triangle()?
The triangle() functon in p5.js is specifically designed for drawing triangles. You provide it with three coordinate points, and it automatically connects them to form a triangle shape.
Basic Usage: Syntax and Parameters
The synta ...
Posted on Fri, 29 May 2026 19:01:39 +0000 by slimsam1