rejetto forum

Èêîíêè â ìåíþ

Shyr · 12 · 4418

0 Members and 1 Guest are viewing this topic.

Offline Shyr

  • Occasional poster
  • *
    • Posts: 98
    • View Profile
    • http://andrqlibs.narod.ru
Êòî-íèáóäü èç ðàçðàáîò÷èêîâ ïîáîðîë, òàêóþ ôèãíþ: â ìåíþøêàõ èêîíêè íå íà ïðîçðà÷íîì ôîíå, à íà ñåðîì, ïðè÷åì ñåðîñòü ðàçíîãî îòòåíêà - èíîãäà âèäíà, èíîãäà íå î÷åíü?..


Vilux

  • Guest
Àíàëîãè÷íàÿ ôèãíÿ... íåóæåëè áîëüøå íè ó êîãî íå âñòðå÷àåòñÿ? Êàê èçáàâèòüñÿ îò ýòîãî ãëþêà?


Offline Neodim

  • Occasional poster
  • *
    • Posts: 7
    • View Profile
Quote from: "Vilux"
Àíàëîãè÷íàÿ ôèãíÿ... íåóæåëè áîëüøå íè ó êîãî íå âñòðå÷àåòñÿ? Êàê èçáàâèòüñÿ îò ýòîãî ãëþêà?
Ïðîçðà÷íîñòü ïîÿâëÿåòñÿ òîëüêî òîãäà, êîãäà â ñêèíå èñïîëüçóþòñÿ ïðîçðà÷íûå PNG. Åñëè îíè íåïðîçðà÷íû, òî ïîëó÷àåòñÿ òî, ÷òî êàê ðàç ó âàñ âñåõ.
Ó ìåíÿ âñå íîðìàëüíî.
Áåðèòå ôîòîøîï (èëè åùå ÷òî) è äåëàéòå png'øêè ñ ïðîçðà÷íûì ôîíîì. Õîòÿ ïðîùå ñêà÷àòü
Neodim (nedm.nm.ru)


Offline fregatte

  • Occasional poster
  • *
    • Posts: 92
    • View Profile
    • http://icqnet.ru/
ý-ý-ý-ý...òû äóìàåøü ìû íå ïîíÿëè ÷òî ïðîçðà÷íîñòü äîëæíà áûòü òîëüêî òàì ãäå îíà åñòü â png? =))
Íî ïîíèìàåøü ëè, â èñõîäíèêàõ êîòîðûå âûëîæèë ðåäæåòòî åñòü íåñêîëüêî ãëþêîâ, èç-çà êîòîðûõ ïðîçðà÷íîñòü ëèáî åñòü âåçäå, ëèáî åå âåçäå íåò...à íàñ÷åò ôîòîøîïà..òû æå íå áóäåøü ïåðåðèñîâûâàòü âñå ñîçäàííûå òåìêè ïîä ñâîþ âåðñèþ êðûñû? =)))


Offline Rapid

  • Occasional poster
  • *
    • Posts: 48
    • View Profile
    • R&Q Portal
ß óæå ñîâåòîâàë âîîáùå çàìåíèòü áèáëèîòåêó PNGunit íà pngImage È íå íóæíà áóäåò íèêàêàÿ dll. Ïðîçðà÷íîñòü â íåé ðåàëèçîâàíà õîðîøî! Ïåðåäåëêà êîäà ìèíèìàëüíàÿ (ìåíÿåòüñÿ íàçâàíèå ô-è).[/url]


Offline Shyr

  • Occasional poster
  • *
    • Posts: 98
    • View Profile
    • http://andrqlibs.narod.ru
Quote from: "Rapid"
ß óæå ñîâåòîâàë âîîáùå çàìåíèòü áèáëèîòåêó PNGunit íà pngImage È íå íóæíà áóäåò íèêàêàÿ dll. Ïðîçðà÷íîñòü â íåé ðåàëèçîâàíà õîðîøî! Ïåðåäåëêà êîäà ìèíèìàëüíàÿ (ìåíÿåòüñÿ íàçâàíèå ô-è).[/url]
Ïðèìåðû êîäîâ åñòü? à òî ÿ ñäåëàë êàê â õåëïå äàíî - íèêàêîãî ýôôåêòà (ýòî ÿ ïðî ñîçäàíèå BitMap-a èç PNG ñ ïðîçðà÷íîñòüþ)


Offline Vilux

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Ó ìåíÿ äðóãàÿ ïðîáëåìà. PNG çàãðóæàåòñÿ íîðìàëüíî è BMP âûâîäèòñÿ ñ íîðìàëüíîé ïðîçðà÷íîñòüþ, ÍÎ ïàëèòðà â BMP ïåðåäàåòñÿ íå òà, ÷òî â PNG. Ìåíüøå öâåòîâ, ñêîëüêî íå ìîãó ñêàçàòü, âðîäå 256, âìåñòî 24 áèò, êàê ïîëîæåíî. Èñïîëüçóþ PngImage, â ÷åì ìîæåò áûòü ïðîáëåìà?
function loadPic(fn:string; bmp:Tbitmap):boolean;
var
  ext:string;
  png:TPNGObject;
