Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » image viewer
Re: image viewer [message #3117 is a reply to message #3094] Sun, 07 May 2006 21:57 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
mjkoskin wrote on Sat, 06 May 2006 15:34


I haven't found an example of displaying an image, so if someone knowing the guts of upp could post a simple example of a



I have to feel guilty responding this post: all the Image stuff is at the approaching end of complete refactoring (implementation and unfortunatly interfaces too). Means, any code using advanced Image things (PixelArray etc) will have to be redone soon... Sad

Well, let us do it to the advantage. New Image is almost ready, last missing piece (ide/IconDes) has no influence on development, so I am posting the new library here. Just copy files to your MyApps folder so that they will supersede standard packages.

The new Image is quite simple:

- pixel format is always RGBA (4 x 8bit)
- use ImageBuffer to create / modify
- use Image to pass around / display
- use Raster to read other formats (like .PNG, .GIF)
- use RasterEncoder to write other formats
- RasterFormat describes formats

To display image, draw it Smile I guess this example will help you:

void MyApp::Paint(Draw& w)
{
.....
   ImageBuffer ib(30, 30);
   memset(ib, 0x80, sizeof(RGBA) * ib.GetLength());
   Image img = ib;
   w.DrawImage(10, 10, img);
......


(Assigns 0x80 to all channels, means creates gray box with 50% opacity (alpha = 128)) and draws it at 10,10).

Mirek
  • Attachment: ndraw.zip
    (Size: 1.03MB, Downloaded 1244 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Encoding an image in base64
Next Topic: It can't dispay chinese characters properly
Goto Forum:
  


Current Time: Thu May 09 03:28:16 CEST 2024

Total time taken to generate the page: 0.02326 seconds