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. I hate being hung up and indecisive.

I hate being hung up and indecisive.

Scheduled Pinned Locked Moved The Lounge
graphicsdesignwpfwcfcom
7 Posts 3 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

    Hi rubber ducks! :-D My graphics library has stateless raster operations: draw::filled_rectangle(destination,destination_rectangle,color,optional_clipping_rectangle) draw::ellipse(destination,destination_rectangle,color,optional_clipping_rectangle) etc where destination is the drawing surface, be it a bitmap, a viewport or whatever. i really want my vector operations to work that way too, but there are underlying complications. basically, you have to build out paths with multiple calls, and then you can render that. I can't decide how I want to expose the canvas - which I need to have bound to a "destination" (as above) a template class called canvas? (the destination is arbitrary, with no common base, so must use source level linking eg: templates) a class with a bunch of template methods? (actually thinking about it this won't work in this case) If I use the template class I can potentially do like this: auto canvas = draw::canvas(destination,destination_rect); at which point I could do canvas.arc(...) for example I don't like that it works so different than my raster functionality. It's stateful, but I'm not sure I can avoid that I'm not sure if I like binding it to a destination using the draw:: class (draw::canvas) And there are a bunch of details that I need to work out like Do I combine stroke and fill data in one structure, or do I require you to define strokes and fills using multiple calls? (my prior SVG stuff worked the first way, pluto works the latter way, but I can make it work the first way) I have so many questions spinning around in my head, and it's stopping me from moving forward. I still think if you're working on software correctly, this is part of the process - better to get hung up in design then to paint yourself into a corner during implementation. Still, it's frustrating.

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

    M 1 Reply Last reply
    0
    • H honey the codewitch

      Hi rubber ducks! :-D My graphics library has stateless raster operations: draw::filled_rectangle(destination,destination_rectangle,color,optional_clipping_rectangle) draw::ellipse(destination,destination_rectangle,color,optional_clipping_rectangle) etc where destination is the drawing surface, be it a bitmap, a viewport or whatever. i really want my vector operations to work that way too, but there are underlying complications. basically, you have to build out paths with multiple calls, and then you can render that. I can't decide how I want to expose the canvas - which I need to have bound to a "destination" (as above) a template class called canvas? (the destination is arbitrary, with no common base, so must use source level linking eg: templates) a class with a bunch of template methods? (actually thinking about it this won't work in this case) If I use the template class I can potentially do like this: auto canvas = draw::canvas(destination,destination_rect); at which point I could do canvas.arc(...) for example I don't like that it works so different than my raster functionality. It's stateful, but I'm not sure I can avoid that I'm not sure if I like binding it to a destination using the draw:: class (draw::canvas) And there are a bunch of details that I need to work out like Do I combine stroke and fill data in one structure, or do I require you to define strokes and fills using multiple calls? (my prior SVG stuff worked the first way, pluto works the latter way, but I can make it work the first way) I have so many questions spinning around in my head, and it's stopping me from moving forward. I still think if you're working on software correctly, this is part of the process - better to get hung up in design then to paint yourself into a corner during implementation. Still, it's frustrating.

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

      M Offline
      M Offline
      megaadam
      wrote on last edited by
      #2

      Prolly not what you fancy, but if it gives you any ideas... The way I picture vector graphics is basically an infinite 2D-canvas.On that, we draw all the ellipses, rectangles and cats. The rectangle only comes to play when we render.

      Canvas canvas;
      draw::ellipse(canvas, bounding_rectangle, color); // overload
      draw::shape2D(canvas, shape, color);

      canvas.render(source_rect, raster_destination)

      Personally, I would cut the mooring to draw:: and even

      Canvas canvas;
      canvas.ellipse(bounding_rectangle, color); // overload
      canvas.shape2D(shape, color);

      canvas.render(source_rect, raster_destination)

      "If we don't change direction, we'll end up where we're going"

      H 2 Replies Last reply
      0
      • M megaadam

        Prolly not what you fancy, but if it gives you any ideas... The way I picture vector graphics is basically an infinite 2D-canvas.On that, we draw all the ellipses, rectangles and cats. The rectangle only comes to play when we render.

        Canvas canvas;
        draw::ellipse(canvas, bounding_rectangle, color); // overload
        draw::shape2D(canvas, shape, color);

        canvas.render(source_rect, raster_destination)

        Personally, I would cut the mooring to draw:: and even

        Canvas canvas;
        canvas.ellipse(bounding_rectangle, color); // overload
        canvas.shape2D(shape, color);

        canvas.render(source_rect, raster_destination)

        "If we don't change direction, we'll end up where we're going"

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

        That's essentially how i envision it to work. There is no explicit render method however, due to the way it functions. The issue with the color is you don't just have one. You have potentially a stroke color and a fill color. Or you can do linear and radial gradients or textures. It gets complicated. The way it works currently in pluto, is you call series of functions (in straight C) to set the various color properties for stroke and fill, or textures or whatever. Then you render your shapes, more or less. I'm thinking of making it more like your way, except if I do the parameter list will be struct heavy due to all the options. Still not sure.

        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
        • M megaadam

          Prolly not what you fancy, but if it gives you any ideas... The way I picture vector graphics is basically an infinite 2D-canvas.On that, we draw all the ellipses, rectangles and cats. The rectangle only comes to play when we render.

          Canvas canvas;
          draw::ellipse(canvas, bounding_rectangle, color); // overload
          draw::shape2D(canvas, shape, color);

          canvas.render(source_rect, raster_destination)

          Personally, I would cut the mooring to draw:: and even

          Canvas canvas;
          canvas.ellipse(bounding_rectangle, color); // overload
          canvas.shape2D(shape, color);

          canvas.render(source_rect, raster_destination)

          "If we don't change direction, we'll end up where we're going"

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

          Adding, the only way I could cut the binding to draw is to provide an alternative mechanism to bind to a destination and destination rectangle for the canvas. The canvas itself cannot actually render without something to render to, like a bitmap. The issue is the backing draw target can be of any sort of color model or pixel format. RGB8888, RGB565, etc. Each different model has a different type signature, so the canvas class would have to be a template, and a binding template function makes it easier to attach a canvas to a surface. draw:: is currently where people go to do all drawing operations on a draw target, so it makes at least some sense to use draw:: to bind, depending on how you look at it.

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

          C 1 Reply Last reply
          0
          • H honey the codewitch

            Adding, the only way I could cut the binding to draw is to provide an alternative mechanism to bind to a destination and destination rectangle for the canvas. The canvas itself cannot actually render without something to render to, like a bitmap. The issue is the backing draw target can be of any sort of color model or pixel format. RGB8888, RGB565, etc. Each different model has a different type signature, so the canvas class would have to be a template, and a binding template function makes it easier to attach a canvas to a surface. draw:: is currently where people go to do all drawing operations on a draw target, so it makes at least some sense to use draw:: to bind, depending on how you look at it.

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

            C Offline
            C Offline
            charlieg
            wrote on last edited by
            #5

            After writing graphics code since the late 80s, I'm not quite sure what you are attempting to achieve other than code purity. Raster - draw into the backing bitmap using primitives, slap it into the display buffer. Move along. Vector - never had the need for it, overly complicated, could use raster all day long. Mind you, I was almost always working on a fixed resolution display. Examples: - customer had a 1280x104 monitor as dictated by the contract. I did not go out of my way to hard code stuff. - customer had 1024x768, 800x600, 320x240 - all of which required raster operations for performance. Might I suggest you are overthinking? Don't get me wrong, if you want to be flexible enough to target every random device that hits your market, knock yourself out.

            Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

            H 1 Reply Last reply
            0
            • C charlieg

              After writing graphics code since the late 80s, I'm not quite sure what you are attempting to achieve other than code purity. Raster - draw into the backing bitmap using primitives, slap it into the display buffer. Move along. Vector - never had the need for it, overly complicated, could use raster all day long. Mind you, I was almost always working on a fixed resolution display. Examples: - customer had a 1280x104 monitor as dictated by the contract. I did not go out of my way to hard code stuff. - customer had 1024x768, 800x600, 320x240 - all of which required raster operations for performance. Might I suggest you are overthinking? Don't get me wrong, if you want to be flexible enough to target every random device that hits your market, knock yourself out.

              Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

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

              The arbitrary pixel formats for bitmaps is already baked into my library. The native pixel format for all of my vector graphics is RGBA8888 (32-bit RGBA). Raster has no native format. It can draw in any format. I had to limit the vector graphics canvas to one color model and bit depth both to enforce that it always has an alpha channel for the pixel as well as to simplify design and use. Vector graphics can do things like source dodge colors, not just strict alpha blending so there's additional complexity. I decided to forgo all of that and fix the pixel format to RGBA8888 The reason I went with vector graphics is both to support SVG and as important to allow for anti-aliased graphics. My raster cannot do it, because it *can* alpha-blend. Unfortunately algorithms like the Wu algorithm don't work with alpha-blending. The only solution I've found is full vector graphics. Fortunately 32-bit MCUs can handle it, as long as you don't go crazy with it. But yeah, this library is kind of for every random device that hits the market. It runs on PC Arduino ESP-IDF Zephyr Pretty much anywhere C++17 can compile

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

              C 1 Reply Last reply
              0
              • H honey the codewitch

                The arbitrary pixel formats for bitmaps is already baked into my library. The native pixel format for all of my vector graphics is RGBA8888 (32-bit RGBA). Raster has no native format. It can draw in any format. I had to limit the vector graphics canvas to one color model and bit depth both to enforce that it always has an alpha channel for the pixel as well as to simplify design and use. Vector graphics can do things like source dodge colors, not just strict alpha blending so there's additional complexity. I decided to forgo all of that and fix the pixel format to RGBA8888 The reason I went with vector graphics is both to support SVG and as important to allow for anti-aliased graphics. My raster cannot do it, because it *can* alpha-blend. Unfortunately algorithms like the Wu algorithm don't work with alpha-blending. The only solution I've found is full vector graphics. Fortunately 32-bit MCUs can handle it, as long as you don't go crazy with it. But yeah, this library is kind of for every random device that hits the market. It runs on PC Arduino ESP-IDF Zephyr Pretty much anywhere C++17 can compile

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

                C Offline
                C Offline
                charlieg
                wrote on last edited by
                #7

                Okay, I concede that your requirements are a bit more than mine ever were.

                Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                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