K-Pad is a multi-featured notepad / organizer for Windows: print-out pages or booklets of photos, tables, and rich text.More...
This is my support blog, featuring help, tutorials, and comment. Welcome. :-)

Tuesday 18 November 2008

Stars

I'm going to try to be a little more regular with my blog entries from now on. I haven't been doing much K-Pad coding at all lately; I do have other projects, and it's depressing not having had any feedback (let alone registrations) for K-Pad. Yet my target user for this software is still myself, so I will still continue coding it where I see a need.

One thing I have added lately is a "star rating" column type for lists. I love rating things: songs, films, TV shows...

For example...

Since I already had a star's draw routine coded, adding ratings was relatively simple.

What made it a little trickier was getting the stars to wrap neatly:

Those were the four varieties I decided upon. Originally I used two bitmaps, one of five stars, one of no stars, and overlayed them depending on the rating chosen. However, for the wrapping to work as above I'd need eight of these (unless I used a single star as a bitmap: then I'd need two, but I'd have to blit eight more times). Also, a bitmap of a vector is never as good as a vector.

So, a 20% rating would equate to one gold star, four white ones. 40% would be two gold stars, three white ones. What about 25%, 30%...? Well, I decided to shade the "end star" by the propotionate amount, so that, for example, the second star for 25% would be a quarter gold; 30%, half-gold. This works well.

No comments: