Results 1 to 5 of 5

Thread: Image Formatting.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    Image Formatting.

    So about 4 days ago I started work on an application that would load and display Sprite images from a fairly old console game. All is well, until I figure out that the image has to be anti-aliased...which I have no clue how to accomplish this seeing as VC# 2008 doesn't have any built in functions for anti-aliasing. I've also checked out this tutorial but I'm not sure it would work with the image format I'm using:

    http://www.vbforums.com/showthread.php?t=285163

    As you would imagine, the sprite data uses a custom image format with pixel and pallet data. Each pixel is 8-bit(1 byte), and uses a 256-color pallet.

    The pallet data is 16-bit(2-bytes) in the format RGBA, so one nybble per R G B A value. Okay, so here is the part I'm unsure of. The A value is apparently the Alpha AND Anti-Alias value.

    0 = Transparent Value
    1 - F = Anti-Alias Value

    So any idea if that tutorial I linked to would work in this case?



    Those colors don't blend to well without AA.
    Last edited by runehero123; Jan 2nd, 2009 at 10:07 AM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    Re: Image Formatting.

    No ideas? What would an anti alias value of 1-F(1 - 15) represent? The offset from the origin of the pixel?

    For example, from the tutorial link I posted:

    Private Sub DrawAntiAliasPixel(PicBox As PictureBox, ByVal X As Double, ByVal Y As Double, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer)

    The arguments in bold are what I would plug my AA value into, correct?

  3. #3
    Fanatic Member Andy_P's Avatar
    Join Date
    May 2005
    Location
    Dunstable, England
    Posts
    669

    Re: Image Formatting.

    VC# 2008 doesn't have any built in functions for anti-aliasing
    Yes it does, take a look at this link, it may help?
    http://msdn.microsoft.com/en-us/library/9t6sa8s9.aspx

    Perhaps you will have to convert your images that have a custom format to a .NET format.

    Here is a link to the available pixel formats:
    http://msdn.microsoft.com/en-us/libr...xelformat.aspx
    Using Windows XP Home sp3
    Mucking around with C# 2008 Express
    while ( this.deadHorse ) { flog( ); }


  4. #4
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: Image Formatting.

    Where does it say the A is alpha and antialias value? To me that doesn't make sense (especially given this is an old game you're dealing with).

    If it were just the alpha then that would make sense. i.e. a value of 0 means transparent, a value of 15 means totally visible, inbetween varies the opacity of the pixel (e.g. a value of 3 would be quite seethrough).

    In the DrawAntiAliasPixel method the X and Y values are the X and Y values of the pixel (where you want to draw it). They are declared as a double since his function performs antialiasing (the process of 'faking' drawing a pixel that's inbetween display pixels) and so can handle pixels at positions such as (12.5, 53.8).

    Having an antialias value per-pixel (as you describe) doesn't make any sense. Antialiasing is performed on all pixels of an image in the same way, not specifically to each pixel).
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    Re: Image Formatting.

    I figured it out actually. It was in RGBA 5551 format, which means that it uses 5-bits for each of the RGB values, and 1-bit for the A/Alpha value. That's where the confusion came in. Anyways, I fixed the code and it works perfectly now. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width