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. General Programming
  3. C / C++ / MFC
  4. CImage filling

CImage filling

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
3 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.
  • T Offline
    T Offline
    Themis
    wrote on last edited by
    #1

    Hi there, I'm trying to use a CImage in order to display some images in a window. I can easily load an image with Load() method, but what I want now is to create a (w x h) image (easy) and fill it with a color. How can I do this? I tried to use the following: for (int x=0; x < width; ++x) for (int y=0; y < height; ++y) img.SetPixel(x,y,RGB(...)); But of course, as I expected, it takes quite a few seconds to fill the image. Is there any faster way? Thanks, Themis

    C 1 Reply Last reply
    0
    • T Themis

      Hi there, I'm trying to use a CImage in order to display some images in a window. I can easily load an image with Load() method, but what I want now is to create a (w x h) image (easy) and fill it with a color. How can I do this? I tried to use the following: for (int x=0; x < width; ++x) for (int y=0; y < height; ++y) img.SetPixel(x,y,RGB(...)); But of course, as I expected, it takes quite a few seconds to fill the image. Is there any faster way? Thanks, Themis

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Can you get the HBITMAP of the image and put it in a HDC ? Then you can fill it all in one go. Christian Graus - Microsoft MVP - C++

      T 1 Reply Last reply
      0
      • C Christian Graus

        Can you get the HBITMAP of the image and put it in a HDC ? Then you can fill it all in one go. Christian Graus - Microsoft MVP - C++

        T Offline
        T Offline
        Themis
        wrote on last edited by
        #3

        Thanks I'll try that!

        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