Istream ipicture Save image

Source: Internet
Author: User

// Ipicture * ppicture = NULL; uploaded Image
Ccomptr <istream> pfilestram;
Createstreamonhglobal (null, true, & pfilestram );
Long size;
HR = ppicture-> saveasfile (pstream, true, & size );
Char pathbuf [1024];
Cfile iconfile;
Iconfile. Open (text ("C: // bb.bmp"), cfile: modecreate | cfile: modewrite );
Large_integer Li;
Li. highpart = 0;
Li. lowpart = 0;
Ularge_integer ulnewpos;
Pstream-> seek (Li, stream_seek_set, & ulnewpos );
Ulong ureadcount = 1;
While (ureadcount> 0)
{

Pstream-> Read (pathbuf, sizeof (pathbuf), & ureadcount );
If (ureadcount> 0)
Iconfile. Write (pathbuf, ureadcount );
}

 

//*****************************

The ipicture render method can be used to display the stretch image. The question is, how can we save the stretch image?
How to Use the ipicture interface to enlarge the image and save it? solution: 1,
Please note
2,
Important
3,
Gzb
4,
How to Use the ipicture interface to enlarge images and save them:
Save the enlarged size. I have used it. It is 100% feasible.
5,
Csize Cs;
CS. x = picturerect. Width ();
CS. Y = picturerect. Height ();
Then save the CS
When reading... Next you should know. Storage is structured.
6,
Hbitmap hbmret = NULL;
Ole_handle HPIC = NULL;
Int newwidht;
Int newheight;
If (succeeded (pipic-> get_handle (& HPIC)
{
Hbmret = (hbitmap) copyimage (handle) HPIC,
Image_bitmap, newwidht, newheight, lr_createdibsection );
}
If (hbmret! = NULL)
{
Pictdesc pictd;
Pictd. cbsizeofstruct = sizeof (pictdesc );
Pictd. pictype = pictype_bitmap;
Pictd.bmp. hbitmap = hbmret;
// Create a new ipicture
Olecreatepictureindirect (...);
// Call ipicture-> saveasfile (...)
}
7,
Csize Cs;
CS. x = picturerect. Width ();
CS. Y = picturerect. Height ();
8,
Thank you, harry202 (Harry). The score has been given.

//************************************** *****

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.