Skip to content

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Amit-Matth
Copy link
Contributor

@Amit-Matth Amit-Matth commented May 30, 2025

PAINTROID-457

New Features and Enhancements

  • Added support for saving and loading .ora (OpenRaster) file format

Refactorings and Bug Fixes

  • Adjusted related logic to support .ora compatibility alongside existing formats
  • Fixed folder location handling for saving in catrobat-img format
  • Fixed the compliance issue with scoped storage PAINTROID-678

Checklist

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Add the link to the ticket in Jira in the description of the PR
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines (Wiki)
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Add new information to the Wiki

Copy link
Contributor

@bakicelebi bakicelebi left a 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')) {
Copy link
Contributor

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 {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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>);
Copy link
Contributor

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.

@bakicelebi
Copy link
Contributor

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.

@bakicelebi bakicelebi marked this pull request as draft May 31, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants