Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Wicked code!

Wicked code!

Scheduled Pinned Locked Moved The Lounge
graphicsdesignc++comgame-dev
12 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    This my friends, is really neat. With my GFX library:

    template
    using bgrx_pixel = gfx::pixel<
    gfx::channel_traits,
    gfx::channel_traits,
    gfx::channel_traits,
    gfx::channel_traits

    ;

    You can then do auto col = color>::purple and get a pixel back in the format of 0xBBGGRRFF (where RR GG and BB are each a byte and represent the red, green, and blue color channels, and FF is just a NOP channel - unused - and set to 0xFF). Purple would be like 0xFF00FFFF. With this you can create bitmaps (bitmap>)in this format and feed them right to DirectX, which happily eats bitmaps with this pixel footprint. The template code to make this work is pretty crazy. The fact that it's pretty easy to declare new pixel formats made it possible for me to port my code from IoT to DirectX on a PC so I can rapidly prototype without having to upload to a device each time. I've never really used this feature in the wild. My color format is usually either 16-bit color, monochrome or grayscale. It was confusing at first though because originally my nop channel was an alpha channel, and so it wasn't rendering (black screen) because DirectX is set to ignore that channel, and my GFX library assumed it would be respected. Anyway, after I overcame that the rest was easy. Same code of mine works in Arduino, ESP-IDF, probably Zephyr, and now the PC. Say what you want about C and C++ they truly run everywhere.

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    D L 0 3 Replies Last reply
    0
    • H honey the codewitch

      This my friends, is really neat. With my GFX library:

      template
      using bgrx_pixel = gfx::pixel<
      gfx::channel_traits,
      gfx::channel_traits,
      gfx::channel_traits,
      gfx::channel_traits

      ;

      You can then do auto col = color>::purple and get a pixel back in the format of 0xBBGGRRFF (where RR GG and BB are each a byte and represent the red, green, and blue color channels, and FF is just a NOP channel - unused - and set to 0xFF). Purple would be like 0xFF00FFFF. With this you can create bitmaps (bitmap>)in this format and feed them right to DirectX, which happily eats bitmaps with this pixel footprint. The template code to make this work is pretty crazy. The fact that it's pretty easy to declare new pixel formats made it possible for me to port my code from IoT to DirectX on a PC so I can rapidly prototype without having to upload to a device each time. I've never really used this feature in the wild. My color format is usually either 16-bit color, monochrome or grayscale. It was confusing at first though because originally my nop channel was an alpha channel, and so it wasn't rendering (black screen) because DirectX is set to ignore that channel, and my GFX library assumed it would be respected. Anyway, after I overcame that the rest was easy. Same code of mine works in Arduino, ESP-IDF, probably Zephyr, and now the PC. Say what you want about C and C++ they truly run everywhere.

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      D Offline
      D Offline
      David ONeil
      wrote on last edited by
      #2

      Congratulations! That is worthy of a celebration, however you celebrate! Someday maybe I'll have time to master such code as well - it sounds fun!

      Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

      1 Reply Last reply
      0
      • H honey the codewitch

        This my friends, is really neat. With my GFX library:

        template
        using bgrx_pixel = gfx::pixel<
        gfx::channel_traits,
        gfx::channel_traits,
        gfx::channel_traits,
        gfx::channel_traits

        ;

        You can then do auto col = color>::purple and get a pixel back in the format of 0xBBGGRRFF (where RR GG and BB are each a byte and represent the red, green, and blue color channels, and FF is just a NOP channel - unused - and set to 0xFF). Purple would be like 0xFF00FFFF. With this you can create bitmaps (bitmap>)in this format and feed them right to DirectX, which happily eats bitmaps with this pixel footprint. The template code to make this work is pretty crazy. The fact that it's pretty easy to declare new pixel formats made it possible for me to port my code from IoT to DirectX on a PC so I can rapidly prototype without having to upload to a device each time. I've never really used this feature in the wild. My color format is usually either 16-bit color, monochrome or grayscale. It was confusing at first though because originally my nop channel was an alpha channel, and so it wasn't rendering (black screen) because DirectX is set to ignore that channel, and my GFX library assumed it would be respected. Anyway, after I overcame that the rest was easy. Same code of mine works in Arduino, ESP-IDF, probably Zephyr, and now the PC. Say what you want about C and C++ they truly run everywhere.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        What I find really amazing is that the compilers can actually deal with such source. You can probably guess that i have never written a compiler.

        pkfoxP H 2 Replies Last reply
        0
        • L Lost User

          What I find really amazing is that the compilers can actually deal with such source. You can probably guess that i have never written a compiler.

          pkfoxP Offline
          pkfoxP Offline
          pkfox
          wrote on last edited by
          #4

          Nor me I leave that to the propeller heads :-D

          In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP

          1 Reply Last reply
          0
          • H honey the codewitch

            This my friends, is really neat. With my GFX library:

            template
            using bgrx_pixel = gfx::pixel<
            gfx::channel_traits,
            gfx::channel_traits,
            gfx::channel_traits,
            gfx::channel_traits

            ;

            You can then do auto col = color>::purple and get a pixel back in the format of 0xBBGGRRFF (where RR GG and BB are each a byte and represent the red, green, and blue color channels, and FF is just a NOP channel - unused - and set to 0xFF). Purple would be like 0xFF00FFFF. With this you can create bitmaps (bitmap>)in this format and feed them right to DirectX, which happily eats bitmaps with this pixel footprint. The template code to make this work is pretty crazy. The fact that it's pretty easy to declare new pixel formats made it possible for me to port my code from IoT to DirectX on a PC so I can rapidly prototype without having to upload to a device each time. I've never really used this feature in the wild. My color format is usually either 16-bit color, monochrome or grayscale. It was confusing at first though because originally my nop channel was an alpha channel, and so it wasn't rendering (black screen) because DirectX is set to ignore that channel, and my GFX library assumed it would be respected. Anyway, after I overcame that the rest was easy. Same code of mine works in Arduino, ESP-IDF, probably Zephyr, and now the PC. Say what you want about C and C++ they truly run everywhere.

            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

            0 Offline
            0 Offline
            0x01AA
            wrote on last edited by
            #5

            I'm wondering how it will work in 32/64? I mean at compile time, where you don't know what the target machine runs on.

            H N 3 Replies Last reply
            0
            • 0 0x01AA

              I'm wondering how it will work in 32/64? I mean at compile time, where you don't know what the target machine runs on.

              H Offline
              H Offline
              honey the codewitch
              wrote on last edited by
              #6

              I have some information about the target machine like endianness and word size. If I don't support the platform you can fill in the information with -D defines.

              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

              1 Reply Last reply
              0
              • 0 0x01AA

                I'm wondering how it will work in 32/64? I mean at compile time, where you don't know what the target machine runs on.

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #7

                I should add, this routinely runs on 32-bit machines. This code is now running on a 64-bit machine.

                Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                1 Reply Last reply
                0
                • L Lost User

                  What I find really amazing is that the compilers can actually deal with such source. You can probably guess that i have never written a compiler.

                  H Offline
                  H Offline
                  honey the codewitch
                  wrote on last edited by
                  #8

                  C++ compilers are something else, even at that. Pure magic.

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  J 1 Reply Last reply
                  0
                  • 0 0x01AA

                    I'm wondering how it will work in 32/64? I mean at compile time, where you don't know what the target machine runs on.

                    N Offline
                    N Offline
                    Nelek
                    wrote on last edited by
                    #9

                    Does 32 not run in 64? The other way around I know that is not possible / so easy, but I thought 32 would not be a big deal in 64

                    M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                    Richard Andrew x64R 1 Reply Last reply
                    0
                    • N Nelek

                      Does 32 not run in 64? The other way around I know that is not possible / so easy, but I thought 32 would not be a big deal in 64

                      M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                      Richard Andrew x64R Offline
                      Richard Andrew x64R Offline
                      Richard Andrew x64
                      wrote on last edited by
                      #10

                      You're thinking of the x86 platform. That might not apply to microcontrollers or SBCs.

                      The difficult we do right away... ...the impossible takes slightly longer.

                      N 1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        You're thinking of the x86 platform. That might not apply to microcontrollers or SBCs.

                        The difficult we do right away... ...the impossible takes slightly longer.

                        N Offline
                        N Offline
                        Nelek
                        wrote on last edited by
                        #11

                        true :-O

                        M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                        1 Reply Last reply
                        0
                        • H honey the codewitch

                          C++ compilers are something else, even at that. Pure magic.

                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                          J Offline
                          J Offline
                          jmaida
                          wrote on last edited by
                          #12

                          :)

                          "A little time, a little trouble, your better day" Badfinger

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups