level 12
简单aaaaaaa
楼主
#include<stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
int main()
{
int i=0;
SDL_Window*win=NULL;
SDL_Renderer*render=NULL;
SDL_Surface*picture=NULL;
SDL_Surface*surface=NULL;
SDL_Texture*img=NULL;
//Uint32 *pixer=NULL;
SDL_Init(SDL_INIT_EVERYTHING);
win=SDL_CreateWindow("像素操作",0,0,480,800,SDL_WINDOW_SHOWN);
render=SDL_CreateRenderer(win,-1,SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);
picture=IMG_Load("计算器.jpg");
surface=SDL_CreateRGBSurface(
SDL_SWSURFACE, picture->w, picture->h, picture->format->BitsPerPixel, picture->format->Rmask, picture->format->Gmask, picture->format->Bmask,0
//picture->format->Amask
);
Uint32*pixer=(Uint32*)surface->pixels;
Uint32*point=(Uint32*)picture->pixels;
for(i=0;i<800*360;i++)
{
pixer[i]=point[800*360-i];
}
img=SDL_CreateTextureFromSurface(render,surface);
SDL_RenderCopy(render,img,NULL,NULL);
SDL_RenderPresent(render);
SDL_Delay(10000);
}

2014年10月19日 14点10分
1
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
int main()
{
int i=0;
SDL_Window*win=NULL;
SDL_Renderer*render=NULL;
SDL_Surface*picture=NULL;
SDL_Surface*surface=NULL;
SDL_Texture*img=NULL;
//Uint32 *pixer=NULL;
SDL_Init(SDL_INIT_EVERYTHING);
win=SDL_CreateWindow("像素操作",0,0,480,800,SDL_WINDOW_SHOWN);
render=SDL_CreateRenderer(win,-1,SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);
picture=IMG_Load("计算器.jpg");
surface=SDL_CreateRGBSurface(
SDL_SWSURFACE, picture->w, picture->h, picture->format->BitsPerPixel, picture->format->Rmask, picture->format->Gmask, picture->format->Bmask,0
//picture->format->Amask
);
Uint32*pixer=(Uint32*)surface->pixels;
Uint32*point=(Uint32*)picture->pixels;
for(i=0;i<800*360;i++)
{
pixer[i]=point[800*360-i];
}
img=SDL_CreateTextureFromSurface(render,surface);
SDL_RenderCopy(render,img,NULL,NULL);
SDL_RenderPresent(render);
SDL_Delay(10000);
}
