Skip to content

gg: make draw_rect_empty/5 draw more exact borders, independent of the device, and fitting the draw_rect_filled/5 shapes #24024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

spytheman
Copy link
Member

@spytheman spytheman commented Mar 23, 2025

The result of:

module main

import gg
import gx

gg.start(
	bg_color:     gx.white
	window_title: 'Rectangles'
	width:        250
	height:       100
	frame_fn:     fn (ctx &gg.Context) {
		ctx.begin()
		ctx.draw_rect_filled(10, 10, 10, 10, gx.blue)
		ctx.draw_rect_empty(30, 10, 10, 10, gx.red)
		ctx.draw_rect_filled(50, 10, 30, 10, gx.green)
		ctx.draw_rect_empty(100, 10, 30, 10, gx.black)

		ctx.draw_rect_empty(10, 50, 10, 10, gx.blue)
		ctx.draw_rect_filled(30, 50, 10, 10, gx.red)
		ctx.draw_rect_empty(50, 50, 30, 10, gx.green)
		ctx.draw_rect_filled(100, 50, 30, 10, gx.black)
		ctx.end()
	}
)

with this PR on linux (with added guidelines) is:
image
(the top image is from my GPU, the bottom one is from MESA, rendered with LIBGL_ALWAYS_SOFTWARE=1)

on macos, it is (with added guidelines):
image

In both cases draw_rect_empty draws a rectangle, that exactly matches the shape and position of a filled rectangle, drawn with draw_rect_filled.

…e device, and fitting the draw_rect_filled/5 shapes
Copy link

Connected to Huly®: V_0.6-22417

@spytheman spytheman merged commit 0ad74de into vlang:master Mar 23, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant