{"id":2369,"date":"2021-11-12T18:55:17","date_gmt":"2021-11-12T09:55:17","guid":{"rendered":"https:\/\/sirius10.net\/blog\/wordpress\/?p=2369"},"modified":"2021-11-12T18:55:20","modified_gmt":"2021-11-12T09:55:20","slug":"post-2369","status":"publish","type":"post","link":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/2021\/11\/12\/2369\/","title":{"rendered":"SDL2 \u3067\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u57cb\u3081\u8fbc\u3080"},"content":{"rendered":"\n<p>\u3000SDL2 \u3067\u3001\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306b\u6301\u3061\u3001\u305d\u308c\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u7a7a\u306e\u30b5\u30fc\u30d5\u30a7\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u306e\u30b5\u30fc\u30d5\u30a7\u30b9\u306b\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u8272\u6df1\u5ea6\u306f 32 \u30d3\u30c3\u30c8\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u753b\u50cf\u306e RGB \u30c7\u30fc\u30bf\u3092\u4f5c\u6210<\/h2>\n\n\n\n<p>\u3000\u4eca\u56de\u306f\u7c21\u5358\u306b\u3059\u308b\u305f\u3081\u3001 8 x 8 \u306e\u30b5\u30a4\u30ba\u306e\u30c7\u30fc\u30bf\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">Uint32 pixels[] = {\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x000000ff, 0x000000ff, 0x0000ffff, 0x0000ffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff,\n    0x0000ffff, 0x0000ffff, 0x00ffffff, 0x00ffffff\n};<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30fc\u30d5\u30a7\u30b9\u3092\u4f5c\u6210\u3057\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc\u3059\u308b<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted file\">    image = SDL_CreateRGBSurface(0, 8, 8, 32, 0, 0, 0, 0);\n    if( image == NULL ) {\n        printf(\"CAn not create surfave\\n\");\n        exit(1);\n    }\n    SDL_LockSurface(image);\n    for(i = 0; i &lt; image->w * image->h; i++ ) {\n        *((Uint32 *)image->pixels + i) = pixels[i];\n    }\n    SDL_UnlockSurface(image);<\/pre>\n\n\n\n<p>\u3000\u3053\u306e\u30b5\u30fc\u30d5\u30a7\u30b9\u3092\u4f7f\u3063\u3066\u8868\u793a\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"84\" height=\"112\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/11\/test.png\" alt=\"\" class=\"wp-image-2370\"\/><figcaption>\u8868\u793a<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u30008 x8 \u306b\u30b5\u30a4\u30ba\u306a\u306e\u3067\u5c0f\u3055\u3044\u3067\u3059\u304c\u3001\u4e2d\u592e\u306b\u8868\u793a\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a2\u30eb\u30d5\u30a1\u5024\u306e\u3042\u308b\u30c7\u30fc\u30bf<\/h2>\n\n\n\n<p>\u3000\u900f\u904e\u3055\u305b\u308b\u305f\u3081\u3001\u30a2\u30eb\u30d5\u30a1\u5024\u306e\u3042\u308b\u30c7\u30fc\u30bf\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u30b5\u30fc\u30d5\u30a7\u30b9\u3092\u4f5c\u88fd\u3059\u308b\u969b\u306b\u30de\u30b9\u30af\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u3001\u900f\u904e\u3057\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    image = SDL_CreateRGBSurface(0, 8, 8, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff);<\/pre>\n\n\n\n<p>\u3000\u5f15\u6570\u306e\u6700\u5f8c 4 \u3064\u304c\u30de\u30b9\u30af\u3067\u3059\u3002 R \u30de\u30b9\u30af\u3001G\u30de\u30b9\u30af\u3001B \u30de\u30b9\u30af\u3001A \u30de\u30b9\u30af\u3067\u3059\u3002A \u30de\u30b9\u30af\u304c\u30a2\u30eb\u30d5\u30a1\u5024\u306e\u4f4d\u7f6e\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"84\" height=\"112\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/11\/test2.png\" alt=\"\" class=\"wp-image-2372\"\/><figcaption>\u30de\u30b9\u30af\u8a2d\u5b9a<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Windows \u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u306e\u30c7\u30fc\u30bf<\/h2>\n\n\n\n<p>\u3000Windows \u306e\u30d5\u30eb\u30ab\u30e9\u30fc\u306e\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306f RGB \u306e\u751f\u306e\u5024\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u4f7f\u3044\u3084\u3059\u3044\u5f62\u5f0f\u3067\u3059\u3002\u30d5\u30eb\u30ab\u30e9\u30fc\u306e\u5834\u5408\u3001\u30d4\u30af\u30bb\u30eb\u5f53\u305f\u308a RGB \u3067 24 bit \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3057\u304b\u3057\u3001\u73fe\u5728\u306f\u30e1\u30e2\u30ea\u3092\u81ea\u7531\u306b\u4f7f\u3048\u308b\u72b6\u6cc1\u306b\u3042\u3063\u3066\u300124 bit \u306f\u4e2d\u9014\u534a\u7aef\u306a\u30d3\u30c3\u30c8\u6570\u3067\u3059\u3002\u305d\u3053\u3067\u300132 bit \u306ebitmap \u304c\u4f7f\u308f\u308c\u308b\u50be\u5411\u306b\u3042\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u3082\u3068\u3082\u3068 bitmap \u306b\u306f\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u304c\u3042\u308a\u307e\u305b\u3093\u300232 bit \u306b\u3057\u3066\u3082\u30011 \u30d0\u30a4\u30c8\u5206\u306e\u7121\u99c4\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u7a7a\u3044\u305f 1 \u30d0\u30a4\u30c8\u3092\u3069\u306e\u69d8\u306b\u4f7f\u3046\u306e\u304b\u306f\u3001bitmap \u3092\u6271\u3046\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u6b21\u7b2c\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3068\u3057\u3066\u6271\u3046\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304c\u591a\u3044\u3068\u611f\u3058\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u300032bit \u306e\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u3067\u306f\u3001\u5148\u982d 1 \u30d0\u30a4\u30c8\u3092\u9664\u3044\u305f\u6b8b\u308a\u306e 3 \u30d0\u30a4\u30c8\u304c RGB \u306e\u5024\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter is-style-regular\"><table class=\"has-lightyellow-background-color has-background\"><tbody><tr><td>0x<\/td><td>xx<\/td><td>rr<\/td><td>gg<\/td><td>bb<\/td><\/tr><\/tbody><\/table><figcaption>32bit \u30c7\u30fc\u30bf<\/figcaption><\/figure>\n\n\n\n<p>\u3000\u900f\u904e\u578b\u306e bitmap \u3067\u306f\u3001\u4f7f\u7528\u3055\u308c\u306a\u3044\u6700\u521d\u306e 1 \u30d0\u30a4\u30c8\u3092\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3068\u3057\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u4e00\u822c\u7684\u306b\u306f\u3001RGBA \u3068\u8868\u73fe\u3055\u308c\u308b\u3088\u3046\u306b\u3001\u8272\u60c5\u5831\u306e\u3042\u3068\u306b\u30a2\u30eb\u30d5\u30a1\u5024\u304c\u7f6e\u304b\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u6ce8\u610f\u3057\u306a\u3044\u3068\u900f\u904e\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000SDL2 \u3067\u3001\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306b\u6301\u3061\u3001\u305d\u308c\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002 \u3000\u7a7a\u306e\u30b5\u30fc\u30d5\u30a7\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u306e\u30b5\u30fc\u30d5\u30a7\u30b9\u306b\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u8272\u6df1\u5ea6\u306f 32 \u30d3\u30c3\u30c8\u306b\u3057\u307e\u3059\u3002 \u753b\u50cf\u306e RGB \u30c7\u30fc\u30bf\u3092\u4f5c\u6210 \u3000\u4eca\u56de\u306f\u7c21\u5358\u306b\u3059\u308b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-2369","post","type-post","status-publish","format-standard","hentry","category-sdl2"],"_links":{"self":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=2369"}],"version-history":[{"count":2,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2369\/revisions"}],"predecessor-version":[{"id":2373,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2369\/revisions\/2373"}],"wp:attachment":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=2369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=2369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=2369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}