Vulkan2D
2D renderer written in C using Vulkan and SDL2
Loading...
Searching...
No Matches
Texture.h
Go to the documentation of this file.
1
4#pragma once
5#include <vulkan/vulkan.h>
6#include "VK2D/Structs.h"
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
16VK2DTexture vk2dTextureLoadFromImage(VK2DImage image);
17
22VK2DTexture vk2dTextureLoad(const char *filename);
23
29VK2DTexture vk2dTextureFrom(const void *data, int size);
30
37VK2DTexture vk2dTextureCreate(float w, float h);
38
45bool vk2dTextureUpdate(VK2DTexture tex, const void *pixels);
46
57bool vk2dTextureUpdateRegion(VK2DTexture tex, const void *pixels, int x, int y, int w, int h);
58
62float vk2dTextureWidth(VK2DTexture tex);
63
67float vk2dTextureHeight(VK2DTexture tex);
68
72bool vk2dTextureIsTarget(VK2DTexture tex);
73
77VK2DImage vk2dTextureGetImage(VK2DTexture tex);
78
84uint32_t vk2dTextureGetID(VK2DTexture tex);
85
88void vk2dTextureFree(VK2DTexture tex);
89
95bool vk2dTextureCopyPixels(VK2DTexture tex, void *outPixels);
96
97#ifdef __cplusplus
98};
99#endif
Forward declares struct typedefs.
VK2DTexture vk2dTextureLoad(const char *filename)
Loads a texture from a file (png, bmp, jpg, tiff).
void vk2dTextureFree(VK2DTexture tex)
Frees a texture from memory.
bool vk2dTextureUpdate(VK2DTexture tex, const void *pixels)
Replaces all pixels of a texture.
VK2DTexture vk2dTextureFrom(const void *data, int size)
Same as vk2dTextureLoad but it uses a byte buffer instead of pulling from a file.
VK2DImage vk2dTextureGetImage(VK2DTexture tex)
Returns a texture's internal image.
VK2DTexture vk2dTextureCreate(float w, float h)
Creates a texture meant as a drawing target - see vk2dRendererSetTarget.
uint32_t vk2dTextureGetID(VK2DTexture tex)
Returns a unique ID for this texture.
bool vk2dTextureCopyPixels(VK2DTexture tex, void *outPixels)
Reads a texture's pixels back from the GPU.
float vk2dTextureWidth(VK2DTexture tex)
Gets the width in pixels of a texture.
bool vk2dTextureIsTarget(VK2DTexture tex)
Checks if a texture was created as a target or not.
VK2DTexture vk2dTextureLoadFromImage(VK2DImage image)
Creates a texture from an image.
bool vk2dTextureUpdateRegion(VK2DTexture tex, const void *pixels, int x, int y, int w, int h)
Replaces a rectangle of pixels in a texture.
float vk2dTextureHeight(VK2DTexture tex)
Gets the height in pixels of a texture.