English
Forum

256-colours Bitmap Edit

 

Rainer
Hoefs
Hello together,

I must indizierte 256-colours Bitmaps, means with eigener palette, Edit and need moreover Help.

Bitmap becomes into memory loaded.

of it becomes a copy prepares The circa a suitable area right extended becomes.

on the angefügten area becomes one Rectangle painted with the Palettenindex 249.

then go hereon some lines with designed Palettnnummer pulled go.

thereafter becomes The Bitmap search, y-line for y-line each of left to right. each Pixel becomes on The Farbnummer examined, becomes a before festgelegte Farbnummer found becomes in the new area on same y-line one entsprechender point staid, etc.

the whole have I already as Macro in a Grafikprogramm (Grafx2) with Lua written and functions there correct.

i want but the same Program as self-employed Profan-EXE having circa it too without Grafx2 using to.

what me now missing are The suitable functions in Profan:

Palettennummer% = Getpixel(X,Y)
SetPixel(x ,y, Patettennummer%)
Line(x1, y1, x2, y2, Palettennummer%)
Rectangle(x1, y1, x2, y2, Palettennummer%)

Who as a hint, or soetwas already time made and can me a hint give.

Vielen Thanks beforehand
Rainer
 
05/03/19  
 




H.Brill
GetPixel and SetPixel there but already.
I go time of it from, that with Palettennummer%
one Farbwert meant is.
Line has of course none Farb-Parameter, but whom
can integrally simply with USEP before take on.
and with UseBrush go even different
Schraffuren and the colour for Rectangle tuned.

means should Yes everything there his.
and with StartPaint...EndPaint chid You on The
suitable Bitmap circa.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/03/19  
 




Rainer
Hoefs
Hello H. Brill,

very these functions weg not, there tappt im dunkeln only with the Übergabe of RGB( ? , ? , ? )-Values functions.

I must but exakte Palettenindizies transfer, means from the palette The Nr. 249 (or others between 0 and 255).

the went naturally in a binary opened BMP with binärem write. But this is extreme costly.

nevertheless thanks
Rainer
 
05/03/19  
 




H.Brill
Yes, What is because The Palettennummer%, from the
You promise ?
one can indeed with the functions

each Farbanteile rausziehen, sodaß one
nevertheless with RGB() works can :

I meant about so :
SetPixel x, y, RGB(GetRValue(Palettennummer%), GetGValue(Palettennummer%), GetBValue(Palettennummer%))
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/04/19  
 




Rainer
Hoefs
No, so does it not.

In of/ one 256-colours Bitmap there to the Header a palette with 3*256 Farbwerten How z.B 001 092 128 for colour 1
254 003 178 for colour 2 or
082 182 209 for 178 and
001 092 128 for colour 200 means same shade How colour 1 etc.

in the Bitmap-area are then only The Referenzen to the palette staid means 1 2 178 2 200 2 1 178 2 1 etc.

any Info, where which area, Header, Infoheader, Coreheader, palette and Bitmap in the File begin are in the Header stored.

at that Reading in a suitable Program How z.B. Grafx2 or the uralten DPaint2 becomes only red whom Paletteneintrag the point has, means 1 2 or 178. thereby is it alike which shade in RGB dahintersteht. The point has The reference as Palettennummer% to the 3 RGB-Values in the palette

I must now The BMP so read: if The Palettennummer% of Pixel(X,Y) The number 2 is then Setpixel(X1,Y, Palettennummer%), if it The number 178 is then...

with Profan can not do, because there go The RGB-values as entire number red. at that setpixel becomes then simply one point staid the to next suitable colour is correct, in this drop means with colour 200 in the point would The 1 staid, there tappt im dunkeln Yes both whom equal worth having. lying The colours in the palette tight together, comes one wirres Image thereby out.

I copy here time whom LUA-code into to that better understanding:

--Adds a weft-stearing-system right side to the solid
--created by Rainer Hoefs - www.rh-solid.eu
--Diese script is free for your personnel use.
--it go following lines angesetzt
--directly next to the solid Fb 249 line 1
--then Fb 4 line 2
--wander with used Schußfarben Fb 51 - 57 line 3
--then Fb 1 line 4
--wander with used Schußfarben Fb 51 - 57 line 5
--then FB 0 to Trennung line 6
--then 7 lines with the Fb 51 - 57 according to appear in the solid to control lines 7 - 13

run("../samples_2.4/libs/memory.lua")
dofile("../samples_2.4/libs/dawnbringer_lib.lua")
dofile("../carpetdesign/include/_language.lua")

--****************************************************

if language == "DE" then
txt1="Schußsteuerungs-system right of solid ansetzen"
txt2="max. Schußwechsler"
txt3="erste colour in the Design"
txt4="max. colours per Shußlinie"
else
txt1="Add weftstsystem right from the design"
txt2="max. weftsystems"
txt3="first color in design"
txt4="max. colors by weftline"
end

--****************************************************

w, h = getpicturesize()

StartColor = 51
MaxColorPerWeft = 1
WeftSystems = 7

ok, WeftSystems, StartColor, MaxColorPerWeft = inputbox(
txt1,
txt2, WeftSystems, 1, 20, 7,
txt3, StartColor, 1, 255, 3,
txt4, MaxColorPerWeft, 1, 7, 2)

if ok then
-- new Designgröße to charge and solid properly vergößern
newdesignw = w + 6 + WeftSystems
oldw = w
setpicturesize(newdesignw, h)
updatescreen()
-- Weiße expanse with solid lines right of solid draw
drawfilledrect(oldw,0,newdesignw-1,h-1,249) -- right whom Space in Fb.249 add
db.line(oldw + 1,0,oldw + 1,h-1,4) -- first Line with Fb. 4
db.line(oldw + 3,0,oldw + 3,h-1,1) -- second Line with Fb. 1
db.line(oldw + 5,0,oldw + 5,h-1,0) -- second Line with Fb. 1
updatescreen()
-- any counter zurücksetzen
WeftColorFound = 0
SearchColor = StartColor
EndColor = StartColor + (WeftSystems - 1)
ControlLine = oldw + 6
-- solid shot for shot search and spots into lines settle!
for y = 0, h-1, 1 do -- The Schußlinien search
for SearchColor = StartColor, EndColor , 1 do -- a colour to the others search
for x = 0, oldw - 1, 1 do -- The Fäden the Schußlinie by degrees Verify
c = getpicturepixel(x, y) -- Pixel reading
if c == SearchColor then -- if colour of Pixel with Suchfarbe übereinstimmt
WeftColorFound = WeftColorFound + 1 -- counter found colour settle
if WeftColorFound > MaxColorPerWeft then -- if More colours in the shot as allows Error Message
messagebox("Mehr as "..MaxColorPerWeft.." Schußfarben found!\n"..WeftColorFound.." found, "..MaxColorPerWeft.." allows!\nPosition: "..x.." / " ..y)
end
if WeftColorFound == 1 then
putpicturepixel(oldw + 2, y, c) -- Pixel in Steuerlinie 1 settle
elseif WeftColorFound > 1 then
putpicturepixel(oldw + 4, y, c) -- Pixel in Steuerlinie 2 settle
end
putpicturepixel(ControlLine, y, c) -- Kontrollpunkt settle
updatescreen()
-- messagebox("Found SearchColor","X = "..x.."\nY = "..y.."\nSearchColor = "..SearchColor.."\nEndColor = "..EndColor.."\nControlLine = "..ControlLine.."\nWeftColorFound = "..WeftColorFound)
break
end
end
ControlLine = ControlLine + 1
end
WeftColorFound = 0
ControlLine = oldw + 6
end
updatescreen()
finalizepicture()
end;

Please not on whom textilen Begriffen How solid, Weftsystem or Schußlinien disturbing. Weft and shot = Y-line
 
05/04/19  
 




