1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
\r
4 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
\r
5 <meta http-equiv="Content-Style-Type" content="text/css">
\r
6 <meta name="keywords" content="Simple Directmedia Layer SDL2.0">
\r
7 <link rel="top" href="index.html" title="
\83z
\81[
\83\80">
\r
8 <link rel="parent" href="CategoryPixels.html" title="1
\82Â
\8fã">
\r
9 <title>SDL_AllocPalette</title>
\r
12 <a href="index.html">
\96Ú
\8e\9f</a> - <a href="ApiByCategory.html">API(
\8b@
\94\
\95Ê)</a> - <a href="CategoryPixels.html">
\83s
\83N
\83Z
\83\8b\8c`
\8e®
\82Æ
\95Ï
\8a·</a> - SDL_AllocPalette
\r
14 <h1>SDL_AllocPalette</h1>
\r
15 \8ew
\92è
\82Ì
\90F
\90\94\82Ì
\83p
\83\8c\83b
\83g
\82ð
\90¶
\90¬
\82·
\82é
\r
17 <code>SDL_Palette* SDL_AllocPalette(int ncolors)</code>
\r
19 <table border="1" summary="SDL_AllocPalette">
\r
20 <tr><td>ncolors</td><td>
\83p
\83\8c\83b
\83g
\82Ì
\90F
\90\94</td></tr>
\r
22 <h2>
\96ß
\82è
\92l</h2>
\r
23 \90¬
\8c÷
\82Ì
\82Æ
\82«
\90¶
\90¬
\82³
\82ê
\82½<a href="SDL_Palette.html">SDL_Palette</a>,
\8e¸
\94s(
\8f\
\95ª
\82È
\83\81\83\82\83\8a\82ª
\82È
\82¢
\93\99)
\82Ì
\82Æ
\82«NULL
\82ð
\96ß
\82·.
\r
24 <a href="SDL_GetError.html">SDL_GetError()</a>
\82Å
\8fÚ
\8d×
\82ð
\92m
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82é.
\r
25 <h2>
\83T
\83\93\83v
\83\8b\83R
\81[
\83h</h2>
\r
29 SDL_Palette* palette = nullptr;
\r
33 SDL_Init(SDL_EVERYTHING);
\r
35 // 4
\90F
\82Ì
\83p
\83\8c\83b
\83g
\82ð
\90V
\82½
\82É
\90¶
\90¬
\82·
\82é
\r
37 palette = SDL_AllocPalette(4);
\r
39 if (palette == nullptr) printf( "
\83G
\83\89\81[: %s\n", SDL_GetError() );
\r
43 //
\83p
\83\8c\83b
\83g0
\82Ì
\97Î
\90¬
\95ª
\82Æ
\90Â
\90¬
\95ª
\82ð0
\82É
\82·
\82é
\r
45 palette->colors[0].g = 0;
\r
46 palette->colors[0].b = 0;
\r
48 //
\83\8c\83\93\83_
\83\89\82ð
\90Ô
\90F
\82É
\90Ý
\92è
\82·
\82é
\r
50 SDL_SetRenderDrawColor(renderer, palette->colors[0].r, palette->colors[0].g, palette->colors.b, palette->colors[0].a);
\r
54 SDL_FreePalette(palette);
\r
59 \83p
\83\8c\83b
\83g
\82Ì
\8f\89\8aú
\92l
\82Í
\94\92\82Å
\82 \82é.
\r
60 <h2>
\83o
\81[
\83W
\83\87\83\93</h2>
\r
62 <h2>
\8aÖ
\98A
\8d\80\96Ú(
\8aÖ
\90\94)</h2>
\r
63 <a href="SDL_FreePalette.html">SDL_FreePalette</a><br>
\r
64 <h2>SDL Wiki
\82Ö
\82Ì
\83\8a\83\93\83N</h2>
\r
65 <a href="https://wiki.libsdl.org/SDL_AllocPalette">SDL_AllocPalette - SDL Wiki</a>
\r