begin
  PNG:=TPNGObject.Create;
  try
    result:=TRUE;
    if not absPath(fn) then fn:=myPath+fn;
    ext:=extractFileExt(fn);
    if comparetext(ext,'.png')=0 then
      begin
      bmp.Transparent:=FALSE;
//      ReadBitmapFromPngFile(fn,bmp);
      PNG.LoadFromFile(fn);
      bmp.PixelFormat:=pf24bit;
      bmp.Assign(PNG);
      end
    else
      begin
      if ext <> '.bmp' then fn:=fn+'.bmp';
      bmp.loadFromFile(fn);
      bmp.transparent:=TRUE;
      end;
  except
    result:=FALSE
  end;
  png.Free;
end; // loadPic


Offline fregatte

  • Occasional poster
  • *
    • Posts: 92
    • View Profile
    • http://icqnet.ru/
Âîò èìåííî ïî ýòîìó ÿ è íå ñòàë åãî þçàòü... Ïðîáëåìà íå â ýòîé ïðîöåäóðêå, à â ñàìîì pngimage (ïðè ñ÷èòûâàíèè png ôàéëà ïî-ìîåìó)


Offline Vilux

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Ïðîáîâàë ñ÷èòûâàòü è çàïèñûâàòü png-ôàéë, öâåòà áûëè íîðìàëüíûìè. Âèäíî ïðîáëåìà â òîì, êàê ýòè öâåòà ïåðåäàþòñÿ â TBitmap
Òàê ÷òî òîãäà èñïîëüçîâàòü? Êàê ðåøèòü ïðîáëåìó?


Offline fregatte

  • Occasional poster
  • *
    • Posts: 92
    • View Profile
    • http://icqnet.ru/
Ïî-ìîåìó ïðîùå èñïðàâèòü pngunit... òàì ãëþê ïðè ïðåîáðàçîâàíèè àëüôà êàíàëà png-øíîãî â ïðîöåäóðêå ReadBitmapFromPng êàæåòñÿ...


Offline Vilux

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Íàðîä, ïîçäðàâëÿþ, íè÷åãî íå ñîîáðàæàÿ â àëüôà êàíàëàõ ÿ âðîäå íàøåë ãëþê è ñïîñîá åãî èñïðàâèòü.
 ìîäóëå PngUnit.pas íàéäèòå ïðîöåäóðó
procedure DrawPng(ACanvas: TCanvas; const Rect: TRect);
òàì åñòü ñòðî÷êè
        if a = 0 then
        begin
          // alpha is zero so no blending, just image data
          sl[ndx]     := b;
          sl[ndx + 1] := g;
          sl[ndx + 2] := r;
        end
        else if a < 255 then
        begin
          // blend with data from ACanvas as background
          sl[ndx]     := ((sl[ndx] * a) + ((255 - a) * b)) div 255;
          sl[ndx + 1] := ((sl[ndx + 1] * a) + ((255 - a) * g)) div 255;
          sl[ndx + 2] := ((sl[ndx + 2] * a) + ((255 - a) * r)) div 255;
        end;
Èõ íàäî çàìåíèòü íà
        if (a > 0) then
        begin
          // alpha is zero so no blending, just image data
          sl[ndx]     := b;
          sl[ndx + 1] := g;
          sl[ndx + 2] := r;
        end
        else
        begin
          // blend with data from ACanvas as background
          sl[ndx]     := ((sl[ndx] * a) + ((255 - a) * b)) div 255;
          sl[ndx + 1] := ((sl[ndx + 1] * a) + ((255 - a) * g)) div 255;
          sl[ndx + 2] := ((sl[ndx + 2] * a) + ((255 - a) * r)) div 255;
        end;
Ïîñëå ýòîãî âñå èêîíêè ñòàëè îòëè÷íî ïîêàçûâàòüñÿ  è áåç ãëþêîâ. Êàê âèäèòå, ïðèøëîñü ïîìåíÿòü â ïðîöåäóðå óñëîâèÿ ïî÷òè íà ïðîòèâîïîëîæíûå. Ñ ÷åì ýòî ñâÿçàíî - íå çíàþ. Îäíàêî äëÿ êðûñêè ýòîò âàðèàíò ïîäîõîäèò, ïî-êðàéíåé ìåðå ó ìåíÿ. Åñëè ó êîãî-òî òîæå ðàáîòàåò, ïóñòü îòïèøåòñÿ...
Çàáûë ñêàçàòü, ÷òî â ìîäóëå utilLib â ïðîöåäóðå
function loadPic(fn:string; bmp:Tbitmap):boolean;
bmp.Transparent äîëæåí áûòü ðàâåí true;


Anonymous

  • Guest
Ñêàæåì ñïàñèáî Vilux-ó !!! Óðààà!!