Can anyone explain this one?

This is a discussion on Can anyone explain this one? within the Tech Board forums, part of the Community Boards category; Whenever you left click on the desktop anywhere(except for the icons), hold and drag the mouse, a rectangle type thing ...

  1. #1
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804

    Can anyone explain this one?

    Whenever you left click on the desktop anywhere(except for the icons), hold and drag the mouse, a rectangle type thing whose sides are dotted pixels(I guess)shows up. But the interesting thing is that if we try to align all the dots together to make a single line(vertical), only the first and the last dots are visible. Where does the rest of the dots go? I found it interesting to ask, as it was increasing my curiosity.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,313
    Quote Originally Posted by BEN10
    But the interesting thing is that if we try to align all the dots together to make a single line(vertical), only the first and the last dots are visible. Where does the rest of the dots go?
    I never took notice of this on any desktop environment that I have used, but it seems to me that the answer is simply: the rest of the "dots" are not shown as a feature or bug.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    What I said is atleast true in Windows XP, I dont know of others, but it should be true in other OSes too.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  4. #4
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    I believe that's the selection tool, like from Photoshop, and it's a feature to remove the dots if there's no width because therefore you aren't selecting anything (and that's important in applications where you're trying to get 1 width or something). They might not have had to consciously thought about it, because any drawing API you use would no longer draw anything, so maybe they just decided to force the addition the beginning dots. I don't know, I don't even have Windows installed atm. Most likely I have no idea what I'm talking about, because I just wanted to come and say benio was his name-o.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,313
    Quote Originally Posted by BEN10
    What I said is atleast true in Windows XP, I dont know of others, but it should be true in other OSes too.
    I happen to be on Ubuntu Linux 8.04 at the moment, and it seems that its version of GNOME does not exhibit the behaviour that you described.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    I think I should make it more clearer. Click the left mouse button anywhere on the desktop(except for icon), hold and drag the button to make 90degree vertical line, you'll see only two dots. If the line is not 90degree, all the dots will be visible. One of my friend also experienced this effect(with XP).
    EDIT: One more thing to ask, are these dots pixels?
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  7. #7
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034

    Cool

    Quote Originally Posted by laserlight View Post
    I happen to be on Ubuntu Linux 8.04 at the moment, and it seems that its version of GNOME does not exhibit the behaviour that you described.
    I also am a Jaunty Jackalope high five!

    I haven't seen a native GNOME selection tool, or even Wine, but my selection tool from GIMP does act the same as Windows XP. It's a feature I say!
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,313
    Quote Originally Posted by BEN10
    Click the left mouse button anywhere on the desktop(except for icon), hold and drag the button to make 90degree vertical line
    Yes, that is what I tried.

    Quote Originally Posted by Dae
    I also am a Jaunty Jackalope
    Eh, 8.04, not 9.04

    Quote Originally Posted by Dae
    I haven't seen a native GNOME selection tool
    I am not sure about "native", but I am talking about the selection method, akin to Windows, used to select icons on the desktop.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    It is due to the bitmask being used for the line. It is probably using XOR which means if you overlay 2 XOR lines on top of one another you could very well get this type of behavior. There is nothing wrong with your desktop and my XP does exactly the same thing.

    I'm not sure how GIMP does transparent lines but if when overlaid on top of one another (using a 0 width selection rectangle) they do not exhibit this behavior they are not using a simpe XOR line.


    From the Windows SDK:
    SetROP2
    The SetROP2 function sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined.

    int SetROP2(
    HDC hdc, // handle to DC
    int fnDrawMode // drawing mode
    );
    Parameters
    hdc
    [in] Handle to the device context.
    fnDrawMode
    [in] Specifies the mix mode. This parameter can be one of the following values. Mix mode Description
    R2_BLACK Pixel is always 0.
    R2_COPYPEN Pixel is the pen color.
    R2_MASKNOTPEN Pixel is a combination of the colors common to both the screen and the inverse of the pen.
    R2_MASKPEN Pixel is a combination of the colors common to both the pen and the screen.
    R2_MASKPENNOT Pixel is a combination of the colors common to both the pen and the inverse of the screen.
    R2_MERGENOTPEN Pixel is a combination of the screen color and the inverse of the pen color.
    R2_MERGEPEN Pixel is a combination of the pen color and the screen color.
    R2_MERGEPENNOT Pixel is a combination of the pen color and the inverse of the screen color.
    R2_NOP Pixel remains unchanged.
    R2_NOT Pixel is the inverse of the screen color.
    R2_NOTCOPYPEN Pixel is the inverse of the pen color.
    R2_NOTMASKPEN Pixel is the inverse of the R2_MASKPEN color.
    R2_NOTMERGEPEN Pixel is the inverse of the R2_MERGEPEN color.
    R2_NOTXORPEN Pixel is the inverse of the R2_XORPEN color.
    R2_WHITE Pixel is always 1.
    R2_XORPEN Pixel is a combination of the colors in the pen and in the screen, but not in both.


    Return Values
    If the function succeeds, the return value specifies the previous mix mode.

    If the function fails, the return value is zero.

    Windows NT/2000/XP: To get extended error information, call GetLastError.

    Remarks
    Mix modes define how GDI combines source and destination colors when drawing with the current pen. The mix modes are binary raster operation codes, representing all possible Boolean functions of two variables, using the binary operations AND, OR, and XOR (exclusive OR), and the unary operation NOT. The mix mode is for raster devices only; it is not available for vector devices.

    Example Code
    For an example, see Using Rectangles.

    Requirements
    Windows NT/2000/XP: Included in Windows NT 3.1 and later.
    Windows 95/98/Me: Included in Windows 95 and later.
    Header: Declared in Wingdi.h; include Windows.h.
    Library: Use Gdi32.lib.

    See Also
    Painting and Drawing Overview, Painting and Drawing Functions, GetROP2
    Snippet of code from Programmer's Heaven:

    Code:
    static void DrawSelectionRect(HWND hWnd, const RECT* pRect)
    {
       HDC hDC;
       HPEN hOldPen;
       HBRUSH hOldBrush;
    
       hDC = GetDC(hWnd);
    
       hOldPen = (HPEN)SelectObject(hDC, CreatePen(PS_SOLID, 1, RGB(128, 128, 128)));
       hOldBrush = (HBRUSH)SelectObject(hDC, GetStockObject(NULL_BRUSH));
    
       SetROP2(hDC, R2_XORPEN);
       Rectangle(hDC, pRect->left, pRect->top, pRect->right, pRect->bottom);
    
       SelectObject(hDC, hOldBrush);
       DeleteObject(SelectObject(hDC, hOldPen));
    
       ReleaseDC(hWnd, hDC);
    }
    So what is actually happening is that the first XOR line writes to the screen and when you move the second XOR line over it, it erases it. Usually what happens is each side of the box is drawn again which erases the first XOR line. However when you move them on top of each other - you are erasing what is already there which is why you see what you do.
    Last edited by VirtualAce; 09-06-2009 at 09:53 AM.

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,413
    If I make a truly 90 degree line, I see no pixels at all. If it's a slightly different angle, then it shows the entire "selection rectangle". I believe this is what you speak of?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    @Bubba
    You mean the two dots when get overlapped are not seen because their values are getting XORed, which results in zero intensity coz (x) XOR (x) = 0.
    @Elysia
    I see no pixels at all
    If you see clearly, you'll see two dots, first and the last.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,413
    I see nothing.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    What are you saying? I can clearly see two dots.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  14. #14
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,413
    If we really are discussing about selecting something on the desktop, then take a look at this picture. Zoom it if you will. This is the area where I selected on the desktop. I see no pixels. Please tell me if you do.
    Attached Images Attached Images  
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    On Vista, it creates a solid translucent blue rectangle. If I try to make a straight line, I get no line or dots at all.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 08-23-2008, 01:16 PM
  2. Please Explain me few terms that i have listed in here.
    By chottachatri in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2008, 07:20 AM
  3. Can someone explain to me what this code means
    By Shadow12345 in forum C++ Programming
    Replies: 3
    Last Post: 12-22-2002, 11:36 AM
  4. Replies: 4
    Last Post: 11-19-2002, 08:18 PM
  5. Can someone explain "extern" to me?
    By valar_king in forum C++ Programming
    Replies: 3
    Last Post: 09-16-2001, 12:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21