The Code A comes from the project.
The author get the file path with val resourcesPrefix = "src/nativeMain/resources"
and FileSource(path = "$resourcesPrefix/image.png".toPath() ...
, you can see the file structure with Image A.
The Image B is the file structure of my project, how can I get the file path? so I can pass the path parameter to the function ImageEdit(...)
.
BTW, I don't know whether the Code C is correct.
Code A
val resourcesPrefix = "src/nativeMain/resources"
println("\n> Edit images...")
val imageEdit = ImageEdit(
image = FileSource(path = "$resourcesPrefix/image.png".toPath(), fileSystem = FileSystem.SYSTEM),
mask = FileSource(path = "$resourcesPrefix/mask.png".toPath(), fileSystem = FileSystem.SYSTEM),
prompt = "a sunlit indoor lounge area with a pool containing a flamingo",
n = 1,
size = ImageSize.is1024x1024,
)
Code B
val resourcesPrefix = "?????"
val imageEdit = ImageEdit(
image = FileSource(path = "$resourcesPrefix/image.png".toPath(), fileSystem = FileSystem.SYSTEM),
mask = FileSource(path = "$resourcesPrefix/mask.png".toPath(), fileSystem = FileSystem.SYSTEM),
prompt = "a sunlit indoor lounge area with a pool containing a flamingo",
n = 1,
size = ImageSize.is256x256,
)
Code C
val file1="drawable://" + R.drawable.image
val file2="drawable://" + R.drawable.mask
val imageEdit = ImageEdit(
image = FileSource(path = file1.toPath(), fileSystem = FileSystem.SYSTEM),
mask = FileSource(path = file1.toPath(), fileSystem = FileSystem.SYSTEM),
prompt = "a sunlit indoor lounge area with a pool containing a flamingo",
n = 1,
size = ImageSize.is256x256,
)