Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 20, 2013, 09:56:54 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Zooming pixels to squares?  (Read 2406 times)
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« on: August 03, 2009, 11:38:32 am »

For general use I appreciate MyDefrag uses a pixel on the screen as the basic display unit. However, when inspecting contents of the disk it'd be useful if it was possible to make it bigger, e.g. 2x2, 4x4 or even 8x8 pixels. Starting at 4x4 they could even have a border.
Sometimes it's hard for me to point my mouse exactly at specific pixel to check the file name.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: August 03, 2009, 12:45:32 pm »

For general use I appreciate MyDefrag uses a pixel on the screen as the basic display unit. However, when inspecting contents of the disk it'd be useful if it was possible to make it bigger, e.g. 2x2, 4x4 or even 8x8 pixels. Starting at 4x4 they could even have a border.
Yes, I have it on my wishlist to add some display alternatives.

Quote
Sometimes it's hard for me to point my mouse exactly at specific pixel to check the file name.
Click left to zoom in.
Logged
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« Reply #2 on: August 04, 2009, 08:33:44 pm »

Quote
Sometimes it's hard for me to point my mouse exactly at specific pixel to check the file name.
Click left to zoom in.
The problem is that if the (e.g. unmovable) file isn't big enough, its area is 1 pixel high and that often doesn't change when I zoom on it. Instead, zooming often causes the screen to change shape so much that I don't know what file I was trying to point at.
It'd be nice if there was option for zooming that would cause the mouse cursor to stay on the spot (moving the mouse pointer to appropriate place if necessary).

Well there is also another (crazy) idea I had long ago when I saw jkdefrag for the first time. Instead of filling the window line by line, it could use some kind of fractal filling (peano/hilbert curves) which would make files to have some area instead of being lines. But I think it's too crazy to be implemented... except if you get really bored someday.
« Last Edit: August 04, 2009, 08:42:25 pm by Kasuha » Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #3 on: August 04, 2009, 10:35:25 pm »

It'd be nice if there was option for zooming that would cause the mouse cursor to stay on the spot (moving the mouse pointer to appropriate place if necessary).
It already does that, the display already stays centered on the cursor when zooming, but only vertically. Point to the file that you are interested in and click a couple of times without moving the mouse. At higher zoomlevels it becomes more obvious what zoom is doing.

Quote
it could use some kind of fractal filling
Thanks for sharing your idea, I appreciate it. I have this and a couple of others already on my wishlist. It's a very long wishlist....
Logged
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« Reply #4 on: August 04, 2009, 11:14:53 pm »

It already does that, the display already stays centered on the cursor when zooming, but only vertically. Point to the file that you are interested in and click a couple of times without moving the mouse. At higher zoomlevels it becomes more obvious what zoom is doing.
Okay you're right... all files move horizontally which confused me but can be found on the line if one knows what's actually happening. It's just matter of getting used to it.
Thank you for explanation. Smiley
Logged
verdy_p
JkDefrag Hero
*****
Posts: 62


View Profile
« Reply #5 on: August 30, 2009, 12:24:50 am »

For general use I appreciate MyDefrag uses a pixel on the screen as the basic display unit. However, when inspecting contents of the disk it'd be useful if it was possible to make it bigger, e.g. 2x2, 4x4 or even 8x8 pixels. Starting at 4x4 they could even have a border.
Sometimes it's hard for me to point my mouse exactly at specific pixel to check the file name.
Yes I wish this option, but for me the border is not necessary; in fact it would dramatically increase the number of calls to GDI, because the blocks would need to be drawn individually, instead of by large rectangles.

In general, displaying a block should just need drawing at most three rectangles:

Let's say that the diskmap's sizes are given by (w,h) so that the rendering zone is between 0 and (w-1) horizontally, and between 0 and (h-1) vertically. Let's say that the first cluster rendered at (0,0) is number (first) when scrolling it, and that the current zoom level allows displaying (N) clusters in the current zoom level.

First round the display area according to the current "pixel" square size (currently, pixels are displayed as 1x1 "squares", but this should become a preference, independant of the "zoom level" currently defined, defined just as an integer between 1 and 8 ). This means that you have to adjust (w, h) :
w0 = w/square; h0 = h/square;

Then compute the total number of displayable "squares" in the display area: n0 = (w0*h0)

Let's say that (V) is number of representable/visible clusters (this depends of the current "zoom level" (Z), when it is 1, you are showing the map for the whole volume, and the user doesn't need to scroll the visible area) and that (N) is the total number of clusters on the whole volume:
V = N / Z.

The effective scale factor  for converting cluster numbers to relative square numbers will then be (scale = n0 / V), but for precision of rendering, and speed, it must be kept as two integers rather than as floating point).

According to the zoom level and vertical scrollbar position, the "First" representable cluster will be at position (F), where (F) is necessary between (0) and (N - V) inclusive.

Now you want to render an area between clusters (c) and (c+n-1), where (n) is the number of clusters in that area (note that part or all of this area may be hidden at the current zoom level, or simply non representable as it is too small to even fill one square).

First check if this area fits, at least partly, on screen:
if (c + n <= F || c >= F + V) then exit (nothing to draw);

Convert the inclusive start and exclusive end clusters using the scale factor (M) defined above (rounding down the integer divisions):
c1 = (c - F) * n0 / V;
c2 = (c - F + n) * n0 / V;

Compute (x1,y1) for the logical square position of the start of visible area to draw:
y1 = c1 / w0;
x1 = (y1 >= 0) ? c1 % w0 : (y1 = 0);

Compute (x2,y2) for the logical square position of the end of visible aera to draw:
y2 = c2 / w0;
x2 = (y2 < h0) ? c2 % w0 : (y2 = h0, w0);

Draw 1 to 3 rectangles conditionnally:

// First rectangle, possibly the last one
if (x1 > 0) {
  if(y1 == y2) {
    drawRectangle(
      from (x1 * square, y1 * square) inclusive
      to (x2 * square, (y1 + 1)* square) exclusive);
    exit;
  }
  drawRectangle(
    from (x1 * square, y1 * square) inclusive
    to (w0 * square, (y1 + 1) * square) exclusive);
  x1=0; y1++;
}
//  Second rectangle (conditional)
if (y1 < y2) {
  drawRectangle(
    from (0, y1 * square) inclusive
    to (w0 * square, y2 * square) exclusive);
}
// Third rectangle (conditional)
if (x2 > 0) {
  drawRectangle(
    from (0, y2 * square) inclusive
    to (x2 * square, (y2 + 1) * square) exclusive);
}

(Note: to simplify I have not taken account that the start of the volume is represented at the bottom of the display area: you should need to adjust the vertical coordinate negatively for GDI which uses the top as the starting position, and you still need to add the position of the display area within the window: this is assumed to be performed in the drawRectangle "call" above).

Most of the time, there will be only one rectangle drawn if it is visible, but many rectangle will not be drawn at all (because they are too small): this saves a lot of very slow GDI calls.

Note that you may speed up a bit this, if your "square" sizes are exact powers of two. In which case, some multiplications will become binary shifts.

This algorithm will not draw borders around squares: this would be too slow if there are many visible small squares on screen, with the smallest square sizes (like 3x3 drawn as 2x2 with a 1 pixel separation). But you could alternatively still use a representation in horizontal bands, without much performance impact with just a 1 pixel vertical separation between horizontal bands (bands should not be drawn for squares lower than 3x3), using an incremantal loop on (y1) for the second rectangle above.
« Last Edit: August 30, 2009, 12:37:06 am by verdy_p » Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #6 on: August 30, 2009, 09:35:01 am »

In general, displaying a block should just need drawing at most three rectangles:
Thanks for sharing your idea, I appreciate it.
Logged
verdy_p
JkDefrag Hero
*****
Posts: 62


View Profile
« Reply #7 on: August 30, 2009, 07:48:18 pm »

In general, displaying a block should just need drawing at most three rectangles:
Thanks for sharing your idea, I appreciate it.
In fact I have implemented this pseudo-code in my own GUI (and I have also optimized all the GDI calls). This really makes a difference.
Logged
AySz88
Newbie
*
Posts: 1


View Profile
« Reply #8 on: January 28, 2010, 12:12:36 am »

Quote
it could use some kind of fractal filling
Thanks for sharing your idea, I appreciate it. I have this and a couple of others already on my wishlist. It's a very long wishlist....

I had the exact same idea and registered to post it (not knowing that this post was here already).  Hilbert curve seems likely to be most pretty (like the xkcd "Map of the Internet" comic), but Z-order is probably the easiest code-wise.  You could shake up the whole "defragmentation as entertainment" segment! Wink
« Last Edit: January 28, 2010, 12:15:00 am by AySz88 » Logged
WHRoeder
JkDefrag Hero
*****
Posts: 180


View Profile
« Reply #9 on: January 28, 2010, 01:01:28 am »

Quote
Sometimes it's hard for me to point my mouse exactly at specific pixel to check the file name.
Click left to zoom in.
The problem is zooming in doesn't help. Small files are still one pixel big and therefor seeing which a file is unmovable is difficult. At a minimum I would put the first zoom level at 2x2 pixels per cluster.

Why is myDefrag.debuglog unmovable?
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #10 on: January 28, 2010, 03:32:52 am »

At a minimum I would put the first zoom level at 2x2 pixels per cluster.
Sorry, but i feel very strongly that MyDefrag should display the entire disk when it starts up. After that you can zoom in. And please note that a zoomlevel of 2x2 pixels per cluster will show only about 1 gigabyte of disk on the screen, depending on screen size and cluster size. Harddisks are much bigger than that.

Quote
Why is myDefrag.debuglog unmovable?
The debug logfile is off by default. It is intended for my use only, not for you. You are welcome to look at it, but the debug logfile is highly technical and not documented.
Logged
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« Reply #11 on: January 28, 2010, 07:27:22 am »

Sorry, but i feel very strongly that MyDefrag should display the entire disk when it starts up. After that you can zoom in. And please note that a zoomlevel of 2x2 pixels per cluster will show only about 1 gigabyte of disk on the screen, depending on screen size and cluster size. Harddisks are much bigger than that.
Jeroen sometimes I really can't decide if you are trying to make fools of us or if it is some kind of joking which I fail to understand.
Please let me demonstrate what a 2x2 diskmap is supposed to be about. Please note that my disk is 160 GB big and it fits pretty well in it. And sorry about blur, I resized it in MS paint and it doesn't have resizing options available.


* myd2x2.png (16.42 KB, 711x564 - viewed 267 times.)
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #12 on: January 28, 2010, 07:52:12 am »

Jeroen sometimes I really can't decide if you are trying to make fools of us or if it is some kind of joking which I fail to understand.
Nothing like that. I was replying to WHRoeder's "I would put the first zoom level at 2x2 pixels per cluster". The reply was not about what you said.

In your constructed snapshot every 2x2 pixelblock maps something like 100 clusters on disk. Not 1 pixel, which is what WHRoeder is asking. What color should the 2x2 pixelblock show if there are 99 normal clusters and 1 fragmented cluster? And that is just 1 case of a huge set of possible permutations between empty, fragmented, movable, selected, and processed clusters.
Logged
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« Reply #13 on: January 28, 2010, 07:59:08 am »

Nothing like that. I was replying to WHRoeder's "I would put the first zoom level at 2x2 pixels per cluster". The reply was not about what you said.
I am pretty sure WHRoeder meant what I meant in the first post in this thread. "2x2 pixels per pixel" does not make much sense and you can misinterpret it quite the same way. And you are already solving the coloring problem on current diskmap pixels so I don't think it would become any harder with this kind of zooming.

The only thing is that I believe there are more important things to improve on MyDefrag than diskmap zooming.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!