Skip to content
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

Add support for xyz.amorgan.blurhash in ImageContent #700

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

redstrate
Copy link
Contributor

@redstrate redstrate commented Aug 19, 2023

This adds an optional key to ImageContent, for displaying a blurhash on the client before an image is loaded.

Example consumer in Neochat: https://invent.kde.org/network/neochat/-/merge_requests/1151

@KitsuneRal
Copy link
Member

I'd be happy to see the blurhash generation code in the library too - would you mind moving it over here from the NeoChat MR? :)

@redstrate
Copy link
Contributor Author

I'd be happy to see the blurhash generation code in the library too - would you mind moving it over here from the NeoChat MR? :)

Sure can!

@KitsuneRal KitsuneRal added the enhancement A feature or change request for the library label Sep 11, 2023
@redstrate redstrate force-pushed the work/redstrate/blurhash-support branch from 0ea5d48 to d7f2d33 Compare October 19, 2023 19:29
@redstrate
Copy link
Contributor Author

Okay the blurhash implementation has been moved here, will update the NeoChat MR accordingly

@redstrate redstrate force-pushed the work/redstrate/blurhash-support branch 2 times, most recently from b887bac to 7a4ddda Compare October 19, 2023 19:36
Copy link
Member

@KitsuneRal KitsuneRal left a comment

Choose a reason for hiding this comment

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

Sorry for waiting; overall LGTM save for the tests

Quotient/blurhash.cpp Outdated Show resolved Hide resolved
Quotient/blurhash.cpp Outdated Show resolved Hide resolved
This adds an optional key to ImageContent, for displaying a blurhash on
the client before an image is loaded.
@redstrate redstrate force-pushed the work/redstrate/blurhash-support branch 2 times, most recently from d90d364 to b800ffb Compare July 20, 2024 15:17
So every client that wants to implement blurhashes doesn't have to copy
this file over and over.
@redstrate redstrate force-pushed the work/redstrate/blurhash-support branch from b800ffb to 8bc55f0 Compare July 20, 2024 15:19
Copy link
Member

@KitsuneRal KitsuneRal left a comment

Choose a reason for hiding this comment

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

Mostly LGTM but I have a question regarding the protected piece. I actually thought it would be merely two functions in the interface but you seem to intend something more, apparently?


#include "blurhash.h"

#include <QColorSpace>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#include <QColorSpace>
#include <QtGui/QColorSpace>


#include "quotient_export.h"

#include <QImage>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#include <QImage>
#include <QtGui/QImage>

*/
static QUOTIENT_API QString encode(const QImage &image, int componentsX = 4, int componentsY = 4);

protected:
Copy link
Member

Choose a reason for hiding this comment

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

protected implies inheriting from a class - do you expect that clients should derive from this class and somehow use its static internals?

static QUOTIENT_API QString encode(const QImage &image, int componentsX = 4, int componentsY = 4);

protected:
struct Components {
Copy link
Member

Choose a reason for hiding this comment

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

Why not alias QPoint or std::pair?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or change request for the library
Projects
Status: 0.9 - To Do
Development

Successfully merging this pull request may close these issues.

2 participants