H.Brill
Since there it certainly too for XProfan some.
in example
'########################################
'Farbpalette from Bitmaps read
'########################################
'########################################
'Andrea Miethe May 2002
'########################################
SetTrueColor 1
Declare Info#,RGBQuad_1bit#,RGBQuad_4bit#,RGBQuad_8bit#
Declare Dateiname$,Colors&,x%,Col&,B%,H%
Dim Info#,200'takes The BitmapInfos on
Dateiname$ = @LOADFILE$("Bitmap loading :","*.BMP")
Assign #1,Dateiname$
OpenRW #1
@BlockRead(#1,Info#,0,200)'BitmapInfos reading
Case Word(Info#,28) = 1  : Colors& = 2
Case Word(Info#,28) = 4  : Colors& = 16
Case Word(Info#,28) = 8  : Colors& = 256
window %maxx+1,0-640,480
cls RGB(192,192,192)
USEP 0,0,RGB(255,255,255)

If Word(Info#,0) <> 19778

    Print "No Bitmap"

Endif

If Word(Info#,28) > 8

    Print "No Palettenbild"

Endif

If Colors& = 2

    Dim RGBQuad_1bit#,8'  2 colours-palette
    Seek #1,54'here begins The palette
    @BlockRead(#1,RGBQuad_1bit#,0,8)'BitmapInfos reading
    h% = 0

    Whilenot x% = 8

        Col& = RGB(byte(RGBQuad_1bit#,x%+2),byte(RGBQuad_1bit#,x%+1),byte(RGBQuad_1bit#,x%))
        Usebrush 1,Col&
        Rectangle b%,h% - b%+20,h%+20
        add x%,4
        add B%,20

        if b% > 300

            add h%,20
            b% = 0

        endif

    EndWhile

Elseif Colors& = 16

    Dim RGBQuad_4bit#,64' 16 colours-palette
    Seek #1,54'here begins The palette
    @BlockRead(#1,RGBQuad_4bit#,0,64)'BitmapInfos reading
    h% = 0

    Whilenot x% = 64

        Col& = RGB(byte(RGBQuad_4bit#,x%+2),byte(RGBQuad_4bit#,x%+1),byte(RGBQuad_4bit#,x%))
        Usebrush 1,Col&
        Rectangle b%,h% - b%+20,h%+20
        add x%,4
        add B%,20

        if b% > 300

            add h%,20
            b% = 0

        endif

    EndWhile

Elseif Colors& = 256

    Dim RGBQuad_8bit#,1024'256 colours-palette
    Seek #1,54'here begins The palette
    @BlockRead(#1,RGBQuad_8bit#,0,1024)'BitmapInfos reading
    h% = 0

    Whilenot x% = 1024

        Col& = RGB(byte(RGBQuad_8bit#,x%+2),byte(RGBQuad_8bit#,x%+1),byte(RGBQuad_8bit#,x%))
        Usebrush 1,Col&
        Rectangle b%,h% - b%+20,h%+20
        add x%,4
        add B%,20

        if b% > 300

            add h%,20
            b% = 0

        endif

    EndWhile

Endif

CloseRW #1
setwindowpos %hwnd = 0,0-640,480
Waitinput
Dispose RGBQuad_1bit#
Dispose RGBQuad_4bit#
Dispose RGBQuad_8bit#
Dispose Info#
end
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/04/19  
 




Rainer
Hoefs
Hello H. Brill,

many Thanks for hint. Yes, the know I, have it 1998 already in a Program so similar carryed out.

i was hoping though, it on unkompliziertere Nature and point solve to, as over the binäre reading and write the Bitmap.

but there must I well time my Uralt-routines enable and unfortunately with corresponding, hoisted Change.

has Andreas, the Yes really pointed was, too a routine for the Reading the Bitmap (means Bildteil) written? And if Yes, where can The discover?

thanks
Rainer
 
05/04/19  
 




H.Brill
whom code I had of : [...] 

what the Reading the Bitmap concerns, become You well
yourself ran must. Something like is indeed very seldom
demand. here have I another explanation of
Frank Abbing :

time see, whether I it yet hinbekommen. means, the Bmp-stature with the Offsets:

0 always "BM" (2)
2 length the File (4)
6 =0 (4)
10 Offset the first Grafikbytes (4)
14 =40 (4)
18 wide the Bilds (4)
22 Höhe the Bilds (4)
26 ...unwichtig...

first LongInt Offset 10 read. here catch The Grafikdaten on.
per Pixel go 3 Bytes needed always in the Order blue - green - ruddy.
After eachone row becomes The Pixelfolge with Nullbytes on a through 4 teilbare amount complement.
The Pixel the Bilds are of left under to right supra squared.


i think, that to the Reading the Bildteils right simply hinbekommt.

comes then naturally hereon on, what everything so on functions need.

PS: The ProSpeed.dll bid a function, The The Nutzdaten of/ one
Bilddatei into byte-aray save. can you you evtl. too time
standing.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/04/19  
 




H.Brill
here have I yet little more Info found : [...] 

The Profbmp.dll
particularly in the enclosed Textdatei profbmp.txt
stand interesting Info.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/04/19  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.866 Views

Untitledvor 0 min.
Rainer Hoefs09/05/23
H.Brill12/30/21
Sven Bader10/23/21
N.Art11/18/20
More...

Themeninformationen

this Topic has 2 subscriber:

H.Brill (5x)
Rainer Hoefs (4x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie