Blender  V3.3
imbuf/intern/dds/Image.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 /*
8  * This file is based on a similar file from the NVIDIA texture tools
9  * (http://nvidia-texture-tools.googlecode.com/)
10  *
11  * Original license from NVIDIA follows.
12  */
13 
14 /* This code is in the public domain -- <castanyo@yahoo.es> */
15 
16 #pragma once
17 
18 #include "Color.h"
19 #include "Common.h"
20 
22 class Image {
23  public:
24  enum Format {
27  };
28 
29  Image();
30  ~Image();
31 
32  void allocate(uint w, uint h);
33 #if 0
34  bool load(const char *name);
35 
36  void wrap(void *data, uint w, uint h);
37  void unwrap();
38 #endif
39 
40  uint width() const;
41  uint height() const;
42 
43  const Color32 *scanline(uint h) const;
44  Color32 *scanline(uint h);
45 
46  const Color32 *pixels() const;
47  Color32 *pixels();
48 
49  const Color32 &pixel(uint idx) const;
50  Color32 &pixel(uint idx);
51 
52  const Color32 &pixel(uint x, uint y) const;
53  Color32 &pixel(uint x, uint y);
54 
55  Format format() const;
56  void setFormat(Format f);
57 
58  private:
59  void free();
60 
61  private:
62  uint m_width;
63  uint m_height;
64  Format m_format;
65  Color32 *m_data;
66 };
67 
68 inline const Color32 &Image::pixel(uint x, uint y) const
69 {
70  return pixel(y * width() + x);
71 }
72 
74 {
75  return pixel(y * width() + x);
76 }
unsigned int uint
Definition: BLI_sys_types.h:67
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
Definition: Color.h:19
~Image()
Definition: Image.cpp:25
Format format() const
Definition: Image.cpp:100
void allocate(uint w, uint h)
Definition: Image.cpp:30
const Color32 * pixels() const
Definition: Image.cpp:72
const Color32 & pixel(uint idx) const
Definition: Image.cpp:82
Image()
Definition: Image.cpp:21
uint height() const
Definition: Image.cpp:49
const Color32 * scanline(uint h) const
Definition: Image.cpp:54
void setFormat(Format f)
Definition: Image.cpp:105
uint width() const
Definition: Image.cpp:44
static PartialUpdateUserImpl * unwrap(struct PartialUpdateUser *user)
static struct PartialUpdateUser * wrap(PartialUpdateUserImpl *user)