Skip to content

Conversation

@mgmechanics
Copy link
Contributor

Proposal for a patch for Imaging-159 using a POJO.

I already applied the POJO Parameter Object classes so that they are replace the Map<String, Object> in all classes including test code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we should work on after we have added ImagingParameters. IMHO if the parameter is optional, there should be a method overload that doesn't take the parameter.

@kinow
Copy link
Member

kinow commented Dec 23, 2017

Looks like the code from the pull request and the code in the master branch have moved into too different directions, and it can't be updated any longer.

@mgmechanics let me know if you are able to update your pull request to the latest code, please.

Thanks
Bruno

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than the hashmaps, but would need some feedback addressed. Lots of useful new code & tests. With a few changes I think it would be ready to be merged and replace the hashmaps. Any suggestion @ebourg ?

* for internal use by ImageParser implementations.
* A utility method to whether we have a parameter object and if the STRICT
* flag is set or not.
* Intended for internal use by ImageParser implementations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some re-wording here

"Return whether to use a strict mode or not when reading or writing images."

or similar?

ip.setFileNameHint("Teststring");
assertEquals("Teststring", ip.getFileNameHint());
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing extra newline.

* Map of optional parameters, defined in ImagingConstants.
* @return Xmp Xml as String, if present. Otherwise, returns null.
* @throws org.apache.commons.imaging.ImageReadException
* @throws java.io.IOException
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary to use fully qualified names. But doesn't hurt I guess.

tmpReadThumbnails = Boolean.TRUE.equals(params
.get(ImagingConstants.PARAM_KEY_READ_THUMBNAILS));
if (params != null) {
if (params instanceof ImagingParametersTiff) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if statement can be combined I think.

}


// if we got at lease one of theseparameters: x, y, width or height
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/at lease/at least
s/theseparameters/these parameters

}

// read parameters specific for the PNM format
if (params instanceof ImagingParametersPnm) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we could use generics, instead of checking instance types. The parameters of PnmImageParser must definitely be an ImagingParametersPnm I believe.

// text chunks are parameters specific for PNG images
// so we need to ask first if parameters specific for PNG images are provided
// than ask for text chunks
if (parameters instanceof ImagingParametersPng) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good if generics could be used here to avoid the instanceof, or another way to model objects.


/**
* This class is a POJO holding data for parameters as requested in IMAGING-159.
* It holds additional data needed for the PCX format only.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be rewritten I think. Not necessary to say that it was requested and include what issue was.

@kinow kinow added the someday label Jul 5, 2021
* Parameter used to hint the filename when reading from a byte array
* or InputStream. The filename hint can help disambiguate what file the
* image format.
* <p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close HTML tags.

@garydgregory
Copy link
Member

Needs a rebase and pre-review to make sure this is needed: Git master has an ImagingParameters today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants