Win32 |
Author |
Message |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Thu Aug 24, 2006 1:05 pm Post subject: Working with pictures & graphics |
|
|
MSFT public Win32 GDI: Printer that supports JPEG with StretchDIBits
"I've wrote function that uses StretchDIBits with biCompression set to
BI_JPEG, now I need to test it, I've search for printer that supports
CHECKJPEGFORMAT escape, but I could not find one" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Aug 31, 2006 2:42 pm Post subject: |
|
|
MS Knowledge Base: How to load graphics files and display them in Visual C++
"Loadpic.exe is a sample that shows how to load graphics files like .gif,
.jpg, .bmp, .ico, .emf, .wmf, and displays them. To do this, use
functionality built into the OleLoadPicture function. The OleLoadPicture
function converts these different formats to an IPicture interface. We can
then use the IPicture::Render function to display them. " |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Mon Sep 11, 2006 12:37 am Post subject: |
|
|
Win32 Image Decoder in C
"After noticing the way IE/MS Help uses the res :// protocol I found two
articles that help explain the use of this with the ImgCtx interface." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Sep 13, 2006 4:51 pm Post subject: |
|
|
CodeGuru: Extracting the Thumbnails and EXIF Information of JPEG Files
"This program shows how it is easy to extract information complementary
to JPEG files. In particular, it work with the thumbnails, which are easier and
more rapid to extract and to recompute." |
|
Back to top |
|
|
Pietro Guest
|
Posted: Tue Oct 03, 2006 6:58 pm Post subject: DaniWeb |
|
|
You guys are sweeter than I can possibly deserve. Just started Win32 programming a few months ago and I have never seen more useful collection of links at a single place. One day I'll build myself a similar site, but first I need to finish my coding project.
Keep up the good work and stay cool! |
|
Back to top |
|
|
Blues Bro Guest
|
Posted: Sat Oct 07, 2006 5:02 pm Post subject: |
|
|
Yeah,
cool site! But why avoid basics like CreateWindow() and stuff? |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Oct 17, 2006 7:11 pm Post subject: |
|
|
C Board: Image Library
"Try CxImage Libraries"
"It's a bit of a pain the include in your project but once you have it's very
straight forward. It allows you load bmps,jpegs,gifs etc... rotate, crop,
resize... and then save as any format."
C Board: Saving bmps
"Hi, i want to save a bitmap which's loaded onto a dialog window into the
disk as a bmp/jpg file."
Last edited by delovski on Sat Dec 02, 2006 9:25 pm; edited 1 time in total |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Dec 02, 2006 8:21 pm Post subject: |
|
|
Downloading and displaying a jpg file
"I want to download a jpg file from internet, but I want to make the header
up myself and download it using WinSock. I know how to use sockets and
how to make POST queries etc. My question is: How do I receive a jpg from
server so the file remains untouched and doesn't break on 0 byte, and then
how do I display it from the memory?
There must be some libraries that allow you to load jpg from memory, not
from a file..." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Thu Dec 07, 2006 7:58 pm Post subject: |
|
|
Native support for jpeg files in Windows
"Guilty as charged. Actually, I did try it, but didn't think to check it with a
16-bit display setting. I hadn't counted on Windows capping the colour depth
to that of the current display mode. Now that's what I call a premature
optimisation
I've been through the mill with JPEG stuff before (in particular, the lack of
any Windows facility for saving JPEGs) and ended up using the IJG library.
Interestingly, the code behind OleLoadPicture is based on the IJG library,
too." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Tue Jan 23, 2007 7:21 pm Post subject: |
|
|
Rescaling metafile... problems with DC size
"Let me use an example to explain the problem: Suppose I copy from
Word an entire page and the resulting page is 1000 x 1000 pixels (so
g_MEtaFileRect is 0,0,1000,1000).
I discovered that PlayEnhMetaFile has a limit... if inside the metafile
there is a EMR_STRETCHDIBITS record, if the coordinates are bigger than
the screen resolution then it does not work." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Feb 21, 2007 6:41 pm Post subject: |
|
|
CodeGuru: Capturing Windows Regardless of Their Z-Order
"Capturing window content can be done easily by using the ::BitBlt(..)
from the screen DC; however, this kind of implementation forces you to
make sure that the window you want to capture is on top of the screen. In
this project, to capture all the screen (Desktop), this technique is useful.
Because it's not good for capturing covered windows, I capture windows
with the ::PrintWindow(..) API." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Apr 22, 2007 1:53 pm Post subject: |
|
|
cboard: Rendering 32-bit images - alpha is ignored
"I loaded a TGA image with alpha channel used (32-bit color) but for some
reason, the alpha channel is ignored when displaying the image." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Thu May 10, 2007 7:52 pm Post subject: |
|
|
DaniWeb: Displaying a JPEG image using Windows GUI
"This program shows how to display a JPEG (also GIF,BMP,WMF etc.) image
using some Windows Graphical User Interface C code. The program uses
the uuid.lib file that comes with many C compilers."
Code: | #include <ocidl.h> // LPPICTURE
#include <olectl.h> // OleLoadPicture()
#include <ole2.h> // CreateStreamOnHGlobal |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Mar 08, 2009 1:22 am Post subject: |
|
|
cboard - Bitmap Rotation?
"How can I rotate a bitmap using Win32 GDI?" |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Wed Jun 17, 2009 4:06 pm Post subject: |
|
|
cboard - Drawing bitmaps efficiently
"The bmp loader I made works well for certain bitmap images. I've used it to
load textures for opengl for quite a while and have never had a problem. But
now that I'm throwing the image to a static screen, about 1 out of 3 images
will end up being slanted with the colors screwed up. This never happened in
opengl, and I have tested this on 3 computers and they all do the same th-
ing. What gives?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Jun 20, 2009 2:52 pm Post subject: |
|
|
Jay Clegg - Warping Text to a Bézier curves
"A while back I got curious about how certain text effects could be acheived,
and one of the things I explored was warping text along a curve to achieve
a kind of sweeping effect. I created a prototype for this, to explore different
solutions." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Wed Apr 13, 2011 7:04 pm Post subject: |
|
|
Ernest Szoka - PNG WIN32 Programming Guide
"Well it took me some time to figure out how to integrate pnglib properly
into my application, I only wanted to spend 2 days doing this and all I wa-
nted was to load and save simple PNG files. I was faced with lack of info-
rmation, too much useless information and bad code examples. But how
can you complain if it's free. I though what I learned might prove usefull
to other people so I wrote this quick guide. Anyway here is a how-to for
reading and writing PNG that should help you get on your way as quickly
as possible. If your not familiar with using open source libraries this is a
good start." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jul 12, 2017 5:33 pm Post subject: |
|
|
github.com - DigiDNA/ICNS2ICO
"ICNS2ICO lets you easily convert icons from the Apple's ICNS format to the
Windows ICO format.
Since Windows Vista, ICO files may contain PNG encoded representations, up
to 256x256 pixels (Windows XP used BMP). So all applications generate PNG
representations when generating icons larger to 32x32." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Sat Mar 13, 2021 11:11 pm Post subject: |
|
|
petzold - Displaying and Printing
"In this section, we'll begin by looking at the two functions that Windows
supports for displaying a DIB on the video display or a printer page. For
better performance, you may eventually prefer a more roundabout method
for displaying bitmaps that I'll discuss later in this chapter. But these two
functions are a logical first start." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Mon Mar 15, 2021 5:03 pm Post subject: |
|
|
Index of /~main/bgi/source
//**********************************************************************
//
// dibutil.c
//
// Source file for Device-Independent Bitmap (DIB) API. Provides
// the following functions:
//
// CreateDIB() - Creates new DIB
// FindDIBBits() - Sets pointer to the DIB bits
// DIBWidth() - Gets the width of the DIB
// DIBHeight() - Gets the height of the DIB
// PaletteSize() - Calculates the buffer size required by a palette
// DIBNumColors() - Calculates number of colors in the DIB's color table
// CreateDIBPalette() - Creates a palette from a DIB
// DIBToBitmap() - Creates a bitmap from a DIB
// BitmapToDIB() - Creates a DIB from a bitmap
// PalEntriesOnDevice()- Gets the number of palette entries of a device
// GetSystemPalette() - Returns a handle to the current system palette
// AllocRoomForDIB() - Allocates memory for a DIB
// ChangeDIBFormat() - Changes a DIB's BPP and/or compression format
// ChangeBitmapFormat()- Changes a bitmap to a DIB with specified BPP and
// compression format
so - Save HBITMAP to *.bmp file using only Win32
"You typically either create another bitmap using CreateDIBSection, or you
get bitmap data with GetDIBits." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Tue Nov 09, 2021 9:57 am Post subject: |
|
|
vbforums - Tutorial: Being DPI Aware
Code: | Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
' Note: When DPI virtualization exists, HORZRES,VERTRES return virtualized values
Public Property Get ScreenWidth(Optional ByVal Actual As Boolean) As Single
' returned as Twips
If Actual Then
Dim hDC As Long: hDC = GetDC(0)
ScreenWidth = GetDeviceCaps(hDC, 118) * Screen.TwipsPerPixelX ' 118=DESKTOPHORZRES
ReleaseDC 0, hDC
Else
ScreenWidth = Screen.Width
End If
End Property
Public Property Get ScreenHeight(Optional ByVal Actual As Boolean) As Single
' returned as Twips
If Actual Then
Dim hDC As Long: hDC = GetDC(0)
ScreenHeight = GetDeviceCaps(hDC, 117) * Screen.TwipsPerPixelY ' 117=DESKTOPVERTRES
ReleaseDC 0, hDC
Else
ScreenHeight = Screen.Height
End If
End Property
Public Property Get ScreenDPI(Optional ByVal Actual As Boolean) As Single
If Actual Then
Dim hDC As Long: hDC = GetDC(0)
ScreenDPI = GetDeviceCaps(hDC, 118) / (Screen.Width / Screen.TwipsPerPixelX)
ReleaseDC 0, hDC
If ScreenDPI = 1 Then
ScreenDPI = 1440! / Screen.TwipsPerPixelX
Else
ScreenDPI = ScreenDPI * 96!
End If
Else
ScreenDPI = 1440! / Screen.TwipsPerPixelX
End If
End Property |
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Tue Nov 09, 2021 10:10 am Post subject: |
|
|
so - How to make emf file dpi aware
Code: | int dtX = GetDeviceCaps(hemfDC, DeviceCap.DESKTOPHORZRES);
int dtY = GetDeviceCaps(hemfDC, DeviceCap.DESKTOPVERTRES);
int scX = GetDeviceCaps(hemfDC, DeviceCap.HORZRES);
int scY = GetDeviceCaps(hemfDC, DeviceCap.VERTRES);
int lpX = GetDeviceCaps(hemfDC, DeviceCap.LOGPIXELSX);
int lpY = GetDeviceCaps(hemfDC, DeviceCap.LOGPIXELSY);
|
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3156 Location: Europe
|
Posted: Wed Dec 20, 2023 5:45 pm Post subject: |
|
|
so - Get screenshot as Byte array on windows, wrong bmp header data
"There are two parts to the problem:
1. Capturing the screen contents.
2. Encoding the screen capture into an image format.
This implementation captures the desktop into a DIB, optionally including an
alpha channel4. It has an obvious interface, and that's about the only nice
thing about it."
|
|
Back to top |
|
|
|