Added full clay border support to draw (#28)
Co-authored-by: Zachary Levy <zachary@sunforge.is> Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
@@ -166,12 +166,14 @@ textures :: proc() {
|
||||
|
||||
ROW2_Y :: f32(190)
|
||||
|
||||
// QR code (RGBA texture with baked colors, nearest sampling)
|
||||
// QR code (RGBA texture with baked colors, nearest sampling) + thin framing border.
|
||||
draw.rectangle(base_layer, {COL1, ROW2_Y, ITEM_SIZE, ITEM_SIZE}, draw.Color{255, 255, 255, 255}) // white bg
|
||||
draw.rectangle(
|
||||
base_layer,
|
||||
{COL1, ROW2_Y, ITEM_SIZE, ITEM_SIZE},
|
||||
draw.Texture_Fill{id = qr_texture, tint = draw.WHITE, uv_rect = {0, 0, 1, 1}, sampler = .Nearest_Clamp},
|
||||
outline_color = draw.WHITE,
|
||||
outline_width = 2,
|
||||
)
|
||||
draw.text(
|
||||
base_layer,
|
||||
@@ -182,7 +184,7 @@ textures :: proc() {
|
||||
color = draw.WHITE,
|
||||
)
|
||||
|
||||
// Rounded corners
|
||||
// Rounded corners + outline traces the rounded shape.
|
||||
draw.rectangle(
|
||||
base_layer,
|
||||
{COL2, ROW2_Y, ITEM_SIZE, ITEM_SIZE},
|
||||
@@ -192,6 +194,8 @@ textures :: proc() {
|
||||
uv_rect = {0, 0, 1, 1},
|
||||
sampler = .Nearest_Clamp,
|
||||
},
|
||||
outline_color = draw.Color{255, 200, 100, 255},
|
||||
outline_width = 3,
|
||||
radii = draw.uniform_radii({COL2, ROW2_Y, ITEM_SIZE, ITEM_SIZE}, 0.3),
|
||||
)
|
||||
draw.text(
|
||||
@@ -203,7 +207,7 @@ textures :: proc() {
|
||||
color = draw.WHITE,
|
||||
)
|
||||
|
||||
// Rotating
|
||||
// Rotating + outline rotates with the texture.
|
||||
rot_rect := draw.Rectangle{COL3, ROW2_Y, ITEM_SIZE, ITEM_SIZE}
|
||||
draw.rectangle(
|
||||
base_layer,
|
||||
@@ -214,6 +218,8 @@ textures :: proc() {
|
||||
uv_rect = {0, 0, 1, 1},
|
||||
sampler = .Nearest_Clamp,
|
||||
},
|
||||
outline_color = draw.WHITE,
|
||||
outline_width = 2,
|
||||
origin = draw.center_of(rot_rect),
|
||||
rotation = spin_angle,
|
||||
)
|
||||
@@ -282,7 +288,7 @@ textures :: proc() {
|
||||
color = draw.WHITE,
|
||||
)
|
||||
|
||||
// Per-corner radii
|
||||
// Per-corner radii + outline traces the asymmetric corner shape.
|
||||
draw.rectangle(
|
||||
base_layer,
|
||||
{COL4, ROW3_Y, FIT_SIZE, FIT_SIZE},
|
||||
@@ -292,6 +298,8 @@ textures :: proc() {
|
||||
uv_rect = {0, 0, 1, 1},
|
||||
sampler = .Nearest_Clamp,
|
||||
},
|
||||
outline_color = draw.Color{255, 100, 100, 255},
|
||||
outline_width = 3,
|
||||
radii = {20, 0, 20, 0},
|
||||
)
|
||||
draw.text(
|
||||
@@ -321,12 +329,14 @@ textures :: proc() {
|
||||
sampler = .Nearest_Clamp,
|
||||
}
|
||||
|
||||
// Textured circle
|
||||
// Textured circle + outline (textured shape with built-in border).
|
||||
draw.circle(
|
||||
base_layer,
|
||||
{SHAPE_COL1 + SHAPE_SIZE / 2, ROW4_Y + SHAPE_SIZE / 2},
|
||||
SHAPE_SIZE / 2,
|
||||
checker_fill,
|
||||
outline_color = draw.WHITE,
|
||||
outline_width = 2,
|
||||
)
|
||||
draw.text(
|
||||
base_layer,
|
||||
|
||||
Reference in New Issue
Block a user