Commit Graph

245 Commits

Author SHA1 Message Date
Ray
693c9c292a Formatting tweaks 2025-05-10 22:45:08 +02:00
Henrik A. Glass
4f5a20a634
Add missing increments of k in LoadImageDataNormalized() (#4745) 2025-02-01 21:30:21 +01:00
Asdqwe
f6f31a9f21
[rtextures] Fix HalfToFloat() and FloatToHalf() dereferencing issues with an union (#4729)
* Fix HalfToFloat() and FloatToHalf() dereferencing issues with an union

* Remove unnecessary initialization

* Moved the union to inside the functions
2025-01-26 21:26:18 +01:00
Nikolas
49d37b035f
[rtexture] Cubemap mipmap loading improvements (#4721)
* [rtextures] Only build cubemap mipmaps when necessary

* [rtextures] Assign correct mipmap count to cubemaps
2025-01-24 10:41:32 +01:00
sleeptightAnsiC
10d0616d1f
fix(rtextures): TCC not being able to compile due to: 'emmintrin.h' not found (#4707)
define STBIR_NO_SIMD when __TINYC__ is defined so stb_image_resize2 will
not include *mmintrin which are not supported by all compilers.

There are similar checks for __TINYC__ already elswere in raylib
and they are also mostly there to disable SIMD headers.

Additionally, move similar check for stb_image, to be a little bit
deeper. Before it was defining STBI_NO_SIMD without including stb_image
It was also clashing with note, causing said note to make no sense.

Fixes: https://github.com/raysan5/raylib/discussions/2994
Reference: https://github.com/nothings/stb/issues/1738
2025-01-19 12:06:27 +01:00
Ray
fa0eada61a Update year to 2025 2025-01-01 00:02:52 +01:00
Ray
ab83e6dd41 Image manipulation functions depend on a flag 2024-12-19 13:24:30 +01:00
Ray
6b220f2798 Review formating 2024-12-12 12:13:17 +01:00
Ray
1f45e7af76 REVIEWED: Coding conventions 2024-12-03 19:14:14 +01:00
Ray
962f1c26ff Review formatting to follow raylib conventions 2024-12-01 23:10:59 +01:00
Jeffery Myers
55a64f51b8
fix float casting warnings (#4471) 2024-11-07 21:42:59 +01:00
decromo
281ee51aff
implemented new linear gradient generation function (#4462) 2024-11-04 15:57:50 +01:00
Nikolas
38cf9f3224
[rtextures] LoadTextureCubemap(): Copy image before generating mipmaps, to avoid dangling re-allocated pointers (#4439) 2024-10-26 22:52:24 +02:00
Ray
7ad8fa689f REVIEWED: LoadTextureCubemap() to avoid crash #4429 2024-10-26 13:51:10 +02:00
Ray
80b490c8f1 Reviewed formating to follow raylib conventions #4429 2024-10-26 12:15:06 +02:00
Nikolas
7fedf9e0b8
[rtextures/rlgl] Load mipmaps for cubemaps (#4429)
* [rlgl] Load cubemap mipmaps

* [rtextures] Only generate mipmaps that don't already exist

* [rtextures] ImageDraw(): Implement drawing to mipmaps

* [rtextures] Load cubemap mipmaps
2024-10-26 12:09:38 +02:00
Jeffery Myers
0b650f62a6
[RTEXTURES] Remove the panorama cubemap layout option (#4425)
* Remove the panorama cubemap layout, it was not implemented.
Left a todo in the code for some aspiring developer to finish.

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-24 09:06:24 +02:00
Ray
708089f560 Reviewed and reverted unneeded module check, rtextures should not depend on rtext 2024-10-23 23:29:05 +02:00
Ray
f141c75cde Removed trailing spaces 2024-10-21 17:00:52 +02:00
Nikolas
51ff6586f4
[rtextures] ImageDraw(): Don't try to blend images without alpha (#4395) 2024-10-21 00:31:01 +02:00
Ray
8cbf34ddc4 WARNING: BREAKING: Renamed several functions for data validation #3930 2024-10-16 19:26:12 +02:00
R-YaTian
8d267aaf23
qoi: Added support for image of channels 3 (#4384) 2024-10-15 19:03:17 +02:00
Ray
1effe92129 WARNING: REMOVED: SVG files loading and drawing, moving it to raylib-extras 2024-10-10 20:37:46 +02:00
Ray
3fb1ba25ac Removed tabs and triple line-breaks 2024-10-08 18:45:52 +02:00
Ray
0e4ebaf89d REVIEWED: DrawTexturePro() to avoid negative dest rec #4316 2024-09-15 13:20:43 +02:00
Ray
e9bbf02b2b Update rtextures.c 2024-09-15 13:03:12 +02:00
Ray
b807f633d9 REVIEWED: ColorLerp() formatting #4310 2024-09-15 13:01:59 +02:00
SusgUY446
ddc523ffbe
[rtextures] add MixColors. a function to mix 2 colors together (#4310)
* added MixColors function to mix 2 colors together (Line 1428 raylib.h and Line 4995 in rtextures.c)

* renamed MixColors to ColorLerp (https://github.com/raysan5/raylib/pull/4310#issuecomment-2340121038)

* changed ColorLerp to be more like other functions

---------

Co-authored-by: CI <-ci@not-real.com>
2024-09-15 12:55:45 +02:00
Bugsia
77172e34db
Fixing GenImagePerlinNoise() being stretched, if Image is not rectangular (#4276) 2024-08-23 22:22:36 +02:00
hanaxars
7fab03c0b4
Fix warnings (#4264)
Fix following gcc warnings when SVG enabled:

rtextures.c: In function 'LoadImageSvg':
rtextures.c:374:52: warning: pointer targets in passing argument 1 of 'nsvgParse' differ in signedness [-Wpointer-sign]
  374 |             struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
      |                                                    ^~~~~~~~
      |                                                    |
      |                                                    unsigned char *
In file included from rtextures.c:230:
external/nanosvg.h:2952:28: note: expected 'char *' but argument is of type 'unsigned char *'
 2952 | NSVGimage* nsvgParse(char* input, const char* units, float dpi)
      |                      ~~~~~~^~~~~
rtextures.c:407:43: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  407 |         if (isSvgStringValid && (fileData != fileNameOrString)) UnloadFileData(fileData);
      |                                           ^~
rtextures.c: In function 'LoadImageFromMemory':
rtextures.c:614:52: warning: passing argument 1 of 'nsvgParse' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  614 |             struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
      |                                                    ^~~~~~~~
external/nanosvg.h:2952:28: note: expected 'char *' but argument is of type 'const unsigned char *'
 2952 | NSVGimage* nsvgParse(char* input, const char* units, float dpi)
      |                      ~~~~~~^~~~~
2024-08-19 13:41:20 +02:00
Ray
5af331d708 REVIEWED #4206 2024-08-07 01:01:45 +02:00
Ray
9c2ba3bfb7 REVIEWED: possible overflow... again #4206 2024-08-04 23:22:27 +02:00
Ray
923f983719 REVIEWED: Possible overflow #4206 2024-08-04 22:08:38 +02:00
Jutastre
f5d2f8d545
Warning on invalid image data (#4179)
* Adds log warnings on invalid file data

* Separate error on missing file extension

* Changed LOG_ERROR to LOG_WARNING

---------

Co-authored-by: Jutastre <pukarlindgren@gmail.com>
2024-07-24 21:21:45 +02:00
Ray
474ab48f8b Update rtextures.c 2024-07-21 10:28:34 +02:00
Julianiolo
aa70d32786
Fix a dependance of rtexture to rtext (#4171) 2024-07-20 10:39:14 +02:00
Jeffery Myers
9d3bd43c6e
[CORE] Fix MSVC warnings/errors and raymath.h in C++ (#4125)
* Update raylib_api.* by CI

* Fix MSVC warnings.
Make raymath.h work in C++ in MSVC

* whitespace cleanup

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-01 22:03:21 +02:00
Bruno Cabral
b5473d5ffd
[rtextures] advance k in LoadImageColors (#4120)
Some formats are not advancing k to get pixels values
2024-07-01 12:24:01 +02:00
Ray
1e1061d5c7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:37:58 +02:00
Ray
17cbc75aa7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:07:38 +02:00
Bruno Cabral
6e2661f92d
[rtextures] Created ImageFromChannel() (#4105)
* created ImageFromChannel

Adds the possibility to extract a specific channel from an image

* naming convention

* example window height

* removed threshold

* removed alpha channel

* channel example organization

* updated channel example image
2024-06-30 10:33:32 +02:00
Ray
385e60dd41 Minor tweaks 2024-06-24 18:41:33 +02:00
Jeffery Myers
e96bab7ce6
[Build] Fix warnings when building in VS 2022 (#4095)
* Update raylib_api.* by CI

* Fix warnings when building examples in MSVC 2022

* fix auto-format that sneaked in there.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-24 17:47:32 +02:00
Le Juez Victor
c2df169847
[rtextures] Adding ImageDrawLineEx function (#4097)
* adding `ImageDrawLineEx` function
also review other functions for drawing lines in images

* fix `ImageDrawLineV`
2024-06-24 09:27:59 +02:00
Le Juez Victor
7e50270d49
[rtextures] Adding triangle drawing function for images (#4094)
* adding triangle drawing function for images

* remove unnecessary check

* fix an iteration mistake
2024-06-23 22:51:24 +02:00
Le Juez Victor
f2344cd089
review color tint functions (#4015) 2024-05-29 23:44:20 +02:00
Ray
3abb6d9eaf REVIEWED: ColorToInt() PR 2024-05-21 20:52:48 +02:00
OetkenPurveyorOfCode
9ef29aff9a
[rtextures] Fix Undefined behaviour in ColorToInt (#3996) 2024-05-21 15:44:02 +02:00
Ray
763129e96b Reviewed some warnings 2024-05-01 18:12:57 +02:00
Ray
3caa424ad4 Review formatting 2024-04-21 12:29:09 +02:00
Ray
cf47fbb20b REVIEWED: LoadImageRaw() #3926 2024-04-20 23:58:22 +02:00
Ray
8f24d86c1f REVIEWED: LoadImageRaw() #3926 2024-04-20 23:44:07 +02:00
Ray
e85f245ad4 REVIEWED: Remove final punctuation in code comments 2024-04-20 20:31:06 +02:00
Ray
29ce13b777 Code gardening
- Review formatting
 - Improve readability for some functions result return
 - Minimize early returns
 - Align LoadFileData() to UnloadFileData()
2024-04-20 13:53:13 +02:00
Ray
2754c80596 Added security checks #3924 2024-04-20 13:50:34 +02:00
Ray
a17a81f05b Review code formating 2024-04-19 21:13:52 +02:00
proberge-dev
b905dafca0
[rtextures] Fix LoadImageFromScreen scaling (#3881) 2024-03-26 08:47:25 +01:00
Ray
fea3395fc1 Review formatting 2024-02-29 18:50:44 +01:00
Ray
1e8450665c ADDED: New function ColorIsEqual() 2024-02-29 18:40:10 +01:00
Ray
ed9a6d862b Update rtextures.c 2024-02-28 16:27:55 +01:00
Ray
7d6e59170b Update rtextures.c 2024-02-26 10:49:04 +01:00
Gary M
53cfc7c965
assign format to cubemap (#3823) 2024-02-26 10:26:39 +01:00
Ray
e42e3188f5 Remove some unneeded line breaks 2024-02-18 11:59:40 +01:00
Jeffery Myers
4cd71a9750
Fix warnings in raylib (#3793) 2024-02-10 20:02:05 +01:00
Ray
615ee9d177 REVIEWED: rlLoadFramebuffer() 2024-02-04 12:13:56 +01:00
Ray
c57b8d5a6a REVIEWED: ImageKernelConvolution(), formating and warnings 2024-01-15 20:32:46 +01:00
Blockguy24
d2b1256e5c
Fix bounds check for ImageDrawRectangleRec (#3732) 2024-01-14 11:21:29 +01:00
Lieven Petersen
a820c37ab2
implemented fill color TODO in ImageResizeCanvas() (#3720) 2024-01-11 19:48:14 +01:00
Le Juez Victor
746f129bfe
Fix ImageDrawRectangleRec (#3721) 2024-01-11 19:37:42 +01:00
Alice Nyaa
be0ea89f83
Simplified for loop for some image manip functions (#3712) 2024-01-06 19:41:43 +01:00
Ray
b4cb0f3e7d REVIEWED: LoadImageAnimFromMemory() #3704 2024-01-05 22:33:56 +01:00
ubkp
19bdcedf1c
Hide unused warnings from stb_image_resize2.h (#3708) 2024-01-05 22:22:58 +01:00
Ray
3f1e59a7cf Update copyright to 2024 2024-01-02 20:58:12 +01:00
ubkp
fd5e1e6afb
[rtextures] Fix LoadImageAnimFromMemory() warning for fileData (#3686)
* Fix LoadImageAnimFromMemory() warning for fileData

* Add LoadImageAnimFromMemory() to raylib.h

* Fix missing ; on previous commit
2023-12-28 23:15:04 +01:00
IoIxD
3fc43c1096
LoadImageAnimFromMemory (#3681) 2023-12-28 20:12:52 +01:00
Ray
e039a221a3 Review formating 2023-12-23 14:07:45 +01:00
Ray
1792bce292 REVIEWED: LoadTextureCubemap(), added mipmaps #3665 2023-12-23 11:26:23 +01:00
Ray
d29b36310f Merge branch 'master' of https://github.com/raysan5/raylib 2023-12-14 15:32:45 +01:00
Ray
88db11fda4 Update rtextures.c 2023-12-14 15:30:48 +01:00
Romash
222f6f7877
Fix box blur symmetry & simplify code (#3631) 2023-12-13 21:21:08 +01:00
Ray
6f3c87a999 Fix #3613 2023-12-11 09:21:30 +01:00
Karim
21469e92b0
Image convolution function ImageKernelConvolution (#3528)
* Added image convultion ImageKernelConvolution

* comment changes

* spelling changes and change to kernel size

* removed kernel normalization inside function

* fix to formating
2023-11-18 20:05:45 +01:00
Ray
fe757b6267 Update rtextures.c 2023-11-08 17:40:23 +01:00
Ray
64d64cc181 REVIEWED: Potential code issues reported by CodeQL #3476 2023-11-01 15:28:18 +01:00
Babak
0f4a8cf7cb
Ported to stb_image_resize2.h (#3403) 2023-10-13 16:37:35 +02:00
Ray
67a1e1ffae Update rtextures.c 2023-10-10 10:48:46 +02:00
Masoud Naservand
d309b1eaa7
Call nsvgDeleteRasterizer() on created rasterizer (#3392)
the `NSVGrasterizer *rast` needs to be passed
to nsvgDeleteRasterizer() when we are done with it.
2023-10-09 09:47:54 +02:00
Ray
f2389a1e55 Remove trail spaces 2023-09-26 12:54:24 +02:00
Ray
97c4333803 REVIEWED: UnloadRenderTexture(), additional check 2023-09-17 20:42:45 +02:00
Ray
528b879955 Update rtextures.c 2023-09-13 17:05:22 +02:00
Rob Loach
30f8dd6e37
rtextures: Fix ImageDraw() source clipping when drawing beyond top left (#3306) 2023-09-11 19:00:30 +02:00
Ray
8a82e17a79 Update rtextures.c 2023-09-04 18:43:03 +02:00
Ray
67a693fc5b REVIEWED: LoadImageSvg() 2023-09-02 19:20:56 +02:00
Ray
d6f3891009 REVIEWED: LoadImageSvg() 2023-09-02 13:16:44 +02:00
bXi
c03ab03627
Added rudimentary SVG support. (#2738)
* Added rudimentary SVG support. Added 2 functions ImageLoadSvg and ImageLoadSvgWithSize.

* Added an example on how to use ImageLoadSvgWithSize and adjusted Makefiles accordingly.

* Added actual correct example file.

* Reviewed the code to keep the raylib coding conventions in mind.
Moved the LoadImageSvg() code into LoadImage() guarded by SUPPORT_FILEFORMAT_SVG.
Renamed LoadImageSvgWithSize() to LoadImageSvg().
Added a LoadImageSvgFromString() function to parse the loaded SVG into an actual image. This does the bulk of the work.

* Fixed typo.

---------

Co-authored-by: Ray <raysan5@gmail.com>
2023-09-02 13:00:18 +02:00
Ray
0f447f1fb6 REVIEWED: Data size type consistency between functions #3168 2023-09-02 12:05:34 +02:00
Johannes Barthelmes
0f39051562
Fix uninitialized thread-locals in stbi #3282 (#3283) 2023-09-02 11:41:33 +02:00
Ray
9646497216 Formating review 2023-08-27 00:30:56 +02:00
Jeffery Myers
21f5482e0d
[Image] Validate that ImageDrawRectangleRec is drawing entirely inside the image (#3264)
* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading

* sound_multi example

* Validate that image rect drawing is inside the image so we don't overflow a buffer

* remove files that should not have been added.

* remove changes that should not have been

* revert

* adsfasdfsdfsdf
2023-08-26 14:43:14 +02:00
Ray
93f59a6f59 Review tabs and trail-spaces 2023-08-10 22:47:17 +02:00