Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:33:04+00:00 2026-05-27T14:33:04+00:00

I’m attemting to load an image that I exported from flash CS3 it’s a

  • 0

I’m attemting to load an image that I exported from flash CS3 it’s a very cute face but it loads very weird it loads on a blueish way this is the code for the two files:

//main.cpp 

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include "test.hpp"



int main(int argc, char *argv[])
{




SDL_Init(SDL_INIT_VIDEO);

// Activamos modo de video
screen = SDL_SetVideoMode(640,480,32,SDL_SWSURFACE | SDL_DOUBLEBUF);

    image = IMG_Load("face.bmp");

    dest.x = 200;
    dest.y = 200;


//Main Loop
while(Abierto)
{
    //We Draw
    Draw();

    //Events
    while( SDL_PollEvent(&event))
    {
        if(event.type == SDL_QUIT)
            Abierto = false;
            }


}


// We free the image
SDL_FreeSurface(image);

SDL_Quit();

return 0;
}

Now the other one the;

//test.hpp

DL_Surface *image = NULL, *screen = NULL;
SDL_Rect dest;
SDL_Event event;

bool Abierto = true;
float PlaneX = 300, PlaneY = 200;
float velX = 0.1, velY = 0.1;


void Draw()
{
Uint32 color;



// Black Background is created
color = SDL_MapRGB (screen -> format, 0, 0, 0);
SDL_FillRect (screen, NULL, color);
SDL_DisplayFormatAlpha(image);


SDL_BlitSurface(image, NULL, screen, &dest);

// Flip the working image buffer with the screen buffer
SDL_Flip (screen);


}

I need help with this please Im not that experienced on SDL stuff oh and if you want to take a closer look I uplaoded the project here.

Oh my bad I must add the image is 32 pixels with alpha according to flash exporting options

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:33:05+00:00Added an answer on May 27, 2026 at 2:33 pm

    According to docs, SDL_DisplayFormatAlpha returns a new image and keeps the original intact.

    So, try in the first part, when you load the image:

    SDL_Surface *origImage = IMG_Load("face.bmp");
    image = SDL_DisplayFormatAlpha(origImage);
    SDL_FreeSurface(origImage)
    

    As there is no need to call SDL_DisplayFormatAlpha each frame.

    Then in the second part, just blit image, without calling SDL_DisplayFormatAlpha.

    UPDATE

    I’ve just checked your picture, and it looks like it is a weird bmp. I’ve seen that before: BMP format is such a mess that if you don’t keep to the basics chances are that different programs will interpret the data differently.

    In your case:

    • display face.bmp shows correctly.
    • gthumb face.bmp shows nothing.
    • eog face.bmp says “bogus header data”.

    I strongly recommend using PNG files for all your game cartoon-like pictures and JPG for all the photo-like ones.

    So run

    $ convert face.bmp face.png
    

    And use the PNG file. I’ll will work better and you will have a file 20% the size of the original.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.