POV-Ray : Newsgroups : povray.off-topic : Low-level fun : Re: Low-level fun Server Time
29 Sep 2024 03:12:04 EDT (-0400)
  Re: Low-level fun  
From: Tom Austin
Date: 21 Sep 2009 08:37:49
Message: <4ab7739d$1@news.povray.org>
Orchid XP v8 wrote:
> So now I'm wondering if Windows provides any easy way to load and save 
> bitmapped images. GDI appears to allow you to load and save in Windows 
> Bitmap format - arguably amoung the worst file formats *ever*. But what 
> about something more sane?
> 

Are you using .NET or VB6?
You can download .NET express for free
http://www.microsoft.com/express/vb/Default.aspx


I am currently working an application in .NET that works with image 
files (.BMP, .JPG, .PNG) - displays them, draws on them and saves them.

I've done it in both - without too much trouble and without DLL
hell.


.net - almost directly copied out of my application
colors a point
draws a rectangle
this is on a image in memory - it is not visible to the user
just assign the image to a image control to see it

********************************
********************************
********************************

Private MasterImage As Bitmap

MasterImage = New Bitmap(imageFilePath, False)

MasterImage.SetPixel(x, y, Color.CornflowerBlue)

Dim graphicsDrawer As Graphics

graphicsDrawer = Graphics.FromImage(MasterImage)

Dim penZoomLines As New Pen(Color.YellowGreen, 1)

penZoomLines.DashStyle = Drawing2D.DashStyle.Dash

Dim zoomRectangle As Rectangle

zoomRectangle.X = (FullCoords.Width / MasterImage.Width) * ZoomCoords.X

zoomRectangle.Y = 0

zoomRectangle.Width = (FullCoords.Width / MasterImage.Width) * 
ZoomCoords.Width

zoomRectangle.Height = FullCoords.Height

graphicsDrawer.DrawRectangle(penZoomLines, zoomRectangle)

MasterImage.Save("test.png", System.Drawing.Imaging.ImageFormat.Png)


********************************
********************************
********************************



Good luck getting your app going.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.