summaryrefslogtreecommitdiff
path: root/src/apps/cam/sdl_texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/apps/cam/sdl_texture.h')
-rw-r--r--src/apps/cam/sdl_texture.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/apps/cam/sdl_texture.h b/src/apps/cam/sdl_texture.h
new file mode 100644
index 00000000..6ccd85ea
--- /dev/null
+++ b/src/apps/cam/sdl_texture.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2022, Ideas on Board Oy
+ *
+ * sdl_texture.h - SDL Texture
+ */
+
+#pragma once
+
+#include <vector>
+
+#include <SDL2/SDL.h>
+
+#include "image.h"
+
+class SDLTexture
+{
+public:
+ SDLTexture(const SDL_Rect &rect, uint32_t pixelFormat, const int stride);
+ virtual ~SDLTexture();
+ int create(SDL_Renderer *renderer);
+ virtual void update(const std::vector<libcamera::Span<const uint8_t>> &data) = 0;
+ SDL_Texture *get() const { return ptr_; }
+
+protected:
+ SDL_Texture *ptr_;
+ const SDL_Rect rect_;
+ const uint32_t pixelFormat_;
+ const int stride_;
+};