OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-01-2005, 13:12
drg
Guest
 
Posts: n/a
Default Work with BITMAP in Corel

Who knows?
How to take colour of a point (Xp,Yp) from some bitmap in CorelDRAW?
Reply With Quote
  #2  
Old 11-01-2005, 22:17
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Work with BITMAP in Corel

Quote:
Originally Posted by drg
Who knows?
How to take colour of a point (Xp,Yp) from some bitmap in CorelDRAW?
No way. You can, however, save the bitmap to a file, open it up in Photo-Paint and sample colors from there (it has CorelScript.GetPixelColor method)...

Or you can save it to a BMP format and then you can use my UI Extension library (http://www.oberonplace.com/script/uiextlibrary2) to load the image and sample the colors. However this will only work for RGB images though...
Reply With Quote
  #3  
Old 12-01-2005, 06:23
drg
Guest
 
Posts: n/a
Default

ok, thanks
Reply With Quote
  #4  
Old 16-01-2005, 09:29
drg
Guest
 
Posts: n/a
Default

Ок, I have thought up the function for reading BMP-24bit:

Code:
Private Type RGB
    RGB_R As Byte
    RGB_G As Byte
    RGB_B As Byte
End Type

Type BMP_Picture
    With As Long
    Height As Long
   ' Len As Long
    Point() As RGB
End Type

Function Read_BMP_Picture(ByVal FileName As String, _
                          ByRef BMP As BMP_Picture) As Boolean
'======================================================
' Ôóíêöèÿ äëÿ ÷òåíèÿ BMP-24 bit â ìàññèâ
'======================================================
Read_BMP_Picture = False
'On Error GoTo 10
Open FileName For Binary As #1 Len = 1
Dim P As Byte
BMP.Height = 0: BMP.With = 0
    Get #1, 19, P
    BMP.With = BMP.With + P
    Get #1, 20, P
    BMP.With = BMP.With + P * 256
    Get #1, 21, P
    BMP.With = BMP.With + P * 65536
    Get #1, 22, P
    BMP.With = BMP.With + P * 16777216
    Get #1, 23, P
    BMP.Height = BMP.Height + P
    Get #1, 24, P
    BMP.Height = BMP.Height + P * 256
    Get #1, 25, P
    BMP.Height = BMP.Height + P * 65536
    Get #1, 26, P
    BMP.Height = BMP.Height + P * 16777216
    
ReDim BMP.Point(BMP.With, BMP.Height)

Dim q As Long
Dim x As Single, y As Single
q = 52

For y = 1 To BMP.Height
    For x = 1 To BMP.With
        q = q + 3
        Get #1, q, BMP.Point(x, y).RGB_B
        Get #1, q + 1, BMP.Point(x, y).RGB_G
        Get #1, q + 2, BMP.Point(x, y).RGB_R
    Next
    q = q + 2
Next

Close #1
Read_BMP_Picture = True
Exit Function
10
End Function
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap names in Corel 12... meandirtyjoe CorelDRAW/Corel DESIGNER VBA 1 17-05-2005 09:14
Corel Technology Partner Program Survey Alex CorelDRAW/Corel DESIGNER VBA 4 05-05-2005 09:00
Is Corel to Excel data exchange possible? alex69 CorelDRAW/Corel DESIGNER VBA 8 24-06-2004 04:52
How do you switch Bitmap modes in CorelDraw 10 VBA? Rick Randall CorelDRAW/Corel DESIGNER VBA 1 14-05-2003 09:06
Corel Capture 8 and Corel Script Helix CorelDRAW CS 0 13-12-2002 18:10


All times are GMT -5. The time now is 01:39.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com