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. What's more intuitive?

What's more intuitive?

Scheduled Pinned Locked Moved The Lounge
graphicsjsonquestion
11 Posts 5 Posters 13 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.
  • honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #1

    Let's say I'm drawing a bitmap from one source to a destination. I can specify the source and destination rectangles, and the resize options, which can be bicubic, bilinear, "fast" or crop. If the destination rectangle is flipped horizontally or vertically, the bitmap will be drawn flipped When it's cropped and flipped though things get interesting. say my source rect is 32x32 and destination rect is 64x64, meaning my final rect (unflipped) would be

    ____
    |11 |
    |22 |
    | |
    |____|

    Where 11/22 is my source rows of bitmap data and the rest ends up being "blank". This is because the dest rect was 4x the size of the source rect. Now if I flip it vertically, is it more intuitive for it to draw like this?

    ____
    |22 |
    |11 |
    | |
    |____|

    or this?

    ____
    | |
    | |
    |22 |
    |11__|

    Currently I'm doing the latter.

    Real programmers use butterflies

    D T M N 4 Replies Last reply
    0
    • honey the codewitchH honey the codewitch

      Let's say I'm drawing a bitmap from one source to a destination. I can specify the source and destination rectangles, and the resize options, which can be bicubic, bilinear, "fast" or crop. If the destination rectangle is flipped horizontally or vertically, the bitmap will be drawn flipped When it's cropped and flipped though things get interesting. say my source rect is 32x32 and destination rect is 64x64, meaning my final rect (unflipped) would be

      ____
      |11 |
      |22 |
      | |
      |____|

      Where 11/22 is my source rows of bitmap data and the rest ends up being "blank". This is because the dest rect was 4x the size of the source rect. Now if I flip it vertically, is it more intuitive for it to draw like this?

      ____
      |22 |
      |11 |
      | |
      |____|

      or this?

      ____
      | |
      | |
      |22 |
      |11__|

      Currently I'm doing the latter.

      Real programmers use butterflies

      D Offline
      D Offline
      Daniel Pfeffer
      wrote on last edited by
      #2

      Think of cropping, flipping, etc. as a set of transforms. The order of the transforms determines your semantics.

      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

      honey the codewitchH 1 Reply Last reply
      0
      • honey the codewitchH honey the codewitch

        Let's say I'm drawing a bitmap from one source to a destination. I can specify the source and destination rectangles, and the resize options, which can be bicubic, bilinear, "fast" or crop. If the destination rectangle is flipped horizontally or vertically, the bitmap will be drawn flipped When it's cropped and flipped though things get interesting. say my source rect is 32x32 and destination rect is 64x64, meaning my final rect (unflipped) would be

        ____
        |11 |
        |22 |
        | |
        |____|

        Where 11/22 is my source rows of bitmap data and the rest ends up being "blank". This is because the dest rect was 4x the size of the source rect. Now if I flip it vertically, is it more intuitive for it to draw like this?

        ____
        |22 |
        |11 |
        | |
        |____|

        or this?

        ____
        | |
        | |
        |22 |
        |11__|

        Currently I'm doing the latter.

        Real programmers use butterflies

        T Offline
        T Offline
        Tom Deketelaere
        wrote on last edited by
        #3

        honey the codewitch wrote:

        Copy Code

        ____
        | |
        | |
        |22 |
        |11__|

        This seems / feels more correct to me (just me 2 cents :) )

        Tom

        honey the codewitchH 1 Reply Last reply
        0
        • T Tom Deketelaere

          honey the codewitch wrote:

          Copy Code

          ____
          | |
          | |
          |22 |
          |11__|

          This seems / feels more correct to me (just me 2 cents :) )

          Tom

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

          Thank you!

          Real programmers use butterflies

          1 Reply Last reply
          0
          • D Daniel Pfeffer

            Think of cropping, flipping, etc. as a set of transforms. The order of the transforms determines your semantics.

            Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

            honey the codewitchH Offline
            honey the codewitchH Offline
            honey the codewitch
            wrote on last edited by
            #5

            Right, but in this case, I have to pick an order which is why I'm asking. I can't just separate out these individual transform steps so you can reorder them without greatly complicating the draw operation, and basically increasing code size in a constrained environment. You get one method. You get one set of flat/scalar parameters. You don't get reordering transforms and such. This isn't photoshop, and it honestly doesn't need to be that complicated - it just needs to handle the most common use case. I should add, you could separate those operations using intermediary bitmaps and multiple draws but obviously that's not efficient. It's not really a common use case though, in this context, for what it is being used for.

            Real programmers use butterflies

            1 Reply Last reply
            0
            • honey the codewitchH honey the codewitch

              Let's say I'm drawing a bitmap from one source to a destination. I can specify the source and destination rectangles, and the resize options, which can be bicubic, bilinear, "fast" or crop. If the destination rectangle is flipped horizontally or vertically, the bitmap will be drawn flipped When it's cropped and flipped though things get interesting. say my source rect is 32x32 and destination rect is 64x64, meaning my final rect (unflipped) would be

              ____
              |11 |
              |22 |
              | |
              |____|

              Where 11/22 is my source rows of bitmap data and the rest ends up being "blank". This is because the dest rect was 4x the size of the source rect. Now if I flip it vertically, is it more intuitive for it to draw like this?

              ____
              |22 |
              |11 |
              | |
              |____|

              or this?

              ____
              | |
              | |
              |22 |
              |11__|

              Currently I'm doing the latter.

              Real programmers use butterflies

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

              I agree, the latter is (a bit) more intuitive.

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

              1 Reply Last reply
              0
              • honey the codewitchH honey the codewitch

                Let's say I'm drawing a bitmap from one source to a destination. I can specify the source and destination rectangles, and the resize options, which can be bicubic, bilinear, "fast" or crop. If the destination rectangle is flipped horizontally or vertically, the bitmap will be drawn flipped When it's cropped and flipped though things get interesting. say my source rect is 32x32 and destination rect is 64x64, meaning my final rect (unflipped) would be

                ____
                |11 |
                |22 |
                | |
                |____|

                Where 11/22 is my source rows of bitmap data and the rest ends up being "blank". This is because the dest rect was 4x the size of the source rect. Now if I flip it vertically, is it more intuitive for it to draw like this?

                ____
                |22 |
                |11 |
                | |
                |____|

                or this?

                ____
                | |
                | |
                |22 |
                |11__|

                Currently I'm doing the latter.

                Real programmers use butterflies

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

                I suppose it depends on what you want to offer / accomplish... If the processing is to flip and rescale at once, then for me the second option (11 in the last line) is the correct one If you flip and then (afterwards) rescale the bitmap, then would be the option 1 (11 in the middle) But if I go from an image in A4 to the vertically flipped in an A3, I would expect option 2 (11 in the last line)

                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.

                honey the codewitchH 1 Reply Last reply
                0
                • N Nelek

                  I suppose it depends on what you want to offer / accomplish... If the processing is to flip and rescale at once, then for me the second option (11 in the last line) is the correct one If you flip and then (afterwards) rescale the bitmap, then would be the option 1 (11 in the middle) But if I go from an image in A4 to the vertically flipped in an A3, I would expect option 2 (11 in the last line)

                  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.

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

                  In this case I'm not scaling. When I am, the image takes up the entire rectangle. I'm simply drawing as is (crop mode, but there's no cropping happening because the bitmap was smaller than the destination rect)

                  Real programmers use butterflies

                  N 1 Reply Last reply
                  0
                  • honey the codewitchH honey the codewitch

                    In this case I'm not scaling. When I am, the image takes up the entire rectangle. I'm simply drawing as is (crop mode, but there's no cropping happening because the bitmap was smaller than the destination rect)

                    Real programmers use butterflies

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

                    honey the codewitch wrote:

                    I'm simply drawing as is (crop mode, but there's no cropping happening because the bitmap was smaller than the destination rect)

                    Then it should be the 11 in the middle. Flipping the A4 and insterting it later in the A3 gives the 11 in the middle.

                    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.

                    honey the codewitchH 1 Reply Last reply
                    0
                    • N Nelek

                      honey the codewitch wrote:

                      I'm simply drawing as is (crop mode, but there's no cropping happening because the bitmap was smaller than the destination rect)

                      Then it should be the 11 in the middle. Flipping the A4 and insterting it later in the A3 gives the 11 in the middle.

                      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.

                      honey the codewitchH Offline
                      honey the codewitchH Offline
                      honey the codewitch
                      wrote on last edited by
                      #10

                      huh? 11 is the first row of the bitmap 22 is the second row of the bitmap I didn't insert anything later. I am copying a bitmap from one location to the other using two rectangles to specify the source and destination extents. There are no insertions. There are no deletions. There is nothing in the middle. There never will be because is there no case where that is the correct answer. The correct answer is one of the two I have shown. Nothing else is valid. If you think otherwise, it's because frankly, you don't quite understand the problem, though I'm at a loss as how to explain it better than I have. Sorry for that.

                      Real programmers use butterflies

                      N 1 Reply Last reply
                      0
                      • honey the codewitchH honey the codewitch

                        huh? 11 is the first row of the bitmap 22 is the second row of the bitmap I didn't insert anything later. I am copying a bitmap from one location to the other using two rectangles to specify the source and destination extents. There are no insertions. There are no deletions. There is nothing in the middle. There never will be because is there no case where that is the correct answer. The correct answer is one of the two I have shown. Nothing else is valid. If you think otherwise, it's because frankly, you don't quite understand the problem, though I'm at a loss as how to explain it better than I have. Sorry for that.

                        Real programmers use butterflies

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

                        I was going to be nitpicky and possibly a definition nazi... but better not. Conclusion: Continue using with option 2. Is going to be right way more often than not.

                        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
                        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