ソースを参照

Fix build caused by GetImageAlphaBorder() (#931)

Fix build failure introduced in 2a913b6587
pull/933/head
Michael Vetter 5年前
committed by Ray
コミット
5f1990e044
2個のファイルの変更5行の追加5行の削除
  1. +1
    -1
      src/raylib.h
  2. +4
    -4
      src/textures.c

+ 1
- 1
src/raylib.h ファイルの表示

@ -1091,7 +1091,7 @@ RLAPI void UnloadTexture(Texture2D texture);
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
RLAPI Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
RLAPI Rectangle GetImageAlphaBorder(Image image); // Get image alpha border rectangle
RLAPI Rectangle GetImageAlphaBorder(Image image, float threshold); // Get image alpha border rectangle
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture)
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
RLAPI Image GetScreenData(void); // Get pixel data from screen buffer and return an Image (screenshot)

+ 4
- 4
src/textures.c ファイルの表示

@ -681,7 +681,7 @@ Vector4 *GetImageDataNormalized(Image image)
}
// Get image alpha border rectangle
Rectangle GetImageAlphaBorder(Image image)
Rectangle GetImageAlphaBorder(Image image, float threshold)
{
Color *pixels = GetImageData(image);
@ -690,11 +690,11 @@ Rectangle GetImageAlphaBorder(Image image)
int yMin = 65536;
int yMax = 0;
for (int y = 0; y < imageo">->height; y++)
for (int y = 0; y < imagep">.height; y++)
{
for (int x = 0; x < imageo">->width; x++)
for (int x = 0; x < imagep">.width; x++)
{
if (pixels[y*imageo">->width + x].a > (unsigned char)(threshold*255.0f))
if (pixels[y*imagep">.width + x].a > (unsigned char)(threshold*255.0f))
{
if (x < xMin) xMin = x;
if (x > xMax) xMax = x;

読み込み中…
キャンセル
保存