Giter Site home page Giter Site logo

sdl_savepng's People

Contributors

cbeck88 avatar driedfruit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sdl_savepng's Issues

convert from abgr to argb

I find some times if you want to save a surface is not argb format(such as abgr), the saved png is not what you want. So I temporarily add some convert code to the save function

define amask 0xFF000000

define rmask 0x00FF0000

define gmask 0x0000FF00

define bmask 0x000000FF

int SDL_SavePNG_RW(SDL_Surface *src, SDL_RWops *dst, int freedst)
{

SDL_Surface *surface = SDL_CreateRGBSurface(0, src->w, src->h, 32,
    rmask, gmask, bmask, amask);
SDL_Rect rect = {0, 0, src->w, src->h};
SDL_LowerBlit(src, &rect, surface, &rect);

Setting Pixels Per Inch

Hi, I've been trying to find a way to set pixels per inch, but despite my best efforts there's nothing available. Do you have any knowhow about how to set them? I'd love to see PPI as an option in a custom version of this library, thanks!

Compress to char*?

Hi, I'm writing a networked application that would benefit from an easy way to compress a SDL surface to a character string, so it can be sent over a network socket. I haven't spent a ton of time dissecting this library, but I'm slowly making sense of the libPNG calls. If you would be able to create a function similar to SDL_SavePNG that performs a similar function but stores the output of the compressed image in a string of char (or uchar or uint8_t), that would be extremely useful.

Right now, I'm copying uncompressed data over the network. I guess I can use zlib or something to reduce bandwidth, but the app saves in PNG, so native compression would be nice.

Thanks for your work! This library is dead simple and works great for saving files!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.