Skip to content

Commit

Permalink
CHANGE: updated to Blend2D version 0.10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed May 16, 2024
1 parent 889afc2 commit 546350e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Siskin Builder
uses: oldes/install-siskin@v0.7.1
uses: oldes/install-siskin@v0.17.0

- name: Build 64bit static Blend2d library
run: ./siskin Rebol-Blend2D.nest static-lib-x64
Expand All @@ -32,7 +32,7 @@ jobs:
run: COPY .\msvc\Release-x64\blend2d-windows-x64.dll .\test\blend2d-windows-x64.rebx

- name: Install Rebol for extension test
uses: oldes/install-rebol@v3.10.2
uses: oldes/install-rebol@v3.16.0
with:
product: Bulk # premultiply is not part of Core in this version

Expand All @@ -55,10 +55,10 @@ jobs:
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Siskin Builder
uses: oldes/install-siskin@v0.7.1
uses: oldes/install-siskin@v0.17.0

- name: Build 64bit static Blend2d library
run: ./siskin Rebol-Blend2D.nest static-lib-x64
Expand All @@ -70,7 +70,7 @@ jobs:
run: mv ./build/blend2d-macos-x64.dylib ./test/blend2d-macos-x64.rebx

- name: Install Rebol for extension test
uses: oldes/install-rebol@v3.10.2
uses: oldes/install-rebol@v3.16.0
with:
product: Bulk # premultiply is not part of Core in this version

Expand All @@ -95,10 +95,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Siskin Builder
uses: oldes/install-siskin@v0.7.1
uses: oldes/install-siskin@v0.17.0

- name: Build 64bit static Blend2d library
run: ./siskin Rebol-Blend2D.nest static-lib-x64
Expand All @@ -110,7 +110,7 @@ jobs:
run: mv ./build/blend2d-linux-x64.so ./test/blend2d-linux-x64.rebx

- name: Install Rebol for extension test
uses: oldes/install-rebol@v3.10.2
uses: oldes/install-rebol@v3.16.0
with:
product: Bulk # premultiply is not part of Core in this version

Expand Down
11 changes: 9 additions & 2 deletions src/blend2d-command-draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,19 @@ int cmd_draw(RXIFRM *frm, void *reb_ctx) {
index--;

RESOLVE_PAIR_ARG(0, 0);
RESOLVE_PAIR_ARG(0, 2);
if (mode == BL_GRADIENT_TYPE_RADIAL) {
RESOLVE_PAIR_ARG(0, 2);
RESOLVE_NUMBER_ARG(3, 4);
blGradientSetValues(&gradient, 0, doubles, 5);
}
else {
else if (mode == BL_GRADIENT_TYPE_LINEAR) {
RESOLVE_PAIR_ARG(0, 2);
blGradientSetValues(&gradient, 0, doubles, 4);
}
else {// conical
doubles[2] = 0; RESOLVE_NUMBER_ARG_OPTIONAL(0, 2)
doubles[3] = 1; RESOLVE_NUMBER_ARG_OPTIONAL(1, 3)
blGradientSetExtendMode(&gradient, BL_EXTEND_MODE_REPEAT);
blGradientSetValues(&gradient, 0, doubles, 4);
}
blContextSetFillStyle(&ctx, &gradient);
Expand Down
2 changes: 1 addition & 1 deletion src/blend2d-rebol-extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ enum b2d_arg_words {W_B2D_ARG_0,
typedef int (*MyCommandPointer)(RXIFRM *frm, void *ctx);

#define B2D_EXT_INIT_CODE \
"REBOL [Title: \"Rebol Blend2D Extension\" Name: blend2d Type: module Exports: [draw] Version: 0.0.18.2 Author: Oldes Date: 23-Jan-2023/13:58:25 License: Apache-2.0 Url: https://github.com/Siskin-framework/Rebol-Blend2D]\n"\
"REBOL [Title: \"Rebol Blend2D Extension\" Name: blend2d Type: module Exports: [draw] Version: 0.0.18.2 Author: Oldes Date: 16-May-2024/12:31:24 License: Apache-2.0 Url: https://github.com/Siskin-framework/Rebol-Blend2D]\n"\
"init-words: command [cmd-words [block!] arg-words [block!]]\n"\
"draw: command [\"Draws scalable vector graphics to an image\" image [image! pair!] commands [block!]]\n"\
"path: command [\"Prepares path object\" commands [block!]]\n"\
Expand Down
10 changes: 7 additions & 3 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ text: "The quick brown fox jumps over the lazy dog. 123456780"
grid10x10: draw 20x20 [fill 215.215.215 box 0x0 10x10 box 10x10 20x20]
center: 240x240
points: #[f64! [100 100 100 380 380 380 380 100]]
points: #(f64! [100 100 100 380 380 380 380 100])
points2: skip points 2
points-in-block: [
0x200 2x198.056 4x196.544 6x195.464 8x194.816 10x194.6 12x194.816 14x195.464 16x196.544 18x198.056
Expand Down Expand Up @@ -81,8 +81,12 @@ draw 480x480 [
### Fill conical
```rebol
draw 480x480 [
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 0x240
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240
fill-all
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 3.14 ;; rotated
circle 240x240 200
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 0 12 ;; repeated
circle 240x240 100
]
```
![](assets/gen/fill-conical.png)
Expand Down Expand Up @@ -555,7 +559,7 @@ my-shape: b2d/path [
]
```
```rebol
== #[handle! BLPath]
== #(handle! BLPath)
```

```rebol
Expand Down
Binary file modified test/assets/gen/fill-conical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions test/examples.r3
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Rebol [
system/modules/blend2d: none ;; make sure that we use the local one
b2d: import 'blend2d

print b2d/info
;about
CI?: "true" = get-env "CI"
;recycle/torture
Expand All @@ -17,7 +18,7 @@ text: "The quick brown fox jumps over the lazy dog. 123456780"

grid10x10: draw 20x20 [fill 215.215.215 box 0x0 10x10 box 10x10 20x20]
center: 240x240
points: #[f64! [100 100 100 380 380 380 380 100]]
points: #(f64! [100 100 100 380 380 380 380 100])
points2: skip points 2
points-in-block: [
0x200 2x198.056 4x196.544 6x195.464 8x194.816 10x194.6 12x194.816 14x195.464 16x196.544 18x198.056
Expand Down Expand Up @@ -65,8 +66,12 @@ examples: [
]

%fill-conical [
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 0x240
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240
fill-all
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 3.14 ;; rotated
circle 240x240 200
fill conical 255.255.255 0 95.175.223 0.5 255.255.255 1 240x240 0 12 ;; repeated
circle 240x240 100
]

%clear [
Expand Down

0 comments on commit 546350e

Please sign in to comment.