Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Working with pictures & graphics

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32
Win32  
Author Message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Thu Aug 24, 2006 1:05 pm    Post subject: Working with pictures & graphics Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Aug 31, 2006 2:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Mon Sep 11, 2006 12:37 am    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Sep 13, 2006 4:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Pietro
Guest





PostPosted: Tue Oct 03, 2006 6:58 pm    Post subject: DaniWeb Reply with quote

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





PostPosted: Sat Oct 07, 2006 5:02 pm    Post subject: Reply with quote

Yeah,

cool site! But why avoid basics like CreateWindow() and stuff?
Back to top
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Tue Oct 17, 2006 7:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Dec 02, 2006 8:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Thu Dec 07, 2006 7:58 pm    Post subject: Reply with quote

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 Sad

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Tue Jan 23, 2007 7:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Feb 21, 2007 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Apr 22, 2007 1:53 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Thu May 10, 2007 7:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Mar 08, 2009 1:22 am    Post subject: Reply with quote

cboard - Bitmap Rotation?

"How can I rotate a bitmap using Win32 GDI?"
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Wed Jun 17, 2009 4:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Jun 20, 2009 2:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Nov 21, 2009 1:34 am    Post subject: Reply with quote

José Roca - About GDI+, Downloads, GDI+ Reference & Flat API

"GDI+ is the successor to GDI, the graphics device interface included with
earlier versions of Windows."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Wed Apr 13, 2011 7:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Jul 12, 2017 5:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Jun 05, 2019 2:25 pm    Post subject: Reply with quote

cp - Library to display an image (JPG/GIF/BMP) in 300 lines/8K of code

"Here is a sample of what is possible to do with just plain C. This code will
display in a window an image that can be in JPG, GIF, BMP, or Windows
metafile format."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Sat Mar 13, 2021 11:10 pm    Post subject: Reply with quote

so - Raw/Direct acess on pixels data in a BITMAPINFO (HBITMAP)

"So far I've been capturing the screen to a HBITMAP, populating a BITMAPINFO
then creating a pointer of this BITMAPINFO variable to read directly from the
memory."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Sat Mar 13, 2021 11:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Mon Mar 15, 2021 5:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Mon Nov 08, 2021 10:02 pm    Post subject: Reply with quote

ms - How to Ensure That Your Application Displays Properly on High-DPI Displays

Code:
HDC screen = GetDC(0);
dpiX = static_cast<FLOAT>(GetDeviceCaps(screen, LOGPIXELSX));
dpiY = static_cast<FLOAT>(GetDeviceCaps(screen, LOGPIXELSY));
ReleaseDC(0, screen);
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Tue Nov 09, 2021 9:57 am    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Tue Nov 09, 2021 10:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3137
Location: Europe

PostPosted: Wed Dec 20, 2023 5:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group