CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Antialiasing?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rougie



Joined: 14 Jun 2006
Posts: 31

View user's profile Send private message

Antialiasing?
PostPosted: Sun Oct 05, 2008 8:57 pm     Reply with quote

Hello,

I am using a microchip MCU which is connected to a color LCD screen (176 x 132 pixels) with a 16 bit per pixel color depth. I am displaying images, icons and text. However, each character in my text font is made from plain black and white pixels. It looks okay, but if you look carefully you can see the imperfections of characters such as "X" or "C" around their rounding edges. All my fonts are stored in bmp files, converted to 16 bit per pixel depth format and stored in external flash. As I require, I load the data onto a common bus which is common to the MCU and LCD so the data can be displayed.

Therefore, for a clearer blend of the characters, it would be required for me to load my character in a portion of memory(for example a scratch pad area) in my processor and perform some rasterization operations of my character and then output it to my LCD.

The problem is that, rasterization is made up of a pretty complex algorithm and wondering if anyone knows if a rasterization module or library exists in C language.

For example, I would need a function that could recieve a particular color value(respective to some target pixel) and several other color values corresponding to the pixels surounding the target pixel and the function returns the calculated shades (or rasterized color values) of the pixels surounding the target pixel. The function does not need to know where the pixel physically resides on the LCD. The funtion just calculates the algorithm for the correct color shades required to do the antialiasing.

Does anyone know where I can find (if it exists) a commercial C module, function or library to do the rasterization described above?

All feedback is appreciated!

Best regards
Roberto
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Oct 05, 2008 11:55 pm     Reply with quote

176 x 132 pixels ia a rather rough resolution. To my opinion, the only way to get an acceptable character display is using char gens that are designed to the intended resolution. This can't be done by computer algorithms satisfyingly, cause it may sometimes require manual corrections.

You can study these effects e.g. on a windows computer. They use optimized raster character generators, at least for smaller characters. You can use the magnifying glass tool to inspect the characters. On newer windows versions, you can optionally activate a smoothed character display, that implies interpolation. To my opinion, it looks really bad, you always think you have to clean your glasses, I would never use it with an embedded system.
Guest








Wait a minute!
PostPosted: Mon Oct 06, 2008 8:56 pm     Reply with quote

Hello FvM:

Thankyou for replying to my post it is very nice of you!

>To my opinion, it looks really bad, you always think you have to clean >your glasses, I would never use it with an embedded system.

Well from my experience, I see otherwise, please read on!

I copied a character from MS WORD into my bitmap editor (Icon [spam]) and the character appeared antialiased. I downloaded it and displayed it. What a difference! Amazingly round and smooth appearence. And I would like all my characters to appear this way, but I have to do it in real time... I will explain!

I really can't prepare my character sets from MS WORD in the way I just
described because when I copy over a character from MS WORD to Icon [spam] (as described above), it was already antialliased *but* in respect to a white background. So when I displayed it on my small LCD on a white background, it was amazing. However, displaying this same character on a blue background, you would see a border of somewhat white pixels on the contour of the letter. And this was unacceptable.

So I can't really download a sample of every letter antialliased to every
possible background color for every character set, this would be very
redundant and a waste of memory. Instead I download a simple character set (true types I believe) fonts (white and black only) and need to rasterize or antiallias them myself as they are required to be displayed (at real time).

This is why I was wondering what rules I to apply to acheive this if I were to do it myself, if it is at all possible. I would have to figure out
how the human eye percieves the different shades that can go from a black character pixel to a colored background pixel and so forth.

>You can study these effects e.g. on a windows computer. They use >optimized raster character generators, at least for smaller characters. >You can use the magnifying glass tool to inspect the characters. On >newer windows versions, you can optionally activate a smoothed >character display, that implies interpolation

Its not so simple. I have looked at these antialiasings done from Windows and there really doesn't seem to be any pattern. What I am looking for is how to process a color degradation to accomplish antialiasing. Its like this:

For example if I have two pixels *not* aligned one on top of the other but touch each other at their conners. Assuming the top left corner is (0,0), suppose the first one is at coordinate (2,2) and the second one is at coordinate (3,1), and if the backgound is white, what color should be pixel coordinate at (2,1) be .... 50% between black and white (like
a shade of grey)?????

How could char gens help me if all this has to be done from code in the MCU?

Thankyou for your feedback !

All infos appreciated!

Regards Roberto!
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Oct 07, 2008 12:15 am     Reply with quote

Hello,

I'm not clear, if the smoothed or grey scale interpolated characters you describe are already used on your Windows PC or produced by your bitmap editor.

On my computer, I have only sharp characters without any grey scale pixels, and as I pointed out, I doubt, if interpolated characters are of much use. I still think, that 1-bit-deep character generators are the regular solution for general graphic display purposes.

But my experience with graphic programming is limited, and don't want to claim to know the answer to your problems. So, if you find character interpolation helpful to get a better graphics display, I must not try to change your mind.

In a general graphic processing view, interpolated pixels may be generated in a resizing process. When you want e. g. to downsize a higher resolution character generator (or any image), it is two-dimensionally low-pass filtered and resampled. As a result, you get grey scale pixels at the character outlines. Resizing algorithms are generally implementable at microprocessors, but imply a large computation amount. They would be applicable to a PIC only for small images, I think.

Regards,
Frank
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group