Skip to content

Commit d2ff099

Browse files
authored
Generate with libvips 8.18, remove usage of thumbnailImage (#198)
1 parent eec0802 commit d2ff099

File tree

115 files changed

+6585
-4657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+6585
-4657
lines changed

README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repositories {
2323
}
2424

2525
dependencies {
26-
implementation("app.photofox.vips-ffm:vips-ffm-core:1.9.4")
26+
implementation("app.photofox.vips-ffm:vips-ffm-core:1.9.5")
2727
}
2828
```
2929

@@ -35,7 +35,7 @@ You must add `--enable-native-access=ALL-UNNAMED` to your JVM runtime arguments.
3535
about "Restricted methods". In the future, the JVM will throw an error if you don't explicitly include this flag.
3636

3737
As the project uses the Java FFM API, and Markdown comments, your target must also be JDK 23+. Bindings are currently
38-
generated from libvips `8.17.2` (but should be safe to use with different minor or patch versions).
38+
generated from libvips `8.18.0` (but should be safe to use with different minor or patch versions).
3939

4040
> [!NOTE]
4141
> This library **does not** include `libvips` in the download, you must add it to the system/container you're building
@@ -59,24 +59,18 @@ import app.photofox.vipsffm.enums.VipsAccess
5959
// Use `Vips.run` to wrap your usage of the API, and get an arena with an appropriate lifetime to use
6060
// Usage of the API, arena, and resulting V-Objects must be done from the thread that called `Vips.run`
6161
Vips.run { arena ->
62-
val sourceImage = VImage.newFromFile(
62+
val thumbnail = VImage.thumbnail(
6363
arena,
64-
"sample/src/main/resources/sample_images/rabbit.jpg"
65-
)
66-
val sourceWidth = sourceImage.width
67-
val sourceHeight = sourceImage.height
68-
logger.info("source image size: $sourceWidth x $sourceHeight")
69-
70-
val outputPath = workingDirectory.resolve("rabbit_copy.jpg")
71-
sourceImage.writeToFile(outputPath.absolutePathString())
72-
73-
val thumbnail = sourceImage.thumbnailImage(
64+
"sample/src/main/resources/sample_images/rabbit.jpg",
7465
400,
7566
VipsOption.Boolean("auto-rotate", true) // example of an option
7667
)
7768
val thumbnailWidth = thumbnail.width
7869
val thumbnailHeight = thumbnail.height
7970
logger.info("thumbnail image size: $thumbnailWidth x $thumbnailHeight")
71+
72+
val outputPath = workingDirectory.resolve("rabbit_thumbnail.jpg")
73+
thumbnail.writeToFile(outputPath.absolutePathString())
8074
}
8175

8276
// Optionally call at the end of your program, for memory leak detection, from any thread

core/src/integrationTest/java/app/photofox/vipsffm/BenchmarkTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public static class BenchmarkState {
3838

3939
@Setup(Level.Trial)
4040
public void init() throws VipsError {
41-
Vips.init(false, true);
4241
VipsHelper.cache_set_max(0);
4342

4443
sourceImage = VSource.newFromFile(
@@ -73,8 +72,7 @@ public void jvipsStyle(BenchmarkState state) {
7372
var insertSize = 512;
7473
var paddingSize = 100;
7574
var finalImageSize = insertSize + paddingSize;
76-
var backgroundImage = VImage.newImage(arena)
77-
.black(finalImageSize, finalImageSize);
75+
var backgroundImage = VImage.black(arena, finalImageSize, finalImageSize);
7876
var insertImage = image
7977
.thumbnailImage(
8078
insertSize,

core/src/main/java/app/photofox/vipsffm/VImage.java

Lines changed: 392 additions & 32 deletions
Large diffs are not rendered by default.

core/src/main/java/app/photofox/vipsffm/VipsHelper.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,46 @@ public static int image_get_concurrency(MemorySegment image, int default_concurr
15931593
return result;
15941594
}
15951595

1596+
/// Binding for:
1597+
/// ```c
1598+
/// int vips_image_get_tile_width(VipsImage *image)
1599+
/// ```
1600+
public static int image_get_tile_width(MemorySegment image) throws VipsError {
1601+
if(!VipsValidation.isValidPointer(image)) {
1602+
VipsValidation.throwInvalidInputError("vips_image_get_tile_width", "image");
1603+
}
1604+
var result = VipsRaw.vips_image_get_tile_width(image);
1605+
return result;
1606+
}
1607+
1608+
/// Binding for:
1609+
/// ```c
1610+
/// int vips_image_get_tile_height(VipsImage *image)
1611+
/// ```
1612+
public static int image_get_tile_height(MemorySegment image) throws VipsError {
1613+
if(!VipsValidation.isValidPointer(image)) {
1614+
VipsValidation.throwInvalidInputError("vips_image_get_tile_height", "image");
1615+
}
1616+
var result = VipsRaw.vips_image_get_tile_height(image);
1617+
return result;
1618+
}
1619+
1620+
/// Binding for:
1621+
/// ```c
1622+
/// VipsImage *vips_image_get_gainmap(VipsImage *image)
1623+
/// ```
1624+
public static MemorySegment image_get_gainmap(Arena arena, MemorySegment image) throws VipsError {
1625+
if(!VipsValidation.isValidPointer(image)) {
1626+
VipsValidation.throwInvalidInputError("vips_image_get_gainmap", "image");
1627+
}
1628+
var result = VipsRaw.vips_image_get_gainmap(image);
1629+
if(!VipsValidation.isValidPointer(result)) {
1630+
VipsValidation.throwInvalidOutputError("vips_image_get_gainmap", "result");
1631+
}
1632+
result = result.reinterpret(arena, VipsRaw::g_object_unref);
1633+
return result;
1634+
}
1635+
15961636
/// Binding for:
15971637
/// ```c
15981638
/// const void *vips_image_get_data(VipsImage *image)

core/src/main/java/app/photofox/vipsffm/enums/VipsAccess.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ public enum VipsAccess implements VNamedEnum {
1919
/// top-to-bottom reading only, but with a small buffer
2020
ACCESS_SEQUENTIAL("VIPS_ACCESS_SEQUENTIAL", "sequential", 1),
2121

22-
ACCESS_SEQUENTIAL_UNBUFFERED("VIPS_ACCESS_SEQUENTIAL_UNBUFFERED", "sequential-unbuffered", 2),
23-
24-
ACCESS_LAST("VIPS_ACCESS_LAST", "last", 3);
22+
/// deprecated, use [VipsAccess#ACCESS_SEQUENTIAL] instead
23+
ACCESS_SEQUENTIAL_UNBUFFERED("VIPS_ACCESS_SEQUENTIAL_UNBUFFERED", "sequential-unbuffered", 2);
2524

2625
public static final String parentName = "VipsAccess";
2726

core/src/main/java/app/photofox/vipsffm/enums/VipsAlign.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public enum VipsAlign implements VNamedEnum {
1919
ALIGN_CENTRE("VIPS_ALIGN_CENTRE", "centre", 1),
2020

2121
/// align high coordinate edge
22-
ALIGN_HIGH("VIPS_ALIGN_HIGH", "high", 2),
23-
24-
ALIGN_LAST("VIPS_ALIGN_LAST", "last", 3);
22+
ALIGN_HIGH("VIPS_ALIGN_HIGH", "high", 2);
2523

2624
public static final String parentName = "VipsAlign";
2725

core/src/main/java/app/photofox/vipsffm/enums/VipsAngle.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ public enum VipsAngle implements VNamedEnum {
2121
ANGLE_D180("VIPS_ANGLE_D180", "d180", 2),
2222

2323
/// 90 degrees anti-clockwise
24-
ANGLE_D270("VIPS_ANGLE_D270", "d270", 3),
25-
26-
ANGLE_LAST("VIPS_ANGLE_LAST", "last", 4);
24+
ANGLE_D270("VIPS_ANGLE_D270", "d270", 3);
2725

2826
public static final String parentName = "VipsAngle";
2927

core/src/main/java/app/photofox/vipsffm/enums/VipsAngle45.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public enum VipsAngle45 implements VNamedEnum {
3333
ANGLE45_D270("VIPS_ANGLE45_D270", "d270", 6),
3434

3535
/// 45 degrees anti-clockwise
36-
ANGLE45_D315("VIPS_ANGLE45_D315", "d315", 7),
37-
38-
ANGLE45_LAST("VIPS_ANGLE45_LAST", "last", 8);
36+
ANGLE45_D315("VIPS_ANGLE45_D315", "d315", 7);
3937

4038
public static final String parentName = "VipsAngle45";
4139

core/src/main/java/app/photofox/vipsffm/enums/VipsBandFormat.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public enum VipsBandFormat implements VNamedEnum {
4040
FORMAT_DOUBLE("VIPS_FORMAT_DOUBLE", "double", 8),
4141

4242
/// double complex (two double) format
43-
FORMAT_DPCOMPLEX("VIPS_FORMAT_DPCOMPLEX", "dpcomplex", 9),
44-
45-
FORMAT_LAST("VIPS_FORMAT_LAST", "last", 10);
43+
FORMAT_DPCOMPLEX("VIPS_FORMAT_DPCOMPLEX", "dpcomplex", 9);
4644

4745
public static final String parentName = "VipsBandFormat";
4846

core/src/main/java/app/photofox/vipsffm/enums/VipsBlendMode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ public enum VipsBlendMode implements VNamedEnum {
8686
BLEND_MODE_DIFFERENCE("VIPS_BLEND_MODE_DIFFERENCE", "difference", 23),
8787

8888
/// somewhat like DIFFERENCE, but lower-contrast
89-
BLEND_MODE_EXCLUSION("VIPS_BLEND_MODE_EXCLUSION", "exclusion", 24),
90-
91-
BLEND_MODE_LAST("VIPS_BLEND_MODE_LAST", "last", 25);
89+
BLEND_MODE_EXCLUSION("VIPS_BLEND_MODE_EXCLUSION", "exclusion", 24);
9290

9391
public static final String parentName = "VipsBlendMode";
9492

0 commit comments

Comments
 (0)