Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LINE_PlotPoint(SDL_Surface * surface,int x,int y, double alpha)
- {
- Uint32 *pixels = (Uint32 *)surface->pixels;
- Uint32 pixel=SYS_GetForegroundColor();
- Uint8 a= alpha*255;
- pixel&=~amask;
- pixel |= a;
- pixels[ ( y * surface->w ) + x ] =pixel;
- }
- if(event.type==SDL_MOUSEMOTION)
- {
- SDL_GetMouseState(&i,&j);
- i-=grect.x;
- j-=grect.y;
- TOOL_DrawLine(tempSurface,x,y,i,j,1);//Xiaolin Wu's line algorithm
- if(tempTexture)
- {
- SDL_DestroyTexture(tempTexture);
- }
- tempTexture=TOOL_CreateLineTexture(tempSurface,&srect,&drect);//create texture from surface and calculating rect(src & dest)
- if(tempTexture==NULL)
- {
- puts("error");
- }
- SDL_SetTextureBlendMode(tempTexture,SDL_BLENDMODE_BLEND);
- SDL_FillRect(tempSurface,NULL,NULL);//delete pixel from surface (no need for it)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement