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 have the spatial reasoning skills of a toaster oven

I have the spatial reasoning skills of a toaster oven

Scheduled Pinned Locked Moved The Lounge
graphicsdesigncomagentic-aiiot
2 Posts 2 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

    Halp! I'm lost in rectangles! (not actually a request for help, just a rant) I've got this

    draw::image(destination,destination_rectangle,source_image,source_rectangle,&clip_rectangle);

    template
    gfx_result image_draw_cb(const image_data& data, void* state) {
    image_cb_state& s=*(image_cb_state*)state;
    if(data.is_fill) {
    srect16 sr = *data.fill.bounds;
    if(sr.intersects(s.src_rect)) {
    if(s.clip!=nullptr) {
    sr=sr.crop(s.clip);
    }
    return draw::filled_rectangle(*s.dst,sr,data.fill.color);
    }

    }
    return draw::bitmap(\*s.dst,data.bitmap.region->bounds().offset(data.bitmap.location),\*data.bitmap.region,data.bitmap.region->bounds());
    

    }

    which is the starting point of what i need but not accurate. Basically i've got several locations and bounds that have to offset and crop each other in order to make image drawing work, and I can't wrap my head around it. I will eventually - I've dealt with worse - a dirty rectangle system in my UI library, but it just frustrates me that thinking in shapes is like a hole in my intellectual abilities. It slows me down, trips me up and makes me struggle.

    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
    • H honey the codewitch

      Halp! I'm lost in rectangles! (not actually a request for help, just a rant) I've got this

      draw::image(destination,destination_rectangle,source_image,source_rectangle,&clip_rectangle);

      template
      gfx_result image_draw_cb(const image_data& data, void* state) {
      image_cb_state& s=*(image_cb_state*)state;
      if(data.is_fill) {
      srect16 sr = *data.fill.bounds;
      if(sr.intersects(s.src_rect)) {
      if(s.clip!=nullptr) {
      sr=sr.crop(s.clip);
      }
      return draw::filled_rectangle(*s.dst,sr,data.fill.color);
      }

      }
      return draw::bitmap(\*s.dst,data.bitmap.region->bounds().offset(data.bitmap.location),\*data.bitmap.region,data.bitmap.region->bounds());
      

      }

      which is the starting point of what i need but not accurate. Basically i've got several locations and bounds that have to offset and crop each other in order to make image drawing work, and I can't wrap my head around it. I will eventually - I've dealt with worse - a dirty rectangle system in my UI library, but it just frustrates me that thinking in shapes is like a hole in my intellectual abilities. It slows me down, trips me up and makes me struggle.

      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
      jochance
      wrote on last edited by
      #2

      I was playing with XNA a long time ago and was doing a space thing where multiple transparent images of stars would be stacked to do parallax. The images were screen sized. They would wrap the screen so if the focal point (player) went a pixel left, the far right column of pixels would wrap to the left. This gets more complicated on diagonals. I had to grab a ruler and mark up a physical sheet of paper to work out the code for how to cut the rectangles and glue them back together in real time so that one image could be infinitely scrolled any direction.

      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