-
Notifications
You must be signed in to change notification settings - Fork 79
PAINTROID_457: Add .ora support for save/load #119
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several new files are missing a newline at the end of the file. This is a minor style point but good to keep consistent.
for (var file in archive) { | ||
if (file.isFile && | ||
(file.name.endsWith('.png') || file.name.endsWith('.jpg')) || | ||
file.name.endsWith('.ora')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can ora files be nested? I think this check is redundant.
import 'package:image/image.dart' as img; | ||
|
||
class ProcessOra { | ||
Future<List<ui.Image>> processOraFile(Archive archive) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be parsing the XML file for the correrct layer order.
final savePath = await FilePicker.platform.saveFile( | ||
dialogTitle: 'Save As', | ||
fileName: filename, | ||
bytes: data, // Required for Android/iOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments.
final file = | ||
await File('$saveDirectory/$filename').create(recursive: true); | ||
return Result.ok(await file.writeAsBytes(data)); | ||
// File is already saved by file_picker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments.
if (file.isFile && | ||
(file.name.endsWith('.png') || file.name.endsWith('.jpg')) || | ||
file.name.endsWith('.ora')) { | ||
img.Image? decodedImage = img.decodeImage(file.content as List<int>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If `decodeImage fails, this might silently skip it. More explicit error handling or logging here could be beneficial.
Ora support is too depedant on the layer system. Lets put this PR as draft and continue to work on it after layer PR gets merged. |
PAINTROID-457
New Features and Enhancements
.ora
(OpenRaster) file formatRefactorings and Bug Fixes
.ora
compatibility alongside existing formatscatrobat-img
formatChecklist
Your checklist for this pull request
Please review the contributing guidelines and wiki pages of this repository.