/
mms_attachment_image.h
100 lines (82 loc) · 2.48 KB
/
mms_attachment_image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* Copyright (C) 2013-2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef JOLLA_MMS_ATTACHMENT_IMAGE_H
#define JOLLA_MMS_ATTACHMENT_IMAGE_H
#include "mms_attachment.h"
typedef struct mms_attachment_image_size {
unsigned int width;
unsigned int height;
} MMSAttachmentImageSize;
typedef struct mms_attachment_image_resize {
MMSAttachmentImageSize image;
MMSAttachmentImageSize in;
MMSAttachmentImageSize out;
} MMSAttachmentImageResize;
typedef struct mms_attachment_image {
MMSAttachment attachment;
int resize_step;
char* resized;
} MMSAttachmentImage;
typedef struct mms_attachment_image_class {
MMSAttachmentClass attachment;
/* Creates the resize context, sets image size */
MMSAttachmentImageResize*
(*fn_resize_new)(
MMSAttachmentImage* image,
const char* file);
/* Prepares the resize context for writing, sets input size */
gboolean
(*fn_resize_prepare)(
MMSAttachmentImageResize* resize,
const char* file);
/* Reads the next scanline in RGB24 format */
gboolean
(*fn_resize_read_line)(
MMSAttachmentImageResize* resize,
unsigned char* rgb24);
/* Writes the next scanline in RGB24 format */
gboolean
(*fn_resize_write_line)(
MMSAttachmentImageResize* resize,
const unsigned char* rgb24);
/* Finishes resizing */
void (*fn_resize_finish)(
MMSAttachmentImageResize* resize);
/* Frees the resize context */
void (*fn_resize_free)(
MMSAttachmentImageResize* resize);
} MMSAttachmentImageClass;
int
mms_attachment_image_next_resize_step(
MMSAttachmentImage* image,
const MMSSettingsSimData* settings,
unsigned int columns,
unsigned int rows);
const char*
mms_attachment_image_prepare_filename(
MMSAttachmentImage* image);
#ifdef MMS_RESIZE_QT
gboolean
mms_attachment_image_resize_qt(
MMSAttachmentImage* image,
const MMSSettingsSimData* settings);
#endif
#endif /* JOLLA_MMS_ATTACHMENT_IMAGE_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/