CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
FxUIPixmap.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2025 by Graebert GmbH.
3//
4// Permission to use, copy, modify, and distribute this software in
5// object code form for any purpose and without fee is hereby granted,
6// provided that the above copyright notice appears in all copies and
7// that both that copyright notice and the limited warranty and
8// restricted rights notice below appear in all supporting
9// documentation.
10//
11// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15// UNINTERRUPTED OR ERROR FREE.
16
17#pragma once
18
22
24#include "../UI/FxUIEnum.h"
25#include "FxUIGlobalDefines.h"
26#include "FxUISize.h"
27#include "FxUIColor.h"
28#include "FxUIPaintDevice.h"
29
30#if defined( XENON )
31namespace Wt
32{
33 class WLink;
34}
35using FxNativePixmap = Wt::WLink;
36#else
37class QPixmap;
38using FxNativePixmap = QPixmap;
39#endif
40
41class CFxUIPixmapImpl;
42class CFxUIImage;
43class CFxUIByteArray;
44
46{
47public:
49 {
50 IgnoreAspectRatio, // The size is scaled freely. The aspect ratio is not preserved.
51 KeepAspectRatio, // The size is scaled to a rectangle as large as possible inside a given rectangle, preserving the aspect ratio.
52 KeepAspectRatioByExpanding // The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio.
53 };
54
56 {
57 FastTransformation, // The transformation is performed quickly, with no smoothing.
58 SmoothTransformation // The resulting image is transformed using bilinear filtering.
59 };
60
61public:
62
65
68 CFxUIPixmap( const CFxUIString& fileName );
69
71 CFxUIPixmap( const CFxUIPixmap& pixmap );
72 CFxUIPixmap( const FxNativePixmap& pixmap );
73
76
79
80 operator FxNativePixmap&() const;
81
87 void fill( const CFxUIColor& color = FxUIGlobalColor::white );
88
97
105 bool load( const CFxUIString& fileName );
106
118 bool save( const CFxUIString& fileName, const char* format = nullptr, int quality = -1 ) const;
119
134
145
152
158 void setUrl( const CFxUIString& url );
159
166
172 int width();
173
180
186 bool isNull();
187
188protected:
189 CFxUIPixmapImpl* m_pImpl = nullptr;
190};
#define COMMONUI_API
@ white
Definition FxUIEnum.h:80
CFxString CFxUIString
QPixmap FxNativePixmap
Definition FxUIPixmap.h:38
CFxUIPaintDevice(FxNativePaintDevice *paintDevice=nullptr)
CFxUIPixmap(const FxNativePixmap &pixmap)
bool save(const CFxUIString &fileName, const char *format=nullptr, int quality=-1) const
CFxUIImage toImage() const
CFxUIPixmap & operator=(const CFxUIPixmap &pixmap)
bool isNull()
CFxUIPixmap scaled(int width, int height, AspectRatioMode aspectRatioMode=IgnoreAspectRatio, TransformationMode transformMode=FastTransformation) const
bool load(const CFxUIString &fileName)
CFxUIPixmap(const CFxUIPixmap &pixmap)
CFxUIPixmapImpl * m_pImpl
Definition FxUIPixmap.h:189
CFxUIPixmap(const CFxUIString &fileName)
@ FastTransformation
Definition FxUIPixmap.h:57
@ SmoothTransformation
Definition FxUIPixmap.h:58
CFxUISize size()
CFxUIString url() const
@ IgnoreAspectRatio
Definition FxUIPixmap.h:50
@ KeepAspectRatioByExpanding
Definition FxUIPixmap.h:52
CFxUIPixmap scaledToWidth(int width, TransformationMode mode=FastTransformation) const
void fill(const CFxUIColor &color=FxUIGlobalColor::white)
CFxUIPixmap(int width, int height)
void setUrl(const CFxUIString &url)
bool loadFromData(const CFxUIByteArray &data)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition gles2_ext.h:110
GLint GLint GLint GLsizei GLsizei GLenum format
Definition gles2_ext.h:111
GLint GLenum GLsizei GLsizei height
Definition gles2_ext.h:110
Definition FxString.h